]> granicus.if.org Git - multimarkdown/commitdiff
FIXED: Fix linebreaks in LaTeX; ADDED: Add Linebreaks test file
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 21 Feb 2017 18:30:55 +0000 (13:30 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 21 Feb 2017 18:30:55 +0000 (13:30 -0500)
README.md
configure-gh-pages
src/latex.c
src/writer.c
templates/README.md.in
tests/MMD6Tests/Linebreaks.html [new file with mode: 0644]
tests/MMD6Tests/Linebreaks.htmlc [new file with mode: 0644]
tests/MMD6Tests/Linebreaks.tex [new file with mode: 0644]
tests/MMD6Tests/Linebreaks.text [new file with mode: 0644]
tests/MMD6Tests/Tables.tex

index 014066a23a6022a29c0e869f84823e17f9ef3157..6bd9abb0a187634cc4e2718c2e44cd8ff714c744 100644 (file)
--- 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
+`<br />` (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? ##
 
index 1b1303dcf08e1700076ec44ed7d5524891ad270c..55abb977e2a342306f0a75dc5d904dd963987a50 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 
-mkdir documentation
+mkdir manual
 
-cd documentation
+cd manual
 
 git clone .. .
 
index a8c048c331de58e2f7c02e854b0861d75155d39b..069b7bced25f0540395e4909cceea74482a2d61f 100644 (file)
@@ -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;
index 13f1021808a9615072515ce0ba6c54cdeeb5266d..2db2d4b9188633e1fc3ab057321f98c455b8f699 100644 (file)
@@ -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);
 
index dcc221633bbfc0df5f5d7d0dc0a8a2f08df06160..c43e14031f07e4dd86d63754460a22ebef7091f2 100644 (file)
@@ -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
+`<br />` (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 (file)
index 0000000..2043764
--- /dev/null
@@ -0,0 +1,19 @@
+<p>foo
+bar</p>
+
+<p>foo
+bar</p>
+
+<p>foo<br />
+bar</p>
+
+<p>foo<br />
+bar</p>
+
+<p>foo<br />
+bar</p>
+
+<p>5</p>
+
+<p>foo<br />
+bar</p>
diff --git a/tests/MMD6Tests/Linebreaks.htmlc b/tests/MMD6Tests/Linebreaks.htmlc
new file mode 100644 (file)
index 0000000..2043764
--- /dev/null
@@ -0,0 +1,19 @@
+<p>foo
+bar</p>
+
+<p>foo
+bar</p>
+
+<p>foo<br />
+bar</p>
+
+<p>foo<br />
+bar</p>
+
+<p>foo<br />
+bar</p>
+
+<p>5</p>
+
+<p>foo<br />
+bar</p>
diff --git a/tests/MMD6Tests/Linebreaks.tex b/tests/MMD6Tests/Linebreaks.tex
new file mode 100644 (file)
index 0000000..608d85c
--- /dev/null
@@ -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 (file)
index 0000000..2e4de56
--- /dev/null
@@ -0,0 +1,20 @@
+foo
+bar
+
+foo 
+bar
+
+foo  
+bar
+
+foo   
+bar
+
+foo\
+bar
+
+5
+
+foo  
+bar  
+
index 6c5c4e781942bf9a36dd73a57cff8d52378f75a3..ef2ca73ccccf310c28303aca2f816fafe8a76293 100644 (file)
@@ -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