Skip to content
Browse files

get OPML mostly working

  • Loading branch information...
1 parent c17bcac commit aeb7a8a6f6f9e17215a76aae7429460d68b886ac @fletcher committed
Showing with 19 additions and 19 deletions.
  1. +1 −1 markdown_output.c
  2. +18 −15 markdown_parser.leg
  3. +0 −3 parsing_functions.c
View
2 markdown_output.c
@@ -1900,7 +1900,7 @@ static void print_opml_element(GString *out, element *elt) {
case PLAIN:
print_opml_element_list(out,elt->children);
if ((elt->next != NULL) && (elt->next->key == PLAIN)) {
- g_string_append_printf(out, "

");
+ g_string_append_printf(out, "
");
}
break;
default:
View
33 markdown_parser.leg
@@ -1129,33 +1129,36 @@ MathSpan = '\\' < (
DocForOPML = a:StartList b:StartList
- ( &{ !extension(EXT_COMPATIBILITY) }
- &( MetaDataKey Sp ':' Sp (!Newline)) MetaData
- { a = cons($$, a); b = mk_element(FOOTER);})?
+ ( &( MetaDataKey Sp ':' Sp (!Newline)) MetaData
+ { a = cons($$, a); })?
( OPMLBlock { a = cons($$, a); } )*
- { if (b != NULL) a = cons(b, a);
- parse_result = reverse(a);
- }
+ { parse_result = reverse(a); }
OPMLBlock = BlankLine*
( OPMLHeadingSection
- | Plain )
+ | OPMLPlain )
-OPMLHeadingSection = a:StartList Heading { a = cons($$, a); }
+OPMLHeadingSection = a:StartList OPMLHeading { a = cons($$, a); }
(OPMLSectionBlock {a = cons($$, a); })*
{ $$ = mk_list(HEADINGSECTION, a);}
-OPMLSectionBlock =
- BlankLine*
- !Heading
- Plain
-
-OPMLPlain = < Plain >
+OPMLHeading = &(Heading) s:AtxStart Sp?
+ < (!Newline !(Sp? '#'* Sp Newline) .)* >
+ (Sp? '#'+)? Sp? Newline
{
$$ = mk_str(yytext);
- $$->key = PLAIN;
+ $$->key = s->key;
+ free(s);
}
+OPMLSectionBlock =
+ BlankLine*
+ !OPMLHeading
+ OPMLPlain
+
+OPMLPlain = a:StartList (!BlankLine Line { a = cons($$,a); })+
+ { $$ = mk_list(PLAIN, a); }
+
%%
#include "parsing_functions.c"
View
3 parsing_functions.c
@@ -170,9 +170,6 @@ element * parse_markdown_for_opml(char *string, int extensions) {
char *oldcharbuf;
syntax_extensions = extensions;
- references = NULL;
- notes = NULL;
- labels = NULL;
oldcharbuf = charbuf;
charbuf = string;

0 comments on commit aeb7a8a

Please sign in to comment.
Something went wrong with that request. Please try again.