Fixed regression in charsInBalancedBrackets.

Introduced by e9d7504.

This regression caused link and image references containing
raw tex not to parse correctly.

Added test.

Closes #2150.
This commit is contained in:
John MacFarlane 2015-05-13 09:50:16 -07:00
parent 70df1b572b
commit c9cb313a47
3 changed files with 8 additions and 1 deletions

View file

@ -177,9 +177,10 @@ charsInBalancedBrackets openBrackets =
(char '[' >> charsInBalancedBrackets (openBrackets + 1))
<|> (char ']' >> charsInBalancedBrackets (openBrackets - 1))
<|> (( (() <$ code)
<|> (() <$ escapedChar')
<|> (() <$ (escapedChar'))
<|> (newline >> notFollowedBy blankline)
<|> skipMany1 (noneOf "[]`\n\\")
<|> (() <$ count 1 (oneOf "`\\"))
) >> charsInBalancedBrackets openBrackets)
--

View file

@ -150,6 +150,8 @@
,Para [Link [Str "link"] ("/hi(there)","")]
,Para [Link [Str "link"] ("/hithere)","")]
,Para [Link [Str "linky"] ("hi_(there_(nested))","")]
,Header 2 ("backslashes-in-link-references",[],[]) [Str "Backslashes",Space,Str "in",Space,Str "link",Space,Str "references"]
,Para [Link [Str "*",RawInline (Format "tex") "\\a"] ("b","")]
,Header 2 ("reference-link-fallbacks",[],[]) [Str "Reference",Space,Str "link",Space,Str "fallbacks"]
,Para [Str "[",Emph [Str "not",Space,Str "a",Space,Str "link"],Str "]",Space,Str "[",Emph [Str "nope"],Str "]\8230"]
,Header 2 ("reference-link-followed-by-a-citation",[],[]) [Str "Reference",Space,Str "link",Space,Str "followed",Space,Str "by",Space,Str "a",Space,Str "citation"]

View file

@ -258,6 +258,10 @@ Empty cells
[linky]: hi_(there_(nested))
## Backslashes in link references
[\*\a](b)
## Reference link fallbacks
[*not a link*] [*nope*]...