]> granicus.if.org Git - multimarkdown/commitdiff
Fix encoding of some markup inside LaTeX texttt environment (fixes #110 and #108)
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Sun, 4 Feb 2018 17:53:35 +0000 (12:53 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Sun, 4 Feb 2018 17:53:35 +0000 (12:53 -0500)
Sources/libMultiMarkdown/latex.c
tests/MMD6Tests/Amps and Angles.fodt
tests/MMD6Tests/Amps and Angles.html
tests/MMD6Tests/Amps and Angles.htmlc
tests/MMD6Tests/Amps and Angles.tex
tests/MMD6Tests/Amps and Angles.text
tests/MMD6Tests/Code Spans.fodt
tests/MMD6Tests/Code Spans.html
tests/MMD6Tests/Code Spans.htmlc
tests/MMD6Tests/Code Spans.tex
tests/MMD6Tests/Code Spans.text

index 03cde7185f0e957e460146aab99c6cb39a0c83f7..1393839b076943a9f7f9586cf2e546ab33312297 100644 (file)
@@ -2140,6 +2140,17 @@ void mmd_export_token_latex_tt(DString * out, const char * source, token * t, sc
                        mmd_print_char_latex(out, source[t->start + 1]);
                        break;
 
+               case HASH1:
+               case HASH2:
+               case HASH3:
+               case HASH4:
+               case HASH5:
+               case HASH6:
+               case TEXT_HASH:
+                       print_const("\\");
+                       print_token(t);
+                       break;
+
                case HTML_ENTITY:
                        if (source[t->start + 1] == '#') {
                                print_const("\\&\\#");
@@ -2156,6 +2167,14 @@ void mmd_export_token_latex_tt(DString * out, const char * source, token * t, sc
                                t->next->type = TEXT_EMPTY;
                        }
 
+               case MATH_DOLLAR_SINGLE:
+                       print_const("\\$");
+                       break;
+
+               case MATH_DOLLAR_DOUBLE:
+                       print_const("\\$\\$");
+                       break;
+
                case MATH_BRACKET_OPEN:
                case MATH_BRACKET_CLOSE:
                case MATH_PAREN_OPEN:
index f2139442b281ff5949776fbd796b49735ab26d6d..2be8293f2a42ebb1fd39f5c25cc121143a3eee8d 100644 (file)
@@ -307,6 +307,10 @@ office:mimetype="application/vnd.oasis.opendocument.text">
 <text:p text:style-name="Standard">&amp;#169; <text:span text:style-name="Source_20_Text">&amp;#169;</text:span></text:p>
 
 <text:p text:style-name="Standard">&amp;#xA9; <text:span text:style-name="Source_20_Text">&amp;#xA9;</text:span></text:p>
+
+<text:p text:style-name="Standard">15</text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">&amp; and &amp;amp; and &lt; and &gt; in code span.</text:span></text:p>
 </office:text>
 </office:body>
 </office:document>
index 10887c8d8923c9f15ce77f0fdeb08026cfbc42c3..2ed2ee835a17f8c352f385387b4995700724f385 100644 (file)
 
 <p>&#xA9; <code>&amp;#xA9;</code></p>
 
+<p>15</p>
+
+<p><code>&amp; and &amp;amp; and &lt; and &gt; in code span.</code></p>
+
 </body>
 </html>
 
index 159c49fb6ee91c5e1188d7ed96550c693b6718d1..06fd64866785fe6a60fc0e93d6fa81e9dee2f998 100644 (file)
@@ -31,3 +31,7 @@ latex config: article</p>
 <p>&#169; <code>&amp;#169;</code></p>
 
 <p>&#xA9; <code>&amp;#xA9;</code></p>
+
+<p>15</p>
+
+<p><code>&amp; and &amp;amp; and &lt; and &gt; in code span.</code></p>
index ffe693341eccc6a4bdc58acc60427c5c285bd4a2..a5a3aa838f28a0917a98ff6de5899ca877230092 100644 (file)
@@ -34,5 +34,9 @@ Here is an inline \href{/script?foo=1&bar=2}{link}\footnote{\href{/script?foo=1&
 
 \&\#xA9; \texttt{\&\#xA9;}
 
+15
+
+\texttt{\& and \& and < and > in code span.}
+
 \input{mmd6-article-footer}
 \end{document}
index c3771283844a500b42df1cd33a6d92fd2486946e..c897670a460bdaf73a4b66b4c308f7b63f635334 100644 (file)
@@ -33,3 +33,7 @@ Here is an inline [link](</script?foo=1&bar=2>).
 &#169; `&#169;`
  
 &#xA9; `&#xA9;`
+
+15
+
+`& and &amp; and < and > in code span.`
index 01e33641be77d54daca452228e88a13b9c906240..b897bd14b1babd0c33993cd659329d0e979fac3d 100644 (file)
@@ -311,6 +311,12 @@ office:mimetype="application/vnd.oasis.opendocument.text">
 <text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">-&lt;&gt;--&amp;\&amp;---...</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">15</text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">$foo &lt;&lt; $bar</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">#foo</text:span></text:p>
 </office:text>
 </office:body>
 </office:document>
index 48094c8d6507dde802b1c2d2bbf0ac4f199b6736..38784249846b30d5890555eddec60d64224d2981 100644 (file)
@@ -41,6 +41,12 @@ baz</code></p>
 
 <p><code>`foo`</code></p>
 
+<p>15</p>
+
+<p><code>$foo &lt;&lt; $bar</code></p>
+
+<p><code>#foo</code></p>
+
 </body>
 </html>
 
index c59af9234d1edfd4611c2cb613991145933d806e..6652c224b22a6d98cef2703e7bf722ca9bb8fcac 100644 (file)
@@ -35,3 +35,9 @@ baz</code></p>
 <p><code>-&lt;&gt;--&amp;\&amp;---...</code></p>
 
 <p><code>`foo`</code></p>
+
+<p>15</p>
+
+<p><code>$foo &lt;&lt; $bar</code></p>
+
+<p><code>#foo</code></p>
index dd9cc407ea7a4d3ac2954c98a4ebef6deca47897..7093fb87c5db1357d06f484f94802e7fa63747c2 100644 (file)
@@ -37,5 +37,11 @@ baz}
 
 \texttt{`foo`}
 
+15
+
+\texttt{\$foo << \$bar}
+
+\texttt{\#foo}
+
 \input{mmd6-article-footer}
 \end{document}
index 0ca834a079ec21d36f3b330d9375b0bedcd7b1e6..4ba8d7427b1f62a78889add9358b82b0db1fea45 100644 (file)
@@ -37,3 +37,9 @@ foo
 `-<>--&\&---...`
 
 `` `foo` ``
+
+15
+
+`$foo << $bar`
+
+`#foo`