From: Fletcher T. Penney Date: Sun, 16 Dec 2018 01:46:08 +0000 (-0500) Subject: UPDATED: Slow progress on RTF X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02cb34fe3c3eddd75d0883afdfdd0493f3fe4003;p=multimarkdown UPDATED: Slow progress on RTF --- diff --git a/Sources/libMultiMarkdown/rtf.c b/Sources/libMultiMarkdown/rtf.c index f03c7e1..281daf3 100644 --- a/Sources/libMultiMarkdown/rtf.c +++ b/Sources/libMultiMarkdown/rtf.c @@ -92,6 +92,26 @@ static char * my_strdup(const char * source) { } +void mmd_print_char_rtf(DString * out, char c, bool obfuscate, bool line_breaks) { + switch (c) { + case '\n': + case '\r': + if (line_breaks) { + print_const("\n"); + } else { + print_char(c); + } + + break; + + default: + print_char(c); + + break; + } +} + + void mmd_print_localized_char_rtf(DString * out, unsigned short type, scratch_pad * scratch) { switch (type) { case DASH_N: @@ -475,10 +495,26 @@ static void mmd_export_token_rtf(DString * out, const char * source, token * t, print_const("="); break; + case ESCAPED_CHARACTER: + print_const("\\"); + + if (t->next && t->next->type == TEXT_EMPTY && source[t->start + 1] == ' ') { + } else { + mmd_print_char_rtf(out, source[t->start + 1], false, false); + } + + break; + case NON_INDENT_SPACE: print_char(' '); break; + case PAIR_BRACE: + case PAIR_BRACES: + case PAIR_RAW_FILTER: + mmd_export_token_tree_rtf(out, source, t->child, scratch); + break; + case PAIR_EMPH: case PAIR_PAREN: case PAIR_QUOTE_DOUBLE: