Text.Pandoc.Parsing.uri: allow &
and =
as word characters.
This fixes a bug where pandoc would stop parsing a URI with an empty attribute: for example, `&a=&b=` wolud stop at `a`. (The uri parser tries to guess which punctuation characters are part of the URI and which might be punctuation after it.) Closes #4068.
This commit is contained in:
parent
22d69c8916
commit
508aab0bd5
2 changed files with 10 additions and 1 deletions
|
@ -563,7 +563,7 @@ uri = try $ do
|
|||
-- http://en.wikipedia.org/wiki/State_of_emergency_(disambiguation)
|
||||
-- as a URL, while NOT picking up the closing paren in
|
||||
-- (http://wikipedia.org). So we include balanced parens in the URL.
|
||||
let isWordChar c = isAlphaNum c || c `elem` "#$%*+/@\\_-"
|
||||
let isWordChar c = isAlphaNum c || c `elem` "#$%*+/@\\_-&="
|
||||
let wordChar = satisfy isWordChar
|
||||
let percentEscaped = try $ char '%' >> skipMany1 (satisfy isHexDigit)
|
||||
let entity = () <$ characterReference
|
||||
|
|
9
test/command/4068.md
Normal file
9
test/command/4068.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
```
|
||||
pandoc -f mediawiki -t native
|
||||
[https://domain.com/script.php?a=1&b=2&c=&d=4 open productname bugs]
|
||||
|
||||
[http://domain.com?a=. open productname bugs]
|
||||
^D
|
||||
[Para [Link ("",[],[]) [Str "open",Space,Str "productname",Space,Str "bugs"] ("https://domain.com/script.php?a=1&b=2&c=&d=4","")]
|
||||
,Para [Str "[",Link ("",[],[]) [Str "http://domain.com?a="] ("http://domain.com?a=",""),Str ".",Space,Str "open",Space,Str "productname",Space,Str "bugs]"]]
|
||||
```
|
Loading…
Add table
Reference in a new issue