From: Fletcher T. Penney Date: Fri, 3 Mar 2017 16:18:10 +0000 (-0500) Subject: ADDED: Continue ODF progress X-Git-Tag: 0.4.0-b^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2682d28c696c8bd3417c25d8a13ec4f3146169e5;p=multimarkdown ADDED: Continue ODF progress --- diff --git a/Sources/libMultiMarkdown/odf.c b/Sources/libMultiMarkdown/odf.c index f7ea55b..a418455 100644 --- a/Sources/libMultiMarkdown/odf.c +++ b/Sources/libMultiMarkdown/odf.c @@ -476,6 +476,27 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch case COLON: print_char(':'); break; + case DASH_M: + if (!(scratch->extensions & EXT_SMART)) { + print_token(t); + } else { + print_localized(DASH_M); + } + break; + case DASH_N: + if (!(scratch->extensions & EXT_SMART)) { + print_token(t); + } else { + print_localized(DASH_N); + } + break; + case ELLIPSIS: + if (!(scratch->extensions & EXT_SMART)) { + print_token(t); + } else { + print_localized(ELLIPSIS); + } + break; case EMPH_START: print_const(""); break; @@ -506,6 +527,44 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch case MARKER_LIST_BULLET: case MARKER_LIST_ENUMERATOR: break; + case MATH_BRACKET_OPEN: + if (t->mate) { + print_const("\\["); + } else + print_const("\\["); + break; + case MATH_BRACKET_CLOSE: + if (t->mate) { + print_const("\\]"); + } else + print_const("\\]"); + break; + case MATH_DOLLAR_SINGLE: + if (t->mate) { + (t->start < t->mate->start) ? ( print_const("\\(") ) : ( print_const("\\)") ); + } else { + print_const("$"); + } + break; + case MATH_DOLLAR_DOUBLE: + if (t->mate) { + (t->start < t->mate->start) ? ( print_const("\\[") ) : ( print_const("\\]") ); + } else { + print_const("$$"); + } + break; + case MATH_PAREN_OPEN: + if (t->mate) { + print_const("\\("); + } else + print_const("\\("); + break; + case MATH_PAREN_CLOSE: + if (t->mate) { + print_const("\\)"); + } else + print_const("\\)"); + break; case NON_INDENT_SPACE: print_char(' '); break; @@ -647,6 +706,28 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch case STRONG_STOP: print_const(""); break; + case SUBSCRIPT: + if (t->mate) { + (t->start < t->mate->start) ? (print_const("")) : (print_const("")); + } else if (t->len != 1) { + print_const(""); + mmd_export_token_odf(out, source, t->child, scratch); + print_const(""); + } else { + print_const("~"); + } + break; + case SUPERSCRIPT: + if (t->mate) { + (t->start < t->mate->start) ? (print_const("")) : (print_const("")); + } else if (t->len != 1) { + print_const(""); + mmd_export_token_odf(out, source, t->child, scratch); + print_const(""); + } else { + print_const("^"); + } + break; case TEXT_EMPTY: break; case TEXT_LINEBREAK: @@ -659,9 +740,16 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch if (t->next) print_char('\n'); break; + case TEXT_BACKSLASH: + case TEXT_BRACE_LEFT: + case TEXT_BRACE_RIGHT: + case TEXT_HASH: case TEXT_NUMBER_POSS_LIST: + case TEXT_PERCENT: case TEXT_PERIOD: case TEXT_PLAIN: + case TOC: + case UL: print_token(t); break; default: diff --git a/tests/MMD6Tests/Basic Lists.fodt b/tests/MMD6Tests/Cross-References.fodt similarity index 86% rename from tests/MMD6Tests/Basic Lists.fodt rename to tests/MMD6Tests/Cross-References.fodt index d6a9946..da489de 100644 --- a/tests/MMD6Tests/Basic Lists.fodt +++ b/tests/MMD6Tests/Cross-References.fodt @@ -254,110 +254,27 @@ - -foo - -foo - -foo - +A Section -bar +109&*&#()^ Can Start With Digit - -foo - - -foo - - -foo - - +Strip out &%^ characters &*^ -bar +A Section. - -foo - - -foo - - -foo - - +1 Cross-References: Special Characters!@#$%&*()<>^ 5 - -foo - -foo - -foo - +And now, link to 1 Cross-References: Special Characters!@#$%&*()<>^ -bar +Заголовок по-русски - -foo - - -foo - - -foo - - +И ссылка на Заголовок по-русски. -bar - - -foo - - -foo - - -foo - - +Test 的 Multibyte 10 - - -foo - -foo - -foo - - -bar - - -foo - -foo - -foo - - -bar - - -foo -bar - -foo -bar - -foo -bar - - -15 diff --git a/tests/MMD6Tests/Edge Cases 2.fodt b/tests/MMD6Tests/Edge Cases 2.fodt new file mode 100644 index 0000000..f9f28ba --- /dev/null +++ b/tests/MMD6Tests/Edge Cases 2.fodt @@ -0,0 +1,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t +b, u, v, w, x, y, z, t w t + + + diff --git a/tests/MMD6Tests/Edge Cases.fodt b/tests/MMD6Tests/Edge Cases.fodt new file mode 100644 index 0000000..bd4c8f2 --- /dev/null +++ b/tests/MMD6Tests/Edge Cases.fodt @@ -0,0 +1,358 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + + + +foo +bar + + + +foo + + + +bar + + + +foo + + + +bar + + + +foo + + + +bar + + + +foo + +bar + +5 + +foo + +bar + +foo +bar + +The quick brown fox jumped + +The quick brown fox jumped + +The quick brown fox jumped + +10 + +The quick brown fox jumped + +The quick brown fox jumped + +The quick brown fox jumped + +This should be parsed – fo***o + +test thisthing + +15 + +_test this_thing + +test thisthing + +__test this__thing + +test thisthing + +___test this___thing + +20 + +This is another test of italics and bold. + +This is another test of bold and italics. + +This is another test of bold and italics. + +This is another test of italics and bold. + +This is another test of italics and bold. + +25 + +This is another test of bold and italics. + +This is another test of bold and italics. + +This is another test of italics and bold. + +*a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a *a + +foo *bar foo* bar + +30 + + + diff --git a/tests/MMD6Tests/Emph and Strong Star.fodt b/tests/MMD6Tests/Emph and Strong Star.fodt new file mode 100644 index 0000000..b0cfde0 --- /dev/null +++ b/tests/MMD6Tests/Emph and Strong Star.fodt @@ -0,0 +1,454 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +foo + +*foo + +foo* + +foo bar + +foo bar + +5 + +foo bar + +foo + +foo bar + +foo bar + +foo bar + +10 + +foo bar foo + +foo bar foo + +foo bar foo + +foo bar foo + +foo bar foo + +15 + +foo bar foo + +foo bar foo + +foo bar foo + +foo bar foo + +foo + +20 + +foo bar + +foo bar + +foo bar + +foo bar + +foobar* + +25 + +foo bar foo bar + +foo bar foo bar + +foo barbar + +foo barbar + +foo barbar + +30 + +foobarfoo + +foobarfoo + +foobarfoo + +foobarfoo + +foo foobarfoo foo + +35 + +foo*bar* + +*(foo) + +foo: + +foo: + +foo: + +40 + +foo*bar + +foobar foobar + +foo**bar + +foobar foobar + +foo***bar + +45 + +foobar foobar + +foo - bar + +foo 1. bar + +foo: bar + +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +*foo +foo + + + diff --git a/tests/MMD6Tests/Emph and Strong UL.fodt b/tests/MMD6Tests/Emph and Strong UL.fodt new file mode 100644 index 0000000..bb56c4b --- /dev/null +++ b/tests/MMD6Tests/Emph and Strong UL.fodt @@ -0,0 +1,452 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + +foo + +_foo + +foo_ + +foo bar + +foo bar + +5 + +foo bar + +foo + +foo bar + +foo bar + +foo bar + +10 + +foo bar foo + +foo bar foo + +foo bar foo + +foo bar foo + +foo bar foo + +15 + +foo bar foo + +foo bar foo + +foo bar foo + +foo bar foo + +foo + +20 + +foo bar + +foo bar + +foo bar + +foo bar + +foo_bar + +25 + +foo bar foo bar + +foo bar foo bar + +_foo bar_bar + +__foo bar__bar + +___foo bar___bar + +30 + +foo_bar_foo + +foo__bar__foo + +foo___bar___foo + +foo_bar_foo + +foo foobarfoo foo + +35 + +foo___bar___ + +_(foo) + +foo: + +foo: + +foo: + +40 + +foo_bar + +foo_bar foo_bar + +foo__bar + +foo__bar foo__bar + +foo___bar + +45 + +foo___bar foo___bar + +foo __- bar__ + +foo 1. bar + +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +_foo +foo + + +