Skip to content

Commit

Permalink
Require newline after Reference.
Browse files Browse the repository at this point in the history
Fletcher Penney pointed out the following bug in the previous
version:

![][figure]

[figure]: fig.png "caption" width=75%

is correctly *NOT* interpreted as a reference by most implementations
due to the extraneous width attribute.  Peg-markdown, however, strips
the fig.png part, and leaves the "caption" and width as leftover text
in the following paragraph:

<p><img src="fig.png" alt="" /></p>

<p>&quot;caption&quot; width=75%</p>
  • Loading branch information
jgm committed Mar 22, 2011
1 parent a3b97b3 commit fff88fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions markdown_parser.leg
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ AutoLinkEmail = '<' < [-A-Za-z0-9+_]+ '@' ( !Newline !'>' . )+ > '>'
free(mailto);
}

Reference = NonindentSpace !"[]" l:Label ':' Spnl s:RefSrc Spnl t:RefTitle BlankLine*
Reference = NonindentSpace !"[]" l:Label ':' Spnl s:RefSrc t:RefTitle BlankLine+
{ $$ = mk_link(l->children, s->contents.str, t->contents.str);
free_element(s);
free_element(t);
Expand All @@ -570,11 +570,11 @@ RefTitle = ( RefTitleSingle | RefTitleDouble | RefTitleParens | EmptyTitle )

EmptyTitle = < "" >

RefTitleSingle = '\'' < ( !( '\'' Sp Newline | Newline ) . )* > '\''
RefTitleSingle = Spnl '\'' < ( !( '\'' Sp Newline | Newline ) . )* > '\''

RefTitleDouble = '"' < ( !('"' Sp Newline | Newline) . )* > '"'
RefTitleDouble = Spnl '"' < ( !('"' Sp Newline | Newline) . )* > '"'

RefTitleParens = '(' < ( !(')' Sp Newline | Newline) . )* > ')'
RefTitleParens = Spnl '(' < ( !(')' Sp Newline | Newline) . )* > ')'

References = a:StartList
( b:Reference { a = cons(b, a); } | SkipBlock )*
Expand Down

0 comments on commit fff88fe

Please sign in to comment.