print_const(""");
break;
+ case SUBSCRIPT:
+ if (t->child) {
+ print_const("~");
+ mmd_export_token_tree_html_raw(out, source, t->child, scratch);
+ } else {
+ print_token(t);
+ }
+
+ break;
+
+ case SUPERSCRIPT:
+ if (t->child) {
+ print_const("^");
+ mmd_export_token_tree_html_raw(out, source, t->child, scratch);
+ } else {
+ print_token(t);
+ }
+
+ break;
+
case CODE_FENCE:
if (t->next) {
t->next->type = TEXT_EMPTY;
print_token(t);
break;
+ case SUBSCRIPT:
+ if (t->child) {
+ print_const("\\ensuremath{\\sim}");
+ mmd_export_token_tree_latex_raw(out, source, t->child, scratch);
+ } else {
+ print_token(t);
+ }
+
+ break;
+
+ case SUPERSCRIPT:
+ if (t->child) {
+ print_const("\\^{}");
+ mmd_export_token_tree_latex_raw(out, source, t->child, scratch);
+ } else {
+ print_token(t);
+ }
+
+ break;
+
case CODE_FENCE:
if (t->next) {
t->next->type = TEXT_EMPTY;
print_const("\\}\\}");
break;
+ case SUBSCRIPT:
+ if (t->child) {
+ print_const("\\ensuremath{\\sim}");
+ mmd_export_token_tree_latex_tt(out, source, t->child, scratch);
+ } else {
+ print_const("\\ensuremath{\\sim}");
+ }
+
+ break;
+
+ case SUPERSCRIPT:
+ if (t->child) {
+ print_const("\\^{}");
+ mmd_export_token_tree_latex_tt(out, source, t->child, scratch);
+ } else {
+ print_const("\\^{}");
+ }
+
+ break;
+
case TEXT_BRACE_LEFT:
print_const("\\{");
break;
print_const(""");
break;
+ case MATH_BRACKET_OPEN:
+ case MATH_BRACKET_CLOSE:
+ case MATH_PAREN_OPEN:
+ case MATH_PAREN_CLOSE:
+ print_token(t);
+ break;
+
+ case SUBSCRIPT:
+ if (t->child) {
+ print_const("~");
+ mmd_export_token_tree_opendocument_raw(out, source, t->child, scratch);
+ } else {
+ print_token(t);
+ }
+
+ break;
+
+ case SUPERSCRIPT:
+ if (t->child) {
+ print_const("^");
+ mmd_export_token_tree_opendocument_raw(out, source, t->child, scratch);
+ } else {
+ print_token(t);
+ }
+
+ break;
+
case CODE_FENCE:
if (t->next) {
t->next->type = TEXT_EMPTY;
}
+void mmd_export_token_tree_opendocument_math(DString * out, const char * source, token * t, scratch_pad * scratch) {
+ while (t != NULL) {
+ if (scratch->skip_token) {
+ scratch->skip_token--;
+ } else {
+ mmd_export_token_opendocument_math(out, source, t, scratch);
+ }
+
+ t = t->next;
+ }
+}
+
+
+void mmd_export_token_opendocument_math(DString * out, const char * source, token * t, scratch_pad * scratch) {
+ if (t == NULL) {
+ return;
+ }
+
+ switch (t->type) {
+ case MATH_BRACKET_OPEN:
+ print_const("\\[");
+ break;
+
+ case MATH_BRACKET_CLOSE:
+ print_const("\\]");
+ break;
+
+ case MATH_PAREN_OPEN:
+ print_const("\\(");
+ break;
+
+ case MATH_PAREN_CLOSE:
+ print_const("\\)");
+ break;
+
+ default:
+ mmd_export_token_opendocument_raw(out, source, t, scratch);
+ break;
+ }
+}
+
void mmd_export_link_opendocument(DString * out, const char * source, token * text, link * link, scratch_pad * scratch) {
if (link->url) {
print_const("<text:a xlink:type=\"simple\" xlink:href=\"");
case PAIR_HTML_COMMENT:
break;
- case PAIR_EMPH:
case PAIR_MATH:
+ print_const("<text:span text:style-name=\"math\">");
+ mmd_export_token_tree_opendocument_math(out, source, t->child, scratch);
+ print_const("</text:span>");
+ break;
+
+ case PAIR_EMPH:
case PAIR_PAREN:
case PAIR_QUOTE_DOUBLE:
case PAIR_QUOTE_SINGLE:
void mmd_print_localized_char_opendocument(DString * out, unsigned short type, scratch_pad * scratch);
void mmd_export_token_opendocument_raw(DString * out, const char * source, token * t, scratch_pad * scratch);
+void mmd_export_token_opendocument_math(DString * out, const char * source, token * t, scratch_pad * scratch);
void mmd_export_link_opendocument(DString * out, const char * source, token * text, link * link, scratch_pad * scratch);
void mmd_export_image_opendocument(DString * out, const char * source, token * text, link * link, scratch_pad * scratch, bool is_figure);
<text:p text:style-name="Standard"><text:span text:style-name="math">\[ {x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a} \]</text:span></text:p>
-<text:p text:style-name="Standard">foo <text:span text:style-name="math">\({e}^{i\pi }+1=0\)</text:span> bar</text:p>
+<text:p text:style-name="Standard">foo <text:span text:style-name="math">${e}^{i\pi }+1=0$</text:span> bar</text:p>
-<text:p text:style-name="Standard">foo <text:span text:style-name="math">\({e}^{i\pi }+1=0\)</text:span>, bar</text:p>
+<text:p text:style-name="Standard">foo <text:span text:style-name="math">${e}^{i\pi }+1=0$</text:span>, bar</text:p>
-<text:p text:style-name="Standard"><text:span text:style-name="math">\[{x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}\]</text:span></text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="math">$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$</text:span></text:p>
<text:h text:outline-level="1"><text:bookmark text:name="smartquotes"/>Smart Quotes </text:h>
<text:p text:style-name="Standard"><text:span text:style-name="math">\[ {x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a} \]</text:span></text:p>
-<text:p text:style-name="Standard">foo <text:span text:style-name="math">\({e}^{i\pi }+1=0\)</text:span> bar</text:p>
+<text:p text:style-name="Standard">foo <text:span text:style-name="math">${e}^{i\pi }+1=0$</text:span> bar</text:p>
-<text:p text:style-name="Standard">foo <text:span text:style-name="math">\({e}^{i\pi }+1=0\)</text:span>, bar</text:p>
+<text:p text:style-name="Standard">foo <text:span text:style-name="math">${e}^{i\pi }+1=0$</text:span>, bar</text:p>
-<text:p text:style-name="Standard"><text:span text:style-name="math">\[{x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}\]</text:span></text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="math">$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$</text:span></text:p>
<text:p text:style-name="Standard">5</text:p>
<text:p text:style-name="Standard">$${x}_{1,2}=\frac{-b\pm \sqrt{{b}^{2}-4ac}}{2a}$$b</text:p>
-<text:p text:style-name="Standard"><text:span text:style-name="math">\(\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}\)</text:span></text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="math">$\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}$</text:span></text:p>
-<text:p text:style-name="Standard"><text:span text:style-name="math">\[\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}\]</text:span></text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="math">$$\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}$$</text:span></text:p>
<text:p text:style-name="Standard">15</text:p>
<text:p text:style-name="Standard"><text:span text:style-name="math">\[\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}\]</text:span></text:p>
-<text:p text:style-name="Standard"><text:span text:style-name="math">\(\begin{equation}\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}\end{equation}\)</text:span></text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="math">$\begin{equation}\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}\end{equation}$</text:span></text:p>
-<text:p text:style-name="Standard"><text:span text:style-name="math">\[\begin{equation}\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}\end{equation}\]</text:span></text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="math">$$\begin{equation}\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}\end{equation}$$</text:span></text:p>
<text:p text:style-name="Standard"><text:span text:style-name="math">\(\begin{equation}\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}\end{equation}\)</text:span></text:p>
<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">\begin{equation}\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}\end{equation}</text:span></text:p>
-<text:p text:style-name="Standard"><text:span text:style-name="math">\(a *foo* b\)</text:span></text:p>
+<text:p text:style-name="Standard"><text:span text:style-name="math">$a *foo* b$</text:span></text:p>
<text:p text:style-name="Standard"><text:span text:style-name="math">\[a *foo* b\]</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="math">\[\pi^2\]</text:span></text:p>
+
+<text:p text:style-name="Standard">25</text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="math">\[\pi~2\]</text:span></text:p>
</office:text>
</office:body>
</office:document>
<p><span class="math">\[a *foo* b\]</span></p>
+<p><span class="math">\[\pi^2\]</span></p>
+
+<p>25</p>
+
+<p><span class="math">\[\pi~2\]</span></p>
+
</body>
</html>
<p>$a <em>foo</em> b$</p>
<p>\[a <em>foo</em> b\]</p>
+
+<p>\[\pi^2\]</p>
+
+<p>25</p>
+
+<p>\[\pi~2\]</p>
\[a *foo* b\]
+\[\pi^2\]
+
+25
+
+\[\pi~2\]
+
\input{mmd6-article-footer}
\end{document}
$a *foo* b$
\\[a *foo* b\\]
+
+\\[\pi^2\\]
+
+25
+
+\\[\pi~2\\]
<text:p text:style-name="Standard">CH<text:span text:style-name="MMD-Subscript">3</text:span>CH<text:span text:style-name="MMD-Subscript">2</text:span>CH<text:span text:style-name="MMD-Subscript">2</text:span>CH<text:span text:style-name="MMD-Subscript">3</text:span></text:p>
<text:p text:style-name="Standard">CH<text:span text:style-name="MMD-Subscript">3</text:span>CH<text:span text:style-name="MMD-Subscript">2</text:span>CH<text:span text:style-name="MMD-Subscript">2</text:span>CH~3</text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">\pi^2</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">\pi^2^</text:span></text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">CH~4</text:span></text:p>
+
+<text:p text:style-name="Standard">20</text:p>
+
+<text:p text:style-name="Standard"><text:span text:style-name="Source_20_Text">CH~4~</text:span></text:p>
</office:text>
</office:body>
</office:document>
<p>CH<sub>3</sub>CH<sub>2</sub>CH<sub>2</sub>CH~3</p>
+<p><code>\pi^2</code></p>
+
+<p><code>\pi^2^</code></p>
+
+<p><code>CH~4</code></p>
+
+<p>20</p>
+
+<p><code>CH~4~</code></p>
+
</body>
</html>
<p>CH~3~CH~2~CH~2~CH~3~</p>
<p>CH~3~CH~2~CH~2~CH~3</p>
+
+<p><code>\pi^2</code></p>
+
+<p><code>\pi^2^</code></p>
+
+<p><code>CH~4</code></p>
+
+<p>20</p>
+
+<p><code>CH~4~</code></p>
CH\textsubscript{3}CH\textsubscript{2}CH\textsubscript{2}CH\ensuremath{\sim}3
+\texttt{\textbackslash{}pi\^{}2}
+
+\texttt{\textbackslash{}pi\^{}2\^{}}
+
+\texttt{CH\ensuremath{\sim}4}
+
+20
+
+\texttt{CH\ensuremath{\sim}4\ensuremath{\sim}}
+
\input{mmd6-article-footer}
\end{document}
CH~3~CH~2~CH~2~CH~3~
-CH~3~CH~2~CH~2~CH~3
\ No newline at end of file
+CH~3~CH~2~CH~2~CH~3
+
+`\pi^2`
+
+`\pi^2^`
+
+`CH~4`
+
+20
+
+`CH~4~`