From: Fletcher T. Penney Date: Fri, 3 Mar 2017 21:15:33 +0000 (-0500) Subject: ADDED: Continue to work on ODF export X-Git-Tag: 0.4.0-b^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c1d51408be8d46ac5f159e7372b017da15210f5c;p=multimarkdown ADDED: Continue to work on ODF export --- diff --git a/Sources/libMultiMarkdown/odf.c b/Sources/libMultiMarkdown/odf.c index 1c05b6c..a22b683 100644 --- a/Sources/libMultiMarkdown/odf.c +++ b/Sources/libMultiMarkdown/odf.c @@ -88,6 +88,8 @@ void mmd_print_char_odf(DString * out, char c) { case '>': print_const(">"); break; + case '\t': + print_const(""); default: print_char(c); break; @@ -287,7 +289,7 @@ void mmd_export_image_odf(DString * out, const char * source, token * text, link print_const(""); } } - + print_const("\n\n"); scratch->padded = 1; @@ -407,6 +409,14 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch print_const(""); scratch->padded = 0; break; + case BLOCK_HR: + pad(out, 2, scratch); + print_const(""); + scratch->padded = 0; + break; + case BLOCK_HTML: + // Don't print HTML + break; case BLOCK_LIST_BULLETED_LOOSE: case BLOCK_LIST_BULLETED: temp_short = scratch->list_is_tight; @@ -481,6 +491,12 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch print_const(""); scratch->padded = 0; break; + case BRACE_DOUBLE_LEFT: + print_const("{{"); + break; + case BRACE_DOUBLE_RIGHT: + print_const("}}"); + break; case BRACKET_CITATION_LEFT: print_const("[#"); case BRACKET_LEFT: @@ -530,11 +546,19 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch mmd_print_char_odf(out, source[t->start + 1]); } break; + case HASH1: + case HASH2: + case HASH3: + case HASH4: + case HASH5: + case HASH6: + print_token(t); + break; case INDENT_SPACE: print_char(' '); break; case INDENT_TAB: - print_char('\t'); + print_const(""); break; case LINE_LIST_BULLETED: case LINE_LIST_ENUMERATED: @@ -613,7 +637,11 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch mmd_print_string_odf(out, temp_char); print_const(""); } else if (scan_html(&source[t->start])) { - print_token(t); + // We ignore HTML blocks + if (scan_html_comment(&source[t->start])) { + // But allow HTML comments as raw LaTeX + d_string_append_c_array(out, &source[t->start + 4], t->len - 4 - 3); + } } else { mmd_export_token_tree_odf(out, source, t->child, scratch); } @@ -705,6 +733,9 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch // No links exist, so treat as normal mmd_export_token_tree_odf(out, source, t->child, scratch); break; + case PAIR_BRACES: + mmd_export_token_tree_odf(out, source, t->child, scratch); + break; case PAIR_PAREN: case PAIR_QUOTE_DOUBLE: case PAIR_QUOTE_SINGLE: @@ -718,6 +749,9 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch case PAREN_RIGHT: print_char(')'); break; + case PIPE: + print_token(t); + break; case QUOTE_SINGLE: if ((t->mate == NULL) || (!(scratch->extensions & EXT_SMART))) print_const("'"); @@ -846,6 +880,9 @@ void mmd_export_token_odf_raw(DString * out, const char * source, token * t, scr print_const("\\"); mmd_print_char_odf(out, source[t->start + 1]); break; + case INDENT_TAB: + print_const(""); + break; case QUOTE_DOUBLE: print_const("""); break; diff --git a/tests/MMD6Tests/Blockquotes.fodt b/tests/MMD6Tests/Blockquotes.fodt index 76142b9..6340496 100644 --- a/tests/MMD6Tests/Blockquotes.fodt +++ b/tests/MMD6Tests/Blockquotes.fodt @@ -272,7 +272,7 @@ foo bar foo - barfoo +barfoo bar diff --git a/tests/MMD6Tests/HTML Blocks.fodt b/tests/MMD6Tests/HTML Blocks.fodt new file mode 100644 index 0000000..7ac1ca7 --- /dev/null +++ b/tests/MMD6Tests/HTML Blocks.fodt @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +bar1 + +foo + +bar3 + + +bar5 + +5 + +foo + +bar5 + +10 + +foo2 + +foo + +comment –> + +15 + +foo3 + +foo5 + +20 + + + diff --git a/tests/MMD6Tests/HTML Inline.fodt b/tests/MMD6Tests/HTML Inline.fodt new file mode 100644 index 0000000..5f512e3 --- /dev/null +++ b/tests/MMD6Tests/HTML Inline.fodt @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +bar + +bar + +<div> foo</div> + +test. Comment + +test. Comment +with +multiple +line. + + + diff --git a/tests/MMD6Tests/Headers.fodt b/tests/MMD6Tests/Headers.fodt new file mode 100644 index 0000000..97f2c01 --- /dev/null +++ b/tests/MMD6Tests/Headers.fodt @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +foo + +foo + +foo + +foo + +# foo # + +5 + +#foo# + +#foo # + +foo # bar + +# foo # + +foo + +10 + +foo + +foo + +foo + +foo + +####### foo ####### + +15 + + + diff --git a/tests/MMD6Tests/Horizontal Rules.fodt b/tests/MMD6Tests/Horizontal Rules.fodt new file mode 100644 index 0000000..0d0cbb1 --- /dev/null +++ b/tests/MMD6Tests/Horizontal Rules.fodt @@ -0,0 +1,336 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +Dashes: + + + + + + + + + +--- + +5 + + + + + + + + + +- - - + +10 + +Asterisks: + + + + + + + + + +*** + +15 + + + + + + + + + +* * * + +20 + +Underscores: + + + + + + + + + +___ + +25 + + + + + + + + + +_ _ _ + +30 + + + diff --git a/tests/MMD6Tests/Indented Code Blocks.fodt b/tests/MMD6Tests/Indented Code Blocks.fodt new file mode 100644 index 0000000..90c4bf7 --- /dev/null +++ b/tests/MMD6Tests/Indented Code Blocks.fodt @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +foo + +foo + +bar + +foo + + foo + +5 + +foo + +foo + +bar + +foo + +bar + +10 + +foo + +barbar + +foo + +bar + +15 + +foo +bar +bar + +foo + +bar + +foo + +barbarbar + +foo + +-<>--&\&---... + + + diff --git a/tests/MMD6Tests/Inline Images.fodt b/tests/MMD6Tests/Inline Images.fodt new file mode 100644 index 0000000..669424c --- /dev/null +++ b/tests/MMD6Tests/Inline Images.fodt @@ -0,0 +1,352 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +Just a + + + + +. + + + + + + +. + + + + + + +. + + + + + + +. + + + + + + +. + +5 + +Empty. + + + + + + +. + + + + + + +. + + + + + + +. + + + + + + +. + +10 + + + + + + +. + + + + + + +. + + + diff --git a/tests/MMD6Tests/Linebreaks.fodt b/tests/MMD6Tests/Linebreaks.fodt new file mode 100644 index 0000000..e1c12a1 --- /dev/null +++ b/tests/MMD6Tests/Linebreaks.fodt @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +foo +bar + +foo +bar + +foo +bar + +foo +bar + +foo +bar + +5 + +foo +bar + + + diff --git a/tests/MMD6Tests/Reference Images.fodt b/tests/MMD6Tests/Reference Images.fodt new file mode 100644 index 0000000..ec4dfd3 --- /dev/null +++ b/tests/MMD6Tests/Reference Images.fodt @@ -0,0 +1,324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +Test + + + + +. + +Test + + + + +. + +Test + + + + +. + +Test + + + + +. + +Test + + + + +. + +5 + +Test + + + + +. + +Test + + + + +. + +Test + + + + +. + + + diff --git a/tests/MMD6Tests/Setext Headers.fodt b/tests/MMD6Tests/Setext Headers.fodt new file mode 100644 index 0000000..110fba9 --- /dev/null +++ b/tests/MMD6Tests/Setext Headers.fodt @@ -0,0 +1,284 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +foo bar + +foo bar + +foo +bar + +foo +bar + +foo + +bar + +5 + +foo + +bar + +foo==== + + + + + + + diff --git a/tests/MMD6Tests/Smart Quotes.fodt b/tests/MMD6Tests/Smart Quotes.fodt new file mode 100644 index 0000000..9495eb3 --- /dev/null +++ b/tests/MMD6Tests/Smart Quotes.fodt @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +‘foo’ + +“foo” + +“foo” ‘bar’ + +‘foo’ “bar” + +‘.foo’ + +5 + +"foo". + +'foo'. + +`foo' + +“foo” + +```foo''' + +10 + +“” foo “”? + +'' foo ''? + +isn’t + +foo – bar + +foo — bar + +15 + +1–2 + +1–2 + +1—3 + +-- + +--- + +20 + + + + + +... + +. . . + +l’année l’année + +25 + +l’été l’année + +l’été l’été + +l’année l’été + +foo’s and bar’s + +foo’s and bar’s + + + diff --git a/tests/MMD6Tests/Special Characters.fodt b/tests/MMD6Tests/Special Characters.fodt new file mode 100644 index 0000000..66c8f3e --- /dev/null +++ b/tests/MMD6Tests/Special Characters.fodt @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +{foo} + +[foo] + +{{foo}} + +[[foo]] + +(foo) + +5 + +|foo| + +\foo + + + diff --git a/tests/MMD6Tests/Superscript.fodt b/tests/MMD6Tests/Superscript.fodt new file mode 100644 index 0000000..9b59f7d --- /dev/null +++ b/tests/MMD6Tests/Superscript.fodt @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +x2. + +x2xz. + +x2. + +x2 3^ + +x2 32 + +5 + +xz. + +xxyz. + +zz. + +~/Library/MultiMarkdown + +^test + +10 + +x^y + +x~y + + + diff --git a/tests/MMD6Tests/Transclusion.fodt b/tests/MMD6Tests/Transclusion.fodt new file mode 100644 index 0000000..d96c1f0 --- /dev/null +++ b/tests/MMD6Tests/Transclusion.fodt @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +This text is included in foo.txt. + +This should not be transcluded to avoid an infinite loop – {{foo.txt}} + +This text is included in bar.txt. + +This can be transcluded without causing an infinite loop – {{foo.txt}} + +This is a file with no metadata. + +This is a file with no metadata. + +{{transclusion/bat.*}} + + +