aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-03-28 09:54:02 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-03-28 09:54:02 -0700
commit099b4b776985e23bffb06b3dca3a697d3fde2a41 (patch)
treec2e3b3c780c286e04147b1b435dd4e629561a8a5
parent351b3e09c3a7b03240aab530a33b3126f80ffd48 (diff)
downloadpandoc-099b4b776985e23bffb06b3dca3a697d3fde2a41.tar.gz
Mediawiki: Fixed regression for `<ref>URL</ref>`.
`<` is no longer allowed in URLs, according to the uri parser in Text.Pandoc.Parsing. Added a test case.
-rw-r--r--src/Text/Pandoc/Parsing.hs2
-rw-r--r--tests/mediawiki-reader.native3
-rw-r--r--tests/mediawiki-reader.wiki1
3 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index 44a64c80a..31f3d2525 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -430,7 +430,7 @@ uri = try $ do
let percentEscaped = try $ char '%' >> skipMany1 (satisfy isHexDigit)
let entity = () <$ characterReference
let punct = skipMany1 (char ',')
- <|> () <$ (satisfy (not . isSpace))
+ <|> () <$ (satisfy (\c -> not (isSpace c) && c /= '<'))
let uriChunk = skipMany1 wordChar
<|> percentEscaped
<|> entity
diff --git a/tests/mediawiki-reader.native b/tests/mediawiki-reader.native
index 2527c7851..3de4df068 100644
--- a/tests/mediawiki-reader.native
+++ b/tests/mediawiki-reader.native
@@ -242,4 +242,5 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
[[[Para [Str "Orange"]]]]
,Para [Str "Paragraph",Space,Str "after",Space,Str "the",Space,Str "table."]
,Header 2 ("",[],[]) [Str "notes"]
-,Para [Str "My",Space,Str "note!",Note [Plain [Str "This."]]]]
+,Para [Str "My",Space,Str "note!",Note [Plain [Str "This."]]]
+,Para [Str "URL",Space,Str "note.",Note [Plain [Link [Str "http://docs.python.org/library/functions.html#range"] ("http://docs.python.org/library/functions.html#range","")]]]]
diff --git a/tests/mediawiki-reader.wiki b/tests/mediawiki-reader.wiki
index e373c332e..128e74a14 100644
--- a/tests/mediawiki-reader.wiki
+++ b/tests/mediawiki-reader.wiki
@@ -370,3 +370,4 @@ and cheese
My note!<ref>This.</ref>
+URL note.<ref>http://docs.python.org/library/functions.html#range</ref>