t->child->type = TEXT_EMPTY;
t->child->mate->type = TEXT_EMPTY;
print("\\texttt{");
- mmd_export_token_tree_latex_raw(out, source, t->child, scratch);
+ mmd_export_token_tree_latex_tt(out, source, t->child, scratch);
print("}");
break;
case PAIR_BRACES:
if (t == NULL)
return;
+ switch (t->type) {
+ case ESCAPED_CHARACTER:
+ mmd_print_char_latex(out, source[t->start + 1]);
+ break;
+ case CODE_FENCE:
+ if (t->next)
+ t->next->type = TEXT_EMPTY;
+ case TEXT_EMPTY:
+ break;
+ default:
+ if (t->child)
+ mmd_export_token_tree_latex_raw(out, source, t->child, scratch);
+ else
+ print_token(t);
+ break;
+ }
+}
+
+
+void mmd_export_token_tree_latex_raw(DString * out, const char * source, token * t, scratch_pad * scratch) {
+ while (t != NULL) {
+ if (scratch->skip_token) {
+ scratch->skip_token--;
+ } else {
+ mmd_export_token_latex_raw(out, source, t, scratch);
+ }
+
+ t = t->next;
+ }
+}
+
+
+void mmd_export_token_latex_tt(DString * out, const char * source, token * t, scratch_pad * scratch) {
+ if (t == NULL)
+ return;
+
switch (t->type) {
case AMPERSAND:
print("\\&");
break;
- case AMPERSAND_LONG:
- print("\\textbackslash{}&");
- break;
case ANGLE_LEFT:
print("$<$");
break;
break;
default:
if (t->child)
- mmd_export_token_tree_latex_raw(out, source, t->child, scratch);
+ mmd_export_token_tree_latex_tt(out, source, t->child, scratch);
else
print_token(t);
break;
}
-void mmd_export_token_tree_latex_raw(DString * out, const char * source, token * t, scratch_pad * scratch) {
+void mmd_export_token_tree_latex_tt(DString * out, const char * source, token * t, scratch_pad * scratch) {
while (t != NULL) {
if (scratch->skip_token) {
scratch->skip_token--;
} else {
- mmd_export_token_latex_raw(out, source, t, scratch);
+ mmd_export_token_latex_tt(out, source, t, scratch);
}
t = t->next;
void mmd_export_token_latex_raw(DString * out, const char * source, token * t, scratch_pad * scratch);
void mmd_export_token_tree_latex_raw(DString * out, const char * source, token * t, scratch_pad * scratch);
+void mmd_export_token_latex_tt(DString * out, const char * source, token * t, scratch_pad * scratch);
+void mmd_export_token_tree_latex_tt(DString * out, const char * source, token * t, scratch_pad * scratch);
+
void mmd_export_citation_list_latex(DString * out, const char * source, scratch_pad * scratch);
void mmd_export_footnote_list_latex(DString * out, const char * source, scratch_pad * scratch);
5
-Here is a \href{http://example.com/?foo=1&bar=2}{link}\footnote{\href{http://example.com/?foo=1\&bar=2}{http:/\slash example.com\slash ?foo=1\&bar=2}} with an ampersand in the URL.
+Here is a \href{http://example.com/?foo=1&bar=2}{link}\footnote{\href{http://example.com/?foo=1&bar=2}{http:\slash \slash example.com\slash ?foo=1\&bar=2}} with an ampersand in the URL.
-Here is a link with an amersand in the link text: \href{http://att.com/}{AT\&T}\footnote{\href{http://att.com/}{http:/\slash att.com\slash }}.
+Here is a link with an amersand in the link text: \href{http://att.com/}{AT\&T}\footnote{\href{http://att.com/}{http:\slash \slash att.com\slash }}.
-Here is an inline \href{/script?foo=1&bar=2}{link}\footnote{\href{/script?foo=1\&bar=2}{\slash script?foo=1\&bar=2}}.
+Here is an inline \href{/script?foo=1&bar=2}{link}\footnote{\href{/script?foo=1&bar=2}{\slash script?foo=1\&bar=2}}.
-Here is an inline \href{/script?foo=1&bar=2}{link}\footnote{\href{/script?foo=1\&bar=2}{\slash script?foo=1\&bar=2}}.
+Here is an inline \href{/script?foo=1&bar=2}{link}\footnote{\href{/script?foo=1&bar=2}{\slash script?foo=1\&bar=2}}.
\begin{verbatim}
& and & and < and > in code block.
-\href{http://foo.com/}{http:/\slash foo.com\slash }
+\href{http://foo.com/}{http:\slash \slash foo.com\slash }
\href{mailto:foo@bar.com}{foo@bar.com}
\begin{center}\rule{3in}{0.4pt}\end{center}
\begin{verbatim}
--{}-{}-
+---
\end{verbatim}
5
bar
</code></pre>
+
+<p>foo</p>
+
+<pre><code>-<>--&\&---...
+</code></pre>
bar
</code></pre>
+
+<p>foo</p>
+
+<pre><code>-<>--&\&---...
+</code></pre>
bar
\end{verbatim}
+
+foo
+
+\begin{verbatim}
+-<>--&\&---...
+\end{verbatim}
bar
bar
+
+foo
+
+ -<>--&\&---...
<h1 id="math">Math </h1>
-<p>math <span class="math">\({e}^{i\pi }+1=0\)</span></p>
+<p>foo <span class="math">\({e}^{i\pi }+1=0\)</span> bar</p>
+
+<p><span class="math">\[ {x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a} \]</span></p>
+
+<p>foo <span class="math">\({e}^{i\pi }+1=0\)</span> bar</p>
+
+<p>foo <span class="math">\({e}^{i\pi }+1=0\)</span>, bar</p>
+
+<p><span class="math">\[{x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}\]</span></p>
<h1 id="smartquotes">Smart Quotes </h1>
<h1>Math </h1>
-<p>math ${e}^{i\pi }+1=0$</p>
+<p>foo \({e}^{i\pi }+1=0\) bar</p>
+
+<p>\[ {x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a} \]</p>
+
+<p>foo ${e}^{i\pi }+1=0$ bar</p>
+
+<p>foo ${e}^{i\pi }+1=0$, bar</p>
+
+<p>$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$</p>
<h1>Smart Quotes </h1>
\part{Math }
\label{math}
-math ${e}^{i\pi }+1=0$
+foo \({e}^{i\pi }+1=0\) bar
+
+\[ {x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a} \]
+
+foo ${e}^{i\pi }+1=0$ bar
+
+foo ${e}^{i\pi }+1=0$, bar
+
+$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$
\part{Smart Quotes }
\label{smartquotes}
# Math #
-math ${e}^{i\pi }+1=0$
+foo \\({e}^{i\pi }+1=0\\) bar
+
+\\[ {x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a} \\]
+
+foo ${e}^{i\pi }+1=0$ bar
+
+foo ${e}^{i\pi }+1=0$, bar
+
+$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$
# Smart Quotes #