From: Fletcher T. Penney Date: Fri, 16 Feb 2018 05:55:24 +0000 (-0500) Subject: FIXED: Fix issue with trailing ATX hash without final newline X-Git-Tag: 6.3.1^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fcc49766faf5630f287faa122be85f80e5c2f720;p=multimarkdown FIXED: Fix issue with trailing ATX hash without final newline --- diff --git a/Sources/libMultiMarkdown/lexer.c b/Sources/libMultiMarkdown/lexer.c index 3d62918..6d62362 100644 --- a/Sources/libMultiMarkdown/lexer.c +++ b/Sources/libMultiMarkdown/lexer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.14.3 on Sun Jul 23 17:28:33 2017 */ +/* Generated by re2c 0.14.3 on Fri Feb 16 00:41:29 2018 */ /** MultiMarkdown 6 -- Lightweight markup processor to produce HTML, LaTeX, and more. @@ -643,6 +643,7 @@ yy53: yyaccept = 8; yych = *(YYMARKER = ++YYCURSOR); switch (yych) { + case 0x00: case '\t': case '\n': case '\r': @@ -1088,6 +1089,7 @@ yy86: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { + case 0x00: case '\t': case '\n': case '\r': @@ -1102,9 +1104,10 @@ yy87: yych = *YYCURSOR; yy88: switch (yych) { + case 0x00: + case '\n': goto yy91; case '\t': case ' ': goto yy87; - case '\n': goto yy91; case '\r': goto yy93; case 0xC2: goto yy90; default: goto yy89; @@ -1135,9 +1138,10 @@ yy94: yych = *YYCURSOR; yy95: switch (yych) { + case 0x00: + case '\n': goto yy98; case '\t': case ' ': goto yy94; - case '\n': goto yy98; case '\r': goto yy100; case 0xC2: goto yy97; default: goto yy96; @@ -1166,6 +1170,7 @@ yy101: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { + case 0x00: case '\t': case '\n': case '\r': @@ -1178,6 +1183,7 @@ yy102: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { + case 0x00: case '\t': case '\n': case '\r': @@ -1192,9 +1198,10 @@ yy103: yych = *YYCURSOR; yy104: switch (yych) { + case 0x00: + case '\n': goto yy107; case '\t': case ' ': goto yy103; - case '\n': goto yy107; case '\r': goto yy109; case 0xC2: goto yy106; default: goto yy105; @@ -1225,9 +1232,10 @@ yy110: yych = *YYCURSOR; yy111: switch (yych) { + case 0x00: + case '\n': goto yy114; case '\t': case ' ': goto yy110; - case '\n': goto yy114; case '\r': goto yy116; case 0xC2: goto yy113; default: goto yy112; @@ -1256,6 +1264,7 @@ yy117: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { + case 0x00: case '\t': case '\n': case '\r': @@ -1268,6 +1277,7 @@ yy118: YYCTXMARKER = YYCURSOR + 1; yych = *++YYCURSOR; switch (yych) { + case 0x00: case '\t': case '\n': case '\r': @@ -1281,9 +1291,10 @@ yy119: yych = *YYCURSOR; yy120: switch (yych) { + case 0x00: + case '\n': goto yy123; case '\t': case ' ': goto yy119; - case '\n': goto yy123; case '\r': goto yy125; case 0xC2: goto yy122; default: goto yy121; @@ -1314,9 +1325,10 @@ yy126: yych = *YYCURSOR; yy127: switch (yych) { + case 0x00: + case '\n': goto yy130; case '\t': case ' ': goto yy126; - case '\n': goto yy130; case '\r': goto yy132; case 0xC2: goto yy129; default: goto yy128; diff --git a/Sources/libMultiMarkdown/lexer.re b/Sources/libMultiMarkdown/lexer.re index 291f270..fb740c6 100644 --- a/Sources/libMultiMarkdown/lexer.re +++ b/Sources/libMultiMarkdown/lexer.re @@ -81,8 +81,9 @@ int scan(Scanner * s, const char * stop) { NL = "\r\n" | '\n' | '\r'; WS = [ \t\240]; // Whitespace from char_lookup.c SP = WS+; + EOF = '\x00'; - SPNL = WS* NL; + SPNL = WS* ( NL | EOF); INDENT_TAB = '\t'; INDENT_SPACE = [ \240]{4}; diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index ece12f1..cf28f6b 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -519,7 +519,7 @@ void mmd_assign_line_type(mmd_engine * e, token * line) { } else { if ((line->child->tail->type >= HASH1) && (line->child->tail->type <= HASH6)) { - line->child->tail->type -= TEXT_EMPTY; + line->child->tail->type -= HASH1; line->child->tail->type += MARKER_H1; } } diff --git a/tests/MMD6Tests/Headers.fodt b/tests/MMD6Tests/Headers.fodt index 85c10e1..cc329da 100644 --- a/tests/MMD6Tests/Headers.fodt +++ b/tests/MMD6Tests/Headers.fodt @@ -313,6 +313,8 @@ office:mimetype="application/vnd.oasis.opendocument.text"> ####### foo ####### 15 + +foo diff --git a/tests/MMD6Tests/Headers.html b/tests/MMD6Tests/Headers.html index 7a9a8ca..c2ae635 100644 --- a/tests/MMD6Tests/Headers.html +++ b/tests/MMD6Tests/Headers.html @@ -43,6 +43,8 @@

15

+
foo
+ diff --git a/tests/MMD6Tests/Headers.htmlc b/tests/MMD6Tests/Headers.htmlc index 5a6177d..6959dfa 100644 --- a/tests/MMD6Tests/Headers.htmlc +++ b/tests/MMD6Tests/Headers.htmlc @@ -37,3 +37,5 @@ latex config: article

####### foo #######

15

+ +
foo
diff --git a/tests/MMD6Tests/Headers.tex b/tests/MMD6Tests/Headers.tex index b1bc510..3b192fd 100644 --- a/tests/MMD6Tests/Headers.tex +++ b/tests/MMD6Tests/Headers.tex @@ -50,5 +50,8 @@ 15 +\paragraph{foo } +\label{foo} + \input{mmd6-article-footer} \end{document} diff --git a/tests/MMD6Tests/Headers.text b/tests/MMD6Tests/Headers.text index b43634b..0fe752c 100644 --- a/tests/MMD6Tests/Headers.text +++ b/tests/MMD6Tests/Headers.text @@ -36,3 +36,5 @@ latex config: article ####### foo ####### 15 + +###### foo ###### \ No newline at end of file