diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-03-06 02:42:15 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-03-06 02:42:15 +0000 |
commit | 76e6c071d09cfcba8d8c2097756e581157d43820 (patch) | |
tree | 35856602412a3519df6970e39e03b5d62056151c | |
parent | f5e00c50b8ec7c5687feae6278869205a1d6ab60 (diff) | |
download | pandoc-76e6c071d09cfcba8d8c2097756e581157d43820.tar.gz |
Disallow blank lines in inline code span.
Also added additional test cases for markdown code spans.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1860 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 2 | ||||
-rw-r--r-- | tests/markdown-reader-more.native | 8 | ||||
-rw-r--r-- | tests/markdown-reader-more.txt | 13 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index f674ee204..b7b6d4e45 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -957,7 +957,7 @@ code = try $ do starts <- many1 (char '`') skipSpaces result <- many1Till (many1 (noneOf "`\n") <|> many1 (char '`') <|> - (char '\n' >> return " ")) + (char '\n' >> notFollowedBy' blankline >> return " ")) (try (skipSpaces >> count (length starts) (char '`') >> notFollowedBy (char '`'))) return $ Code $ removeLeadingTrailingSpace $ concat result diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native index a39965970..ccf29329e 100644 --- a/tests/markdown-reader-more.native +++ b/tests/markdown-reader-more.native @@ -21,5 +21,11 @@ Pandoc (Meta {docTitle = [Str "Title",Space,Str "spanning",Space,Str "multiple", [ [ Plain [Str "one"] , RawHtml "<!--\n- two\n-->" ], [ Plain [Str "three"] ] ] , Header 2 [Str "Backslash",Space,Str "newline"] -, Para [Str "hi",LineBreak,Str "there"] ] +, Para [Str "hi",LineBreak,Str "there"] +, Header 2 [Str "Code",Space,Str "spans"] +, Para [Code "hi\\"] +, Para [Code "hi there"] +, Para [Code "hi````there"] +, Para [Str "`",Str "hi"] +, Para [Str "there",Str "`"] ] diff --git a/tests/markdown-reader-more.txt b/tests/markdown-reader-more.txt index de80d740b..bc1260cfc 100644 --- a/tests/markdown-reader-more.txt +++ b/tests/markdown-reader-more.txt @@ -70,3 +70,16 @@ $\$2 + \$3$ hi\ there +## Code spans + +`hi\` + +`hi +there` + +`` hi````there `` + +`hi + +there` + |