From: Fletcher T. Penney Date: Sun, 4 Feb 2018 17:53:35 +0000 (-0500) Subject: Fix encoding of some markup inside LaTeX texttt environment (fixes #110 and #108) X-Git-Tag: 6.3.0^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8dc8ee953ae642c71dd4a6267e6811b7f64a0958;p=multimarkdown Fix encoding of some markup inside LaTeX texttt environment (fixes #110 and #108) --- diff --git a/Sources/libMultiMarkdown/latex.c b/Sources/libMultiMarkdown/latex.c index 03cde71..1393839 100644 --- a/Sources/libMultiMarkdown/latex.c +++ b/Sources/libMultiMarkdown/latex.c @@ -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: diff --git a/tests/MMD6Tests/Amps and Angles.fodt b/tests/MMD6Tests/Amps and Angles.fodt index f213944..2be8293 100644 --- a/tests/MMD6Tests/Amps and Angles.fodt +++ b/tests/MMD6Tests/Amps and Angles.fodt @@ -307,6 +307,10 @@ office:mimetype="application/vnd.oasis.opendocument.text"> &#169; &#169; &#xA9; &#xA9; + +15 + +& and &amp; and < and > in code span. diff --git a/tests/MMD6Tests/Amps and Angles.html b/tests/MMD6Tests/Amps and Angles.html index 10887c8..2ed2ee8 100644 --- a/tests/MMD6Tests/Amps and Angles.html +++ b/tests/MMD6Tests/Amps and Angles.html @@ -37,6 +37,10 @@

© &#xA9;

+

15

+ +

& and &amp; and < and > in code span.

+ diff --git a/tests/MMD6Tests/Amps and Angles.htmlc b/tests/MMD6Tests/Amps and Angles.htmlc index 159c49f..06fd648 100644 --- a/tests/MMD6Tests/Amps and Angles.htmlc +++ b/tests/MMD6Tests/Amps and Angles.htmlc @@ -31,3 +31,7 @@ latex config: article

© &#169;

© &#xA9;

+ +

15

+ +

& and &amp; and < and > in code span.

diff --git a/tests/MMD6Tests/Amps and Angles.tex b/tests/MMD6Tests/Amps and Angles.tex index ffe6933..a5a3aa8 100644 --- a/tests/MMD6Tests/Amps and Angles.tex +++ b/tests/MMD6Tests/Amps and Angles.tex @@ -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} diff --git a/tests/MMD6Tests/Amps and Angles.text b/tests/MMD6Tests/Amps and Angles.text index c377128..c897670 100644 --- a/tests/MMD6Tests/Amps and Angles.text +++ b/tests/MMD6Tests/Amps and Angles.text @@ -33,3 +33,7 @@ Here is an inline [link](). © `©` © `©` + +15 + +`& and & and < and > in code span.` diff --git a/tests/MMD6Tests/Code Spans.fodt b/tests/MMD6Tests/Code Spans.fodt index 01e3364..b897bd1 100644 --- a/tests/MMD6Tests/Code Spans.fodt +++ b/tests/MMD6Tests/Code Spans.fodt @@ -311,6 +311,12 @@ office:mimetype="application/vnd.oasis.opendocument.text"> -<>--&\&---... `foo` + +15 + +$foo << $bar + +#foo diff --git a/tests/MMD6Tests/Code Spans.html b/tests/MMD6Tests/Code Spans.html index 48094c8..3878424 100644 --- a/tests/MMD6Tests/Code Spans.html +++ b/tests/MMD6Tests/Code Spans.html @@ -41,6 +41,12 @@ baz

`foo`

+

15

+ +

$foo << $bar

+ +

#foo

+ diff --git a/tests/MMD6Tests/Code Spans.htmlc b/tests/MMD6Tests/Code Spans.htmlc index c59af92..6652c22 100644 --- a/tests/MMD6Tests/Code Spans.htmlc +++ b/tests/MMD6Tests/Code Spans.htmlc @@ -35,3 +35,9 @@ baz

-<>--&\&---...

`foo`

+ +

15

+ +

$foo << $bar

+ +

#foo

diff --git a/tests/MMD6Tests/Code Spans.tex b/tests/MMD6Tests/Code Spans.tex index dd9cc40..7093fb8 100644 --- a/tests/MMD6Tests/Code Spans.tex +++ b/tests/MMD6Tests/Code Spans.tex @@ -37,5 +37,11 @@ baz} \texttt{`foo`} +15 + +\texttt{\$foo << \$bar} + +\texttt{\#foo} + \input{mmd6-article-footer} \end{document} diff --git a/tests/MMD6Tests/Code Spans.text b/tests/MMD6Tests/Code Spans.text index 0ca834a..4ba8d74 100644 --- a/tests/MMD6Tests/Code Spans.text +++ b/tests/MMD6Tests/Code Spans.text @@ -37,3 +37,9 @@ foo `-<>--&\&---...` `` `foo` `` + +15 + +`$foo << $bar` + +`#foo`