diff options
-rw-r--r-- | Text/Pandoc/Readers/Markdown.hs | 10 | ||||
-rw-r--r-- | tests/RunTests.hs | 4 | ||||
-rw-r--r-- | tests/markdown-reader-more.native | 5 | ||||
-rw-r--r-- | tests/markdown-reader-more.txt | 13 |
4 files changed, 25 insertions, 7 deletions
diff --git a/Text/Pandoc/Readers/Markdown.hs b/Text/Pandoc/Readers/Markdown.hs index 89dbfe9a9..cf1053628 100644 --- a/Text/Pandoc/Readers/Markdown.hs +++ b/Text/Pandoc/Readers/Markdown.hs @@ -187,10 +187,9 @@ referenceKey = try $ do nonindentSpaces lab <- reference char ':' - skipSpaces - optional (char '<') - src <- many (noneOf "> \n\t") - optional (char '>') + skipSpaces >> optional newline >> skipSpaces >> notFollowedBy (char '[') + src <- (char '<' >> many (noneOf "> \n\t") >>~ char '>') + <|> many (noneOf " \n\t") tit <- option "" referenceTitle blanklines endPos <- getPosition @@ -203,8 +202,7 @@ referenceKey = try $ do referenceTitle :: GenParser Char st String referenceTitle = try $ do - (many1 spaceChar >> option '\n' newline) <|> newline - skipSpaces + skipSpaces >> optional newline >> skipSpaces tit <- (charsInBalanced '(' ')' >>= return . unwords . words) <|> do delim <- char '\'' <|> char '"' manyTill anyChar (try (char delim >> skipSpaces >> diff --git a/tests/RunTests.hs b/tests/RunTests.hs index 69f008ac2..b0961a390 100644 --- a/tests/RunTests.hs +++ b/tests/RunTests.hs @@ -61,6 +61,8 @@ main = do "testsuite.txt" "testsuite.native" r7 <- runTest "markdown reader (tables)" ["-r", "markdown", "-w", "native"] "tables.txt" "tables.native" + r7a <- runTest "markdown reader (more)" ["-r", "markdown", "-w", "native"] + "markdown-reader-more.txt" "markdown-reader-more.native" r8 <- runTest "rst reader" ["-r", "rst", "-w", "native", "-s", "-S"] "rst-reader.rst" "rst-reader.native" r9 <- runTest "html reader" ["-r", "html", "-w", "native", "-s"] @@ -69,7 +71,7 @@ main = do "latex-reader.latex" "latex-reader.native" r11 <- runTest "native reader" ["-r", "native", "-w", "native", "-s"] "testsuite.native" "testsuite.native" - let results = r1s ++ [r2, r3, r4, r5, r6, r7, r8, r9, r10, r11] + let results = r1s ++ [r2, r3, r4, r5, r6, r7, r7a, r8, r9, r10, r11] if all id results then do putStrLn "\nAll tests passed." diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native new file mode 100644 index 000000000..7785f85fb --- /dev/null +++ b/tests/markdown-reader-more.native @@ -0,0 +1,5 @@ +Pandoc (Meta [] [] "") +[ Header 1 [Str "Additional",Space,Str "markdown",Space,Str "reader",Space,Str "tests"] +, Header 2 [Str "Blank",Space,Str "line",Space,Str "before",Space,Str "URL",Space,Str "in",Space,Str "link",Space,Str "reference"] +, Para [Link [Str "foo"] ("/url",""),Space,Str "and",Space,Link [Str "bar"] ("/url","title")] ] + diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt new file mode 100644 index 000000000..32f10d61c --- /dev/null +++ b/tests/markdown-reader-more.txt @@ -0,0 +1,13 @@ +# Additional markdown reader tests + +## Blank line before URL in link reference + +[foo] and [bar] + +[foo]: + /url + +[bar]: +/url +"title" + |