case HASH4:
case HASH5:
case HASH6:
- line->type = (line->child->type - HASH1) + LINE_ATX_1;
- line->child->type = (line->type - LINE_ATX_1) + MARKER_H1;
-
- // Strip trailing whitespace from '#' sequence
- line->child->len = line->child->type - MARKER_H1 + 1;
-
- // Strip trailing '#' sequence if present
- if (line->child->tail->type == TEXT_NL) {
- if ((line->child->tail->prev->type >= HASH1) &&
- (line->child->tail->prev->type <= HASH6))
- line->child->tail->prev->type = TEXT_EMPTY;
+ if (scan_atx(&source[line->child->start])) {
+ line->type = (line->child->type - HASH1) + LINE_ATX_1;
+ line->child->type = (line->type - LINE_ATX_1) + MARKER_H1;
+
+ // Strip trailing whitespace from '#' sequence
+ line->child->len = line->child->type - MARKER_H1 + 1;
+
+ // Strip trailing '#' sequence if present
+ if (line->child->tail->type == TEXT_NL) {
+ if ((line->child->tail->prev->type >= HASH1) &&
+ (line->child->tail->prev->type <= HASH6))
+ line->child->tail->prev->type = TEXT_EMPTY;
+ } else {
+ token_describe(line->child->tail, NULL);
+ if ((line->child->tail->type >= HASH1) &&
+ (line->child->tail->type <= HASH6))
+ line->child->tail->type = TEXT_EMPTY;
+ }
} else {
- token_describe(line->child->tail, NULL);
- if ((line->child->tail->type >= HASH1) &&
- (line->child->tail->type <= HASH6))
- line->child->tail->type = TEXT_EMPTY;
+ line->type = LINE_PLAIN;
}
break;
case TEXT_NUMBER_POSS_LIST:
-/* Generated by re2c 0.14.3 on Tue Mar 14 12:15:24 2017 */
+/* Generated by re2c 0.14.3 on Tue Mar 14 20:07:08 2017 */
/**
MultiMarkdown 6 -- Lightweight markup processor to produce HTML, LaTeX, and more.
}
+size_t scan_atx(const char * c) {
+ const char * marker = NULL;
+ const char * start = c;
+
+
+{
+ char yych;
+ yych = *c;
+ switch (yych) {
+ case '\n': goto yy827;
+ case '#': goto yy828;
+ default: goto yy829;
+ }
+yy827:
+ { return 0; }
+yy828:
+ yych = *(marker = ++c);
+ switch (yych) {
+ case '\t':
+ case ' ': goto yy830;
+ case '#': goto yy833;
+ default: goto yy827;
+ }
+yy829:
+ yych = *++c;
+ goto yy827;
+yy830:
+ ++c;
+ yych = *c;
+ switch (yych) {
+ case 0x00:
+ case '\n':
+ case '\r': goto yy832;
+ case '\t':
+ case ' ': goto yy830;
+ default: goto yy835;
+ }
+yy832:
+ c = marker;
+ goto yy827;
+yy833:
+ ++c;
+ yych = *c;
+ switch (yych) {
+ case '\t':
+ case ' ': goto yy830;
+ case '#': goto yy833;
+ default: goto yy832;
+ }
+yy835:
+ ++c;
+ { return (size_t)( c - start ); }
+}
+
+}
+
#ifdef TEST
void Test_scan_url(CuTest* tc) {
size_t scan_alignment_string(const char * c);
size_t scan_attr(const char * c);
size_t scan_attributes(const char * c);
+size_t scan_atx(const char * c);
size_t scan_definition(const char * c);
size_t scan_destination(const char * c);
size_t scan_email(const char * c);
setext_2 = non_indent '-'{2,} nl_eof;
+ atx = '#'+ [ \t]+ [^ \t\n\r\x00];
*/
*/
}
+size_t scan_atx(const char * c) {
+ const char * marker = NULL;
+ const char * start = c;
+
+/*!re2c
+ atx { return (size_t)( c - start ); }
+ .? { return 0; }
+*/
+}
+
#ifdef TEST
void Test_scan_url(CuTest* tc) {