git.iko.soy/typeable/pandoc
on master help sign in
Allow `&` in emails (for entities).

Added tests for entities in titles and links. Closes #723.

commitcc410a71b58de1fa0e508a092b7c1d8ba6d3d3ab authorJohn MacFarlane <fiddlosopher@gmail.com> dateFri 15 Feb 2013, 22:56 (14 years ago) parent59764fa
4 files changed+19−3
src/Text/Pandoc/Parsing.hs+1−1 src/Text/Pandoc/Readers/Markdown.hs+1−1 tests/markdown-reader-more.native+6−1 tests/markdown-reader-more.txt+11
src/Text/Pandoc/Parsing.hs+1−1
@@ -380,7 +380,7 @@ emailAddress = try $ liftA2 toResult mailbox (char '@' *> domain)
380380 notFollowedBy space)
381381 emailWord = many1 $ satisfy isEmailChar
382382 isEmailChar c = isAlphaNum c || isEmailPunct c
383− isEmailPunct c = c `elem` "!\"#$%&'*+-/=?^_{|}~"
383+ isEmailPunct c = c `elem` "!\"#$%&'*+-/=?^_{|}~;"
384384 -- note: sepBy1 from parsec consumes input when sep
385385 -- succeeds and p fails, so we use this variant here.
386386 sepby1 p sep = liftA2 (:) p (many (try $ sep >> p))
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -264,7 +264,7 @@ referenceKey = try $ do
264264 optional $ newline >> notFollowedBy blankline
265265 skipMany spaceChar
266266 notFollowedBy' (() <$ reference)
267− many1 $ escapedChar' <|> satisfy (not . isBlank)
267+ many1 $ notFollowedBy space >> litChar
268268 let betweenAngles = try $ char '<' >>
269269 manyTill (escapedChar' <|> litChar) (char '>')
270270 src <- try betweenAngles <|> sourceURL
tests/markdown-reader-more.native+6−1
@@ -124,4 +124,9 @@
124124 [[]
125125 ,[]]
126126 [[[]
127− ,[]]]]
127+ ,[]]]
128+,Header 2 ("entities-in-links-and-titles",[],[]) [Str "Entities",Space,Str "in",Space,Str "links",Space,Str "and",Space,Str "titles"]
129+,Para [Link [Str "link"] ("/\252rl","\246\246!")]
130+,Para [Link [Str "http://g\246\246gle.com"] ("http://g\246\246gle.com","")]
131+,Para [Link [Str "me@ex\228mple.com"] ("mailto:me@ex\228mple.com","")]
132+,Para [Link [Str "foobar"] ("/\252rl","\246\246!")]]
tests/markdown-reader-more.txt+11
@@ -208,3 +208,14 @@ Empty cells
208208| | |
209209+---+---+
210210
211+## Entities in links and titles
212+
213+[link](/&uuml;rl "&ouml;&ouml;!")
214+
215+<http://g&ouml;&ouml;gle.com>
216+
217+<me@ex&auml;mple.com>
218+
219+[foobar]
220+
221+[foobar]: /&uuml;rl "&ouml;&ouml;!"