Skip to content

Commit

Permalink
get OPML mostly working
Browse files Browse the repository at this point in the history
  • Loading branch information
fletcher committed Feb 23, 2011
1 parent c17bcac commit aeb7a8a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion markdown_output.c
Expand Up @@ -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:
Expand Down
33 changes: 18 additions & 15 deletions markdown_parser.leg
Expand Up @@ -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"
Expand Down
3 changes: 0 additions & 3 deletions parsing_functions.c
Expand Up @@ -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;
Expand Down

0 comments on commit aeb7a8a

Please sign in to comment.