case PAIR_MATH:
print_const("<span class=\"math\">");
- mmd_export_token_tree_html_raw(out, source, t->child, scratch);
+ mmd_export_token_tree_html_math(out, source, t->child, scratch);
print_const("</span>");
break;
break;
case MATH_BRACKET_OPEN:
- print_const("\\[");
+ print_const("\\\\[");
break;
case MATH_BRACKET_CLOSE:
- print_const("\\]");
+ print_const("\\\\]");
break;
case MATH_DOLLAR_SINGLE:
break;
case MATH_PAREN_OPEN:
- print_const("\\(");
+ print_const("\\\\(");
break;
case MATH_PAREN_CLOSE:
- print_const("\\)");
+ print_const("\\\\)");
break;
case QUOTE_DOUBLE:
}
+void mmd_export_token_html_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_html_raw(out, source, t, scratch);
+ break;
+ }
+}
+
+
void mmd_start_complete_html(DString * out, const char * source, scratch_pad * scratch) {
meta * m;
}
+void mmd_export_token_tree_html_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_html_math(out, source, t, scratch);
+ }
+
+ t = t->next;
+ }
+}
+
+
void mmd_export_footnote_list_html(DString * out, const char * source, scratch_pad * scratch) {
if (scratch->used_footnotes->size > 0) {
footnote * note;
void mmd_export_token_html_raw(DString * out, const char * source, token * t, scratch_pad * scratch);
void mmd_export_token_tree_html_raw(DString * out, const char * source, token * t, scratch_pad * scratch);
+void mmd_export_token_tree_html_math(DString * out, const char * source, token * t, scratch_pad * scratch);
void mmd_export_citation_list_html(DString * out, const char * source, scratch_pad * scratch);
void mmd_export_footnote_list_html(DString * out, const char * source, scratch_pad * scratch);
t->next->type = TEXT_EMPTY;
}
+ case MATH_BRACKET_OPEN:
+ case MATH_BRACKET_CLOSE:
+ case MATH_PAREN_OPEN:
+ case MATH_PAREN_CLOSE:
+ print_const("\\textbackslash{}\\textbackslash{}");
+ print_char(source[t->start + 2]);
+ break;
+
case TEXT_EMPTY:
break;