git.iko.soy/typeable/pandoc
on master help sign in
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

commit845a658affdd370c3b8395b1f57754dbb32995dd authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateWed 29 Aug 2007, 16:38 (19 years ago) parent77f6360
1 file changed+6−4
src/Text/Pandoc/Readers/Markdown.hs+6−4
src/Text/Pandoc/Readers/Markdown.hs+6−4
@@ -666,10 +666,12 @@ symbol = do
666666-- parses inline code, between n `s and n `s
667667code = try $ do
668668 starts <- many1 (char '`')
669− let num = length starts
670− result <- many1Till anyChar (try (count num (char '`')))
671− -- get rid of any internal newlines
672− return $ Code $ removeLeadingTrailingSpace $ joinWithSep " " $ lines result
669+ skipSpaces
670+ result <- many1Till (many1 (noneOf "`\n") <|> many1 (char '`') <|>
671+ (char '\n' >> return " "))
672+ (try (skipSpaces >> count (length starts) (char '`') >>
673+ notFollowedBy (char '`')))
674+ return $ Code $ removeLeadingTrailingSpace $ concat result
673675
674676mathWord = many1 ((noneOf " \t\n\\$") <|>
675677 (try (char '\\') >>~ notFollowedBy (char '$')))