aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs6
-rw-r--r--tests/markdown-reader-more.native3
-rw-r--r--tests/markdown-reader-more.txt4
3 files changed, 9 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 26ea764be..6b7f1a8fb 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1635,8 +1635,10 @@ source :: MarkdownParser (String, String)
source = do
char '('
skipSpaces
- let urlChunk = try $ notFollowedBy (oneOf "\"')") >>
- (parenthesizedChars <|> count 1 litChar)
+ let urlChunk =
+ try parenthesizedChars
+ <|> (notFollowedBy (oneOf " )") >> (count 1 litChar))
+ <|> try (many1 spaceChar <* notFollowedBy (oneOf "\"')"))
let sourceURL = (unwords . words . concat) <$> many urlChunk
let betweenAngles = try $
char '<' >> manyTill litChar (char '>')
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index 3e171e085..30da0afbb 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -5,9 +5,10 @@
,Plain [RawInline (Format "tex") "\\placeformula "]
,RawBlock (Format "context") "\\startformula\n L_{1} = L_{2}\n \\stopformula"
,RawBlock (Format "context") "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"
-,Header 2 ("urls-with-spaces",[],[]) [Str "URLs",Space,Str "with",Space,Str "spaces"]
+,Header 2 ("urls-with-spaces-and-punctuation",[],[]) [Str "URLs",Space,Str "with",Space,Str "spaces",Space,Str "and",Space,Str "punctuation"]
,Para [Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("bar%20baz","title")]
,Para [Link [Str "baz"] ("/foo%20foo",""),Space,Link [Str "bam"] ("/foo%20fee",""),Space,Link [Str "bork"] ("/foo/zee%20zob","title")]
+,Para [Link [Str "Ward\8217s",Space,Str "method."] ("http://en.wikipedia.org/wiki/Ward's_method","")]
,Header 2 ("horizontal-rules-with-spaces-at-end",[],[]) [Str "Horizontal",Space,Str "rules",Space,Str "with",Space,Str "spaces",Space,Str "at",Space,Str "end"]
,HorizontalRule
,HorizontalRule
diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt
index e1ad4f3e6..c486f8885 100644
--- a/tests/markdown-reader-more.txt
+++ b/tests/markdown-reader-more.txt
@@ -28,7 +28,7 @@
\stop[a2]
\stop[a2]
-## URLs with spaces
+## URLs with spaces and punctuation
[foo](/bar and baz)
[foo](/bar
@@ -42,6 +42,8 @@
[bam]: /foo fee
[bork]: /foo/zee zob (title)
+[Ward's method.](http://en.wikipedia.org/wiki/Ward's_method)
+
## Horizontal rules with spaces at end
* * * * *