summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
8 files changed, 32 insertions, 18 deletions
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);