-/* Generated by re2c 1.0.3 on Mon Aug 6 17:50:40 2018 */
+/* Generated by re2c 1.0.3 on Tue Aug 7 19:20:45 2018 */
/**
MultiMarkdown -- Lightweight markup processor to produce HTML, LaTeX, and more.
}
}
+
+
+/// Does the string include encoded newline?
+size_t scan_encoded_newline(const char * c, size_t len) {
+ const char * marker = NULL;
+ const char * start = c;
+
+scan:
+
+ if ((*c == '\0') || ((c - start) > len)) {
+ // Not found
+ return -1;
+ }
+
+
+ {
+ unsigned char yych;
+ yych = *c;
+
+ switch (yych) {
+ case '\n':
+ goto yy210;
+
+ case '&':
+ goto yy213;
+
+ default:
+ goto yy211;
+ }
+
+yy210:
+ c = marker;
+ goto yy212;
+yy211:
+ ++c;
+yy212: {
+ goto scan;
+ }
+yy213:
+ yych = *(marker = ++c);
+
+ switch (yych) {
+ case '#':
+ goto yy214;
+
+ default:
+ goto yy212;
+ }
+
+yy214:
+ yych = *++c;
+
+ switch (yych) {
+ case '1':
+ goto yy215;
+
+ default:
+ goto yy210;
+ }
+
+yy215:
+ yych = *++c;
+
+ switch (yych) {
+ case '0':
+ case '3':
+ goto yy216;
+
+ default:
+ goto yy210;
+ }
+
+yy216:
+ yych = *++c;
+
+ switch (yych) {
+ case ';':
+ goto yy217;
+
+ default:
+ goto yy210;
+ }
+
+yy217:
+ ++c;
+ {
+ return (size_t)(c - start);
+ }
+ }
+
+}
/// find end of double quoted value
size_t scan_double_quoted(const char * c);
+/// Does the string include encoded newline?
+size_t scan_encoded_newline(const char * c, size_t len);
+
+
#endif
text_attribute = WSNL* 'text' WSNL* EQUAL WSNL*;
note_attribute = WSNL* '_note' WSNL* EQUAL WSNL*;
+ contains_newline = " " | " ";
+
'<?xml' [^>\x00]* '>' { return OPML_XML; }
'<opml' [^>\x00]* '>' { return OPML_OPML_OPEN; }
const char * start = c;
/*!re2c
- text_attribute / double_quoted { return (size_t)( c - start ); }
+ text_attribute / double_quoted { return (size_t)( c - start ); }
.? { return 0; }
*/
}
const char * start = c;
/*!re2c
- note_attribute / double_quoted { return (size_t)( c - start ); }
+ note_attribute / double_quoted { return (size_t)( c - start ); }
.? { return 0; }
*/
}
.? { return 0; }
*/
}
+
+
+/// Does the string include encoded newline?
+size_t scan_encoded_newline(const char * c, size_t len) {
+ const char * marker = NULL;
+ const char * start = c;
+
+ scan:
+
+ if ((*c == '\0') || ((c - start) > len)) {
+ // Not found
+ return -1;
+ }
+
+/*!re2c
+ contains_newline { return (size_t)(c - start); }
+ . { goto scan; }
+*/
+}
print_const(":\t");
} else {
// Print header
- for (int i = 0; i < header_level; ++i) {
- print_char('#');
- }
+ if (scan_encoded_newline(&(e->dstr->str[start + 1]), len - 2) == -1) {
+ // ATX header
+ for (int i = 0; i < header_level; ++i) {
+ print_char('#');
+ }
- print_char(' ');
+ print_char(' ');
+ }
print_opml_text(out, e->dstr->str, start + 1, len - 2);
- print_char(' ');
-
- for (int i = 0; i < header_level; ++i) {
- print_char('#');
+ if (scan_encoded_newline(&(e->dstr->str[start + 1]), len - 2) == -1) {
+ // ATX header
+ print_char(' ');
+
+ for (int i = 0; i < header_level; ++i) {
+ print_char('#');
+ }
+ } else {
+ // Print Setext Header
+ switch (header_level) {
+ case 1:
+ print_const("\n======");
+ break;
+
+ default:
+ print_const("\n------");
+ break;
+ }
}
print_const("\n");