]> granicus.if.org Git - multimarkdown/commitdiff
UPDATED: Ignore escaped space at end of code span
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Mon, 30 Jul 2018 17:33:04 +0000 (13:33 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Mon, 30 Jul 2018 17:33:04 +0000 (13:33 -0400)
Sources/libMultiMarkdown/html.c
Sources/libMultiMarkdown/latex.c
Sources/libMultiMarkdown/opendocument-content.c
tests/MMD6Tests/Escapes.fodt
tests/MMD6Tests/Escapes.html
tests/MMD6Tests/Escapes.htmlc
tests/MMD6Tests/Escapes.tex
tests/MMD6Tests/Escapes.text

index 68e03bef9d233af379e4402152f1df8631facd45..bdac5a4efbf7c4b197c5a7c3ffd6ccb70e9820a7 100644 (file)
@@ -2098,7 +2098,12 @@ void mmd_export_token_html_raw(DString * out, const char * source, token * t, sc
 
                case ESCAPED_CHARACTER:
                        print_const("\\");
-                       mmd_print_char_html(out, source[t->start + 1], false);
+                       
+                       if (t->next && t->next->type == TEXT_EMPTY && source[t->start + 1] == ' ') {
+                       } else {
+                               mmd_print_char_html(out, source[t->start + 1], false);
+                       }
+
                        break;
 
                case HTML_COMMENT_START:
index 952fed4a00eeaf642b5826c890b6e310a7ac1422..9d0666b6d9345e22f9fa70b97419dfaf52118cbf 100644 (file)
@@ -2002,8 +2002,10 @@ void mmd_export_token_latex_raw(DString * out, const char * source, token * t, s
        switch (t->type) {
                case ESCAPED_CHARACTER:
                        print_const("\\");
-                       print_char(source[t->start + 1]);
-//                     mmd_print_char_latex(out, source[t->start + 1]);
+                       if (t->next && t->next->type == TEXT_EMPTY && source[t->start + 1] == ' ') {
+                       } else {
+                               print_char(source[t->start + 1]);
+                       }
                        break;
 
                case HTML_ENTITY:
index 18e2792e0869c3f3f4e154e8c224ee4d0a269d58..08ef7b5c36f9d1205d1c7ee010ee83b92934be1b 100644 (file)
@@ -312,7 +312,10 @@ void mmd_export_token_opendocument_raw(DString * out, const char * source, token
 
                case ESCAPED_CHARACTER:
                        print_const("\\");
-                       mmd_print_char_opendocument(out, source[t->start + 1]);
+                       if (t->next && t->next->type == TEXT_EMPTY && source[t->start + 1] == ' ') {
+                       } else {
+                               mmd_print_char_opendocument(out, source[t->start + 1]);
+                       }
                        break;
 
                case HTML_COMMENT_START:
index 1f74fb98da5db06397c86f54718810ee453b5c84..03c1d2fd68bac01718252b64e4089de48318b898 100644 (file)
@@ -356,7 +356,7 @@ office:mimetype="application/vnd.oasis.opendocument.text">
 
 <text:p text:style-name="Preformatted Text">\-<text:line-break/>\&amp;<text:line-break/>\%<text:line-break/>\\<text:line-break/>\`<text:line-break/></text:p>
 
-<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">\- \&amp; \% \\ \`</text:span></text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">\- \&amp; \% \\ \ \</text:span></text:p>
 
 <text:p text:style-name="Standard">*foo*</text:p>
 
@@ -366,6 +366,16 @@ office:mimetype="application/vnd.oasis.opendocument.text">
 
 <text:p text:style-name="Standard">`foo`</text:p>
 
+<text:p text:style-name="Standard">`foo`</text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">foo\</text:span></text:p>
+
+<text:p text:style-name="Standard">`<text:span text:style-name="Source_20_Text">foo\</text:span></text:p>
+
+<text:p text:style-name="Standard">40</text:p>
+
+<text:p text:style-name="Standard">`<text:span text:style-name="Source_20_Text">foo</text:span></text:p>
+
 <text:p text:style-name="Standard">foo bar</text:p>
 
 <text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">\\[foo]</text:span></text:p>
index 562ce779879c26742812380e489378c99e22580a..aca209437290967643d5a75d3b6cdae43a14b75b 100644 (file)
@@ -89,7 +89,7 @@
 \`
 </code></pre>
 
-<p><code>\- \&amp; \% \\ \`</code></p>
+<p><code>\- \&amp; \% \\ \ \</code></p>
 
 <p>*foo*</p>
 
 
 <p>`foo`</p>
 
+<p>`foo`</p>
+
+<p><code>foo\</code></p>
+
+<p>`<code>foo\</code></p>
+
+<p>40</p>
+
+<p>`<code>foo</code></p>
+
 <p>foo&nbsp;bar</p>
 
 <p><code>\\[foo]</code></p>
index 313e2571ae7201c4c0081cc7924f55530ea64424..0838679ac8fe995396d59ec9e413a3255721a6de 100644 (file)
@@ -84,7 +84,7 @@ latex config: article</p>
 \`
 </code></pre>
 
-<p><code>\- \&amp; \% \\ \`</code></p>
+<p><code>\- \&amp; \% \\ \ \</code></p>
 
 <p>*foo*</p>
 
@@ -94,6 +94,16 @@ latex config:        article</p>
 
 <p>`foo`</p>
 
+<p>`foo`</p>
+
+<p><code>foo\</code></p>
+
+<p>`<code>foo\</code></p>
+
+<p>40</p>
+
+<p>`<code>foo</code></p>
+
 <p>foo bar</p>
 
 <p><code>\\[foo]</code></p>
index fc3cb3e9239547e99bdf4b14da12510d2c506e2c..05f82f7327409b56b1c18998ca8a8dee420d40b1 100644 (file)
@@ -86,7 +86,7 @@ $>$
 \`
 \end{verbatim}
 
-\texttt{\textbackslash{}- \textbackslash{}\& \textbackslash{}\% \textbackslash{}\textbackslash{} \textbackslash{}`}
+\texttt{\textbackslash{}- \textbackslash{}\& \textbackslash{}\% \textbackslash{}\textbackslash{} \textbackslash{} \textbackslash{} }
 
 *foo*
 
@@ -96,6 +96,16 @@ $>$
 
 `foo`
 
+`foo`
+
+\texttt{foo\textbackslash{} }
+
+`\texttt{foo\textbackslash{} }
+
+40
+
+`\texttt{foo}
+
 foo~bar
 
 \texttt{\textbackslash{}\textbackslash{}[foo]}
index 1d5562925d909bfee599ab1d0191a507e7d7b5e8..03fe2fe23cbda12489b8e58015e5e544856c464d 100644 (file)
@@ -83,7 +83,7 @@ latex config: article
        \\
        \`
 
-`\- \& \% \\ \``
+`\- \& \% \\ \ \ `
 
 \*foo\*
 
@@ -93,6 +93,16 @@ latex config:        article
 
 \`foo\`
 
+\`foo`
+
+`foo\ `
+
+\``foo\ `
+
+40
+
+\``foo`
+
 foo\ bar
 
 `\\[foo]`