Permalink
Browse files

Require newline after Reference.

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...
1 parent a3b97b3 commit fff88fe14ebf216a9c59f4516c429c8fe8a58b36 @jgm committed Mar 22, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 markdown_parser.leg
View
@@ -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);
@@ -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 )*

0 comments on commit fff88fe

Please sign in to comment.