git.iko.soy/typeable/pandoc
on master help sign in
Parsing: Further improvements to uri parser.

Don't treat punctuation before percent-encoding as final punctuation. Don't treat '+' as final punctuation.

commitee0fc19bc54208c5d8828eab872e3bbe303c47bf authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 28 Mar 2013, 11:33 (14 years ago) parente81b87c
1 file changed+4−2
src/Text/Pandoc/Parsing.hs+4−2
src/Text/Pandoc/Parsing.hs+4−2
@@ -425,7 +425,8 @@ uri = try $ do
425425 -- http://en.wikipedia.org/wiki/State_of_emergency_(disambiguation)
426426 -- as a URL, while NOT picking up the closing paren in
427427 -- (http://wikipedia.org). So we include balanced parens in the URL.
428− let isWordChar c = isAlphaNum c || c == '_' || c == '/' || not (isAscii c)
428+ let isWordChar c = isAlphaNum c || c == '_' || c == '/' || c == '+' ||
429+ not (isAscii c)
429430 let wordChar = satisfy isWordChar
430431 let percentEscaped = try $ char '%' >> skipMany1 (satisfy isHexDigit)
431432 let entity = () <$ characterReference
@@ -434,7 +435,8 @@ uri = try $ do
434435 let uriChunk = skipMany1 wordChar
435436 <|> percentEscaped
436437 <|> entity
437− <|> (try $ punct >> lookAhead (satisfy isWordChar) >> return ())
438+ <|> (try $ punct >>
439+ lookAhead (void (satisfy isWordChar) <|> percentEscaped))
438440 str <- snd `fmap` withRaw (skipMany1 ( () <$
439441 (enclosed (char '(') (char ')') uriChunk
440442 <|> enclosed (char '{') (char '}') uriChunk