summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLev Lamberov <dogsleg@debian.org>2016-02-07 21:05:53 +0500
committerLev Lamberov <dogsleg@debian.org>2016-02-07 21:05:53 +0500
commite5ebc58df833143384cc2b20e3b46c01c2510812 (patch)
treeef04bdd3113ce94ed74d45163bf493bd4657fecd
parentfecbfd83fd4692e91a35fc08497cfd9a6313e0af (diff)
Imported Upstream version 1.0.5
-rw-r--r--Makefile2
-rw-r--r--README.md6
-rw-r--r--include/bitops.h2
-rw-r--r--include/common.h2
-rw-r--r--include/cstack.h2
-rw-r--r--include/cstring.h2
-rw-r--r--include/main.h4
-rw-r--r--include/markdown.h2
-rw-r--r--include/parser.h2
-rw-r--r--include/url.h2
-rw-r--r--include/viewer.h2
-rw-r--r--mdp.14
-rw-r--r--sample.md23
-rw-r--r--src/Makefile2
-rw-r--r--src/cstack.c2
-rw-r--r--src/cstring.c2
-rw-r--r--src/main.c4
-rw-r--r--src/markdown.c2
-rw-r--r--src/parser.c12
-rw-r--r--src/url.c2
-rw-r--r--src/viewer.c24
21 files changed, 60 insertions, 45 deletions
diff --git a/Makefile b/Makefile
index 1d6f3ef..15fd54c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
#
# Makefile
-# Copyright (C) 2015 Michael Goehler
+# Copyright (C) 2016 Michael Goehler
#
# This file is part of mdp.
#
diff --git a/README.md b/README.md
index 136ec44..4ab38f9 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,6 @@
mdp needs the ncursesw headers to compile.
So make sure you have them installed:
-- on Ubuntu/Debian you need `libncursesw5` and `libncursesw5-dev`
- on Cygwin you need `libncursesw10` and `libncurses-devel`
Now download and install mdp:
@@ -21,9 +20,11 @@ Now download and install mdp:
$ mdp sample.md
- On Arch, you can use the existing [AUR package](https://aur.archlinux.org/packages/mdp-git/).
-- On Slackware, grab the SlackBuild here: (http://slackbuilds.org/apps/mdp/), or run `sbopkg -i mdp`.
+- On Debian, you can use the existing [DEB package](https://tracker.debian.org/pkg/mdp-src), or run `apt-get install mdp`.
- On FreeBSD, you can use the port [misc/mdp](http://www.freshports.org/misc/mdp).
- On OS-X, use the existing [Homebrew Formula](http://brewformulas.org/Mdp) by running `brew install mdp`.
+- On Slackware, grab the SlackBuild here: (http://slackbuilds.org/apps/mdp/), or run `sbopkg -i mdp`.
+- On Ubuntu, you can use the existing [DEB package](https://launchpad.net/ubuntu/+source/mdp-src), or run `apt-get install mdp`.
Most terminals support 256 colors only if the TERM variable is
set correctly. To enjoy mdp's color fading feature:
@@ -77,4 +78,3 @@ Review sample.md for more details.
To make a debug version of `mdp`, just type:
$ make DEBUG=1
-
diff --git a/include/bitops.h b/include/bitops.h
index 0d18aec..5314804 100644
--- a/include/bitops.h
+++ b/include/bitops.h
@@ -3,7 +3,7 @@
/*
* Macros to do bit operations on integer variables.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/include/common.h b/include/common.h
index 5f22246..2a0379a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -3,7 +3,7 @@
/*
* Common macros.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/include/cstack.h b/include/cstack.h
index a876ddb..831e1d8 100644
--- a/include/cstack.h
+++ b/include/cstack.h
@@ -3,7 +3,7 @@
/*
* An implementation of a char stack in heap memory.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/include/cstring.h b/include/cstring.h
index 506b52c..8fa72c3 100644
--- a/include/cstring.h
+++ b/include/cstring.h
@@ -3,7 +3,7 @@
/*
* An implementation of expandable c strings in heap memory.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/include/main.h b/include/main.h
index 0ec4fa8..edf4679 100644
--- a/include/main.h
+++ b/include/main.h
@@ -3,7 +3,7 @@
/*
* mdp -- A command-line based markdown presentation tool.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,6 +25,6 @@
#define MDP_VER_MAJOR 1
#define MDP_VER_MINOR 0
-#define MDP_VER_REVISION 4
+#define MDP_VER_REVISION 5
#endif // !defined( MAIN_H )
diff --git a/include/markdown.h b/include/markdown.h
index 3a85947..07268dc 100644
--- a/include/markdown.h
+++ b/include/markdown.h
@@ -3,7 +3,7 @@
/*
* An implementation of markdown objects.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/include/parser.h b/include/parser.h
index 7a18377..e8ad380 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -5,7 +5,7 @@
* Functions necessary to parse a file and transform its content into
* a deck of slides containing lines. All based on markdown formating
* rules.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/include/url.h b/include/url.h
index 254ca6d..ed13ad6 100644
--- a/include/url.h
+++ b/include/url.h
@@ -3,7 +3,7 @@
/*
* An object to store all urls of a slide.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/include/viewer.h b/include/viewer.h
index eef6869..94578b3 100644
--- a/include/viewer.h
+++ b/include/viewer.h
@@ -5,7 +5,7 @@
* Functions necessary to display a deck of slides in different color modes
* using ncurses. Only white, red, and blue are supported, as they can be
* faded in 256 color mode.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/mdp.1 b/mdp.1
index 599f9a2..6179d61 100644
--- a/mdp.1
+++ b/mdp.1
@@ -5,7 +5,7 @@
.\"
.
.
-.TH MDP 1 "2015-04-10" "User Commands"
+.TH MDP 1 "2016-02-07" "User Commands"
.SH NAME
mdp \- A command-line based
markdown presentation tool
@@ -140,7 +140,7 @@ Exit
Written by Michael Goehler and others, see
.IR https://github.com/visit1985/mdp/blob/master/AUTHORS "."
.SH COPYRIGHT
-Copyright (C) 2015 Michael Goehler
+Copyright (C) 2016 Michael Goehler
.PP
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/sample.md b/sample.md
index 6e70ab8..4e304c6 100644
--- a/sample.md
+++ b/sample.md
@@ -1,6 +1,6 @@
%title: mdp - Sample Presentation
%author: visit1985
-%date: 2014-09-22
+%date: 2016-02-07
-> mdp <-
=========
@@ -82,11 +82,11 @@ C program starts with `main()`.
-> # Supported markdown formatting <-
-Code blocks are automatically detected by 4
-spaces at the beginning of a line.
+Code blocks are automatically detected by 4 spaces
+at the beginning of a line.
-Tabs are automatically expanded to 4 spaces
-while parsing the input.
+Tabs are automatically expanded to 4 spaces while
+parsing the input.
\ int main(int argc, char \*argv[]) {
\ printf("%s\\n", "Hello world!");
@@ -102,9 +102,9 @@ becomes
-> # Supported markdown formatting <-
-You can also use [pandoc](http://pandoc.org/demo/example9/pandocs-markdown.html)'s fenced code block extension.
-Use at least three ~ chars to open and at least as many or
-more ~ for closing.
+You can also use [pandoc](http://pandoc.org/demo/example9/pandocs-markdown.html)'s fenced code block
+extension. Use at least three ~ chars to open and
+at least as many or more ~ for closing.
\~~~ {.numberLines}
\int main(int argc, char \*argv[]) {
@@ -120,7 +120,8 @@ int main(int argc, char \*argv[]) {
}
~~~~~~~~~~~~~~~~~~
-Pandoc attributes (like ".numberlines" etc.) will be ignored
+Pandoc attributes (like ".numberlines" etc.)
+will be ignored
-------------------------------------------------
@@ -160,8 +161,8 @@ _some_ *highlighted* _*text*_
-> # Supported markdown formatting <-
Backslashes force special markdown characters
-like *\**, *\_*, *#* and *>* to be printed as normal
-characters.
+like *\**, *\_*, *#* and *>* to be printed as
+normal characters.
\\\*special\\\*
diff --git a/src/Makefile b/src/Makefile
index 70b5af5..fda0972 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,6 +1,6 @@
#
# Makefile
-# Copyright (C) 2015 Michael Goehler
+# Copyright (C) 2016 Michael Goehler
#
# This file is part of mdp.
#
diff --git a/src/cstack.c b/src/cstack.c
index 610483e..0209edf 100644
--- a/src/cstack.c
+++ b/src/cstack.c
@@ -1,6 +1,6 @@
/*
* An implementation of a char stack in heap memory.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/src/cstring.c b/src/cstring.c
index 7184d2f..27ddaed 100644
--- a/src/cstring.c
+++ b/src/cstring.c
@@ -1,6 +1,6 @@
/*
* An implementation of expandable c strings in heap memory.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/src/main.c b/src/main.c
index 00ef6d8..3165a00 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,6 @@
/*
* mdp -- A command-line based markdown presentation tool.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ void usage() {
void version() {
printf("mdp %d.%d.%d\n", MDP_VER_MAJOR, MDP_VER_MINOR, MDP_VER_REVISION);
- printf("Copyright (C) 2015 Michael Goehler\n");
+ printf("Copyright (C) 2016 Michael Goehler\n");
printf("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n");
printf("This is free software: you are free to change and redistribute it.\n");
printf("There is NO WARRANTY, to the extent permitted by law.\n");
diff --git a/src/markdown.c b/src/markdown.c
index 32e8c31..9adfeef 100644
--- a/src/markdown.c
+++ b/src/markdown.c
@@ -1,6 +1,6 @@
/*
* An implementation of markdown objects.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/src/parser.c b/src/parser.c
index f0d4ed3..eb50016 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -2,7 +2,7 @@
* Functions necessary to parse a file and transform its content into
* a deck of slides containing lines. All based on markdown formating
* rules.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
@@ -89,7 +89,8 @@ deck_t *markdown_load(FILE *input) {
slide = next_slide(slide);
sc++;
- } else if(CHECK_BIT(bits, IS_TILDE_CODE) && CHECK_BIT(bits, IS_EMPTY)) {
+ } else if(CHECK_BIT(bits, IS_TILDE_CODE) &&
+ CHECK_BIT(bits, IS_EMPTY)) {
// remove tilde code markers
(text->reset)(text);
@@ -339,6 +340,11 @@ int markdown_analyse(cstring_t *text, int prev) {
// return IS_EMPTY on null pointers
if(!text || !text->value) {
SET_BIT(bits, IS_EMPTY);
+
+ // continue fenced code blocks across empty lines
+ if(num_tilde_characters > 0)
+ SET_BIT(bits, IS_CODE);
+
return bits;
}
@@ -600,7 +606,7 @@ void markdown_debug(deck_t *deck, int debug) {
void adjust_line_length(line_t *line) {
int l = 0;
const static wchar_t *special = L"\\*_`"; // list of interpreted chars
- const wchar_t *c = &line->text->value[line->offset];
+ const wchar_t *c = &line->text->value[0];
cstack_t *stack = cstack_init();
// for each char in line
diff --git a/src/url.c b/src/url.c
index 18b7397..0e49b49 100644
--- a/src/url.c
+++ b/src/url.c
@@ -1,6 +1,6 @@
/*
* Functions necessary to handle pandoc URLs.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
diff --git a/src/viewer.c b/src/viewer.c
index 0e8204f..c23dc40 100644
--- a/src/viewer.c
+++ b/src/viewer.c
@@ -2,7 +2,7 @@
* Functions necessary to display a deck of slides in different color modes
* using ncurses. Only white, red, and blue are supported, as they can be
* faded in 256 color mode.
- * Copyright (C) 2015 Michael Goehler
+ * Copyright (C) 2016 Michael Goehler
*
* This file is part of mdp.
*
@@ -93,11 +93,10 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa
while(line && line->text) {
- if (line->text->value)
+ if (line->text->value) {
lc += url_count_inline(line->text->value);
-
- if (line->text->value)
line->length -= url_len_inline(line->text->value);
+ }
if(line->length > COLS) {
i = line->length;
@@ -511,16 +510,25 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa
void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colors) {
- if(!line->text->value) {
- return;
- }
-
int i; // increment
int offset = 0; // text offset
// move the cursor in position
wmove(window, y, x);
+ if(!line->text->value) {
+
+ // fill rest off line with spaces if we are in a code block
+ if(CHECK_BIT(line->bits, IS_CODE) && colors) {
+ wattron(window, COLOR_PAIR(CP_BLACK));
+ for(i = getcurx(window) - x; i < max_cols; i++)
+ wprintw(window, "%s", " ");
+ }
+
+ // do nothing
+ return;
+ }
+
// IS_UNORDERED_LIST_3
if(CHECK_BIT(line->bits, IS_UNORDERED_LIST_3)) {
offset = next_nonblank(line->text, 0);