aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-05-02 22:58:47 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-05-02 22:58:47 -0700
commit4c4382420356928d73026395d4ab2f0f9957df08 (patch)
tree23dbc3ba9895a13d3fbda63846c58b6de0c63fa5
parent007eb96e06bc1fff12119addf2e03552ac992b2e (diff)
downloadpandoc-4c4382420356928d73026395d4ab2f0f9957df08.tar.gz
Fixed empty reference links. Closes #1186.
Includes test.
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs4
-rw-r--r--tests/markdown-reader-more.native5
-rw-r--r--tests/markdown-reader-more.txt8
3 files changed, 13 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 97a3168da..36f73d847 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -349,10 +349,8 @@ referenceKey = try $ do
char ':'
skipSpaces >> optional newline >> skipSpaces >> notFollowedBy (char '[')
let sourceURL = liftM unwords $ many $ try $ do
- notFollowedBy' referenceTitle
- skipMany spaceChar
- optional $ newline >> notFollowedBy blankline
skipMany spaceChar
+ notFollowedBy' referenceTitle
notFollowedBy' (() <$ reference)
many1 $ notFollowedBy space >> litChar
let betweenAngles = try $ char '<' >>
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index 27f09dada..0d74c233d 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -136,4 +136,7 @@
,Para [Link [Str "link"] ("/hithere)","")]
,Para [Link [Str "linky"] ("hi_(there_(nested))","")]
,Header 2 ("reference-link-fallbacks",[],[]) [Str "Reference",Space,Str "link",Space,Str "fallbacks"]
-,Para [Str "[",Emph [Str "not",Space,Str "a",Space,Str "link"],Str "]",Space,Str "[",Emph [Str "nope"],Str "]\8230"]]
+,Para [Str "[",Emph [Str "not",Space,Str "a",Space,Str "link"],Str "]",Space,Str "[",Emph [Str "nope"],Str "]\8230"]
+,Header 2 ("empty-reference-links",[],[]) [Str "Empty",Space,Str "reference",Space,Str "links"]
+,Para [Str "bar"]
+,Para [Link [Str "foo2"] ("","")]]
diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt
index d133b3dbb..739543bfd 100644
--- a/tests/markdown-reader-more.txt
+++ b/tests/markdown-reader-more.txt
@@ -235,3 +235,11 @@ Empty cells
## Reference link fallbacks
[*not a link*] [*nope*]...
+
+## Empty reference links
+
+[foo2]:
+
+bar
+
+[foo2]