aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-08-29 16:38:41 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-08-29 16:38:41 +0000
commit845a658affdd370c3b8395b1f57754dbb32995dd (patch)
treee8acad2522e0337feda90c1893894bfbba8c8bdd
parent77f63605f5d0980588404d81528970fdddce4272 (diff)
downloadpandoc-845a658affdd370c3b8395b1f57754dbb32995dd.tar.gz
Fixed markdown inline code parsing so it better accords with
Markdown.pl: the marker for the end of the code section is a clump of the same number of `'s with which the section began, followed by a non-` character. So, for example, ` h ``` i ` -> <code>h ``` i</code>. git-svn-id: https://pandoc.googlecode.com/svn/trunk@954 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 8dc82446e..13345c6a9 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -666,10 +666,12 @@ symbol = do
-- parses inline code, between n `s and n `s
code = try $ do
starts <- many1 (char '`')
- let num = length starts
- result <- many1Till anyChar (try (count num (char '`')))
- -- get rid of any internal newlines
- return $ Code $ removeLeadingTrailingSpace $ joinWithSep " " $ lines result
+ skipSpaces
+ result <- many1Till (many1 (noneOf "`\n") <|> many1 (char '`') <|>
+ (char '\n' >> return " "))
+ (try (skipSpaces >> count (length starts) (char '`') >>
+ notFollowedBy (char '`')))
+ return $ Code $ removeLeadingTrailingSpace $ concat result
mathWord = many1 ((noneOf " \t\n\\$") <|>
(try (char '\\') >>~ notFollowedBy (char '$')))