From: Fletcher T. Penney Date: Tue, 21 Feb 2017 18:30:55 +0000 (-0500) Subject: FIXED: Fix linebreaks in LaTeX; ADDED: Add Linebreaks test file X-Git-Tag: 0.4.0-b^2~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b11feff9ba15e646c5ca25a0f9b3bdab8a10e3a;p=multimarkdown FIXED: Fix linebreaks in LaTeX; ADDED: Add Linebreaks test file --- diff --git a/README.md b/README.md index 014066a..6bd9abb 100644 --- a/README.md +++ b/README.md @@ -479,6 +479,11 @@ I actually think it makes sense. This may or may not change in the future. 6. Table captions in MMD-6 must come immediately *after* the table, not before it. +7. Escaped linebreaks (`\` preceding a line break) will be interpreted as +`
` (even in compatibility mode). This was previously an optional +feature in MMD, but I don't see a problem with just making it default +behavior. + ## Where Does MultiMarkdown 6 Stand? ## diff --git a/configure-gh-pages b/configure-gh-pages index 1b1303d..55abb97 100755 --- a/configure-gh-pages +++ b/configure-gh-pages @@ -1,8 +1,8 @@ #!/bin/sh -mkdir documentation +mkdir manual -cd documentation +cd manual git clone .. . diff --git a/src/latex.c b/src/latex.c index a8c048c..069b7bc 100644 --- a/src/latex.c +++ b/src/latex.c @@ -1377,7 +1377,7 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat break; case TEXT_LINEBREAK: if (t->next) { - print_const("\n"); + print_const("\\\\\n"); scratch->padded = 1; } break; diff --git a/src/writer.c b/src/writer.c index 13f1021..2db2d4b 100644 --- a/src/writer.c +++ b/src/writer.c @@ -1291,15 +1291,17 @@ void process_metadata_stack(mmd_engine * e, scratch_pad * scratch) { free(temp_char); } else if (strcmp(m->key, "latexmode") == 0) { - temp_char = label_from_string(m->value); + if (scratch->output_format == FORMAT_LATEX) { + temp_char = label_from_string(m->value); - if (strcmp(temp_char, "beamer") == 0) { - scratch->output_format = FORMAT_BEAMER; - } else if (strcmp(temp_char, "memoir") == 0) { - scratch->output_format = FORMAT_MEMOIR; - } + if (strcmp(temp_char, "beamer") == 0) { + scratch->output_format = FORMAT_BEAMER; + } else if (strcmp(temp_char, "memoir") == 0) { + scratch->output_format = FORMAT_MEMOIR; + } - free(temp_char); + free(temp_char); + } } else if (strcmp(m->key, "quoteslanguage") == 0) { temp_char = label_from_string(m->value); diff --git a/templates/README.md.in b/templates/README.md.in index dcc2216..c43e140 100644 --- a/templates/README.md.in +++ b/templates/README.md.in @@ -479,6 +479,11 @@ I actually think it makes sense. This may or may not change in the future. 6. Table captions in MMD-6 must come immediately *after* the table, not before it. +7. Escaped linebreaks (`\` preceding a line break) will be interpreted as +`
` (even in compatibility mode). This was previously an optional +feature in MMD, but I don't see a problem with just making it default +behavior. + ## Where Does MultiMarkdown 6 Stand? ## diff --git a/tests/MMD6Tests/Linebreaks.html b/tests/MMD6Tests/Linebreaks.html new file mode 100644 index 0000000..2043764 --- /dev/null +++ b/tests/MMD6Tests/Linebreaks.html @@ -0,0 +1,19 @@ +

foo +bar

+ +

foo +bar

+ +

foo
+bar

+ +

foo
+bar

+ +

foo
+bar

+ +

5

+ +

foo
+bar

diff --git a/tests/MMD6Tests/Linebreaks.htmlc b/tests/MMD6Tests/Linebreaks.htmlc new file mode 100644 index 0000000..2043764 --- /dev/null +++ b/tests/MMD6Tests/Linebreaks.htmlc @@ -0,0 +1,19 @@ +

foo +bar

+ +

foo +bar

+ +

foo
+bar

+ +

foo
+bar

+ +

foo
+bar

+ +

5

+ +

foo
+bar

diff --git a/tests/MMD6Tests/Linebreaks.tex b/tests/MMD6Tests/Linebreaks.tex new file mode 100644 index 0000000..608d85c --- /dev/null +++ b/tests/MMD6Tests/Linebreaks.tex @@ -0,0 +1,19 @@ +foo +bar + +foo +bar + +foo\\ +bar + +foo\\ +bar + +foo\\ +bar + +5 + +foo\\ +bar diff --git a/tests/MMD6Tests/Linebreaks.text b/tests/MMD6Tests/Linebreaks.text new file mode 100644 index 0000000..2e4de56 --- /dev/null +++ b/tests/MMD6Tests/Linebreaks.text @@ -0,0 +1,20 @@ +foo +bar + +foo +bar + +foo +bar + +foo +bar + +foo\ +bar + +5 + +foo +bar + diff --git a/tests/MMD6Tests/Tables.tex b/tests/MMD6Tests/Tables.tex index 6c5c4e7..ef2ca73 100644 --- a/tests/MMD6Tests/Tables.tex +++ b/tests/MMD6Tests/Tables.tex @@ -54,8 +54,8 @@ \end{minipage} \end{table} -\textbar{} foo4 \textbar{} bar4 \textbar{} -\emph{foo} \textbar{} \emph{bar} \textbar{} +\textbar{} foo4 \textbar{} bar4 \textbar{}\\ +\emph{foo} \textbar{} \emph{bar} \textbar{}\\ \textbar{} \textbf{foo bar} \textbar{}\textbar{} 5