Revised inline code parsing in Markdown reader to conform to

Markdown.pl.  Now any number of `'s can begin inline code,
which will end with the same number of `'s.  For example, to
have two backticks as code, write
``` `` ```


git-svn-id: https://pandoc.googlecode.com/svn/trunk@360 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2006-12-31 19:22:02 +00:00
parent 7f7b456d96
commit 0d182772f9

View file

@ -519,7 +519,7 @@ rawLaTeXEnvironment' = do
-- inline
--
text = choice [ math, strong, emph, code2, code1, str, linebreak, tabchar,
text = choice [ math, strong, emph, code, str, linebreak, tabchar,
whitespace, endline ] <?> "text"
inline = choice [ rawLaTeXInline', escapedChar, special, hyphens, text,
@ -548,23 +548,15 @@ hyphens = try (do
else do{ string ""; return Space }
return (Str result))
-- parses inline code, between codeStart and codeEnd
code1 = try (do
char codeStart
result <- many (noneOf [codeEnd])
char codeEnd
-- parses inline code, between n codeStarts and n codeEnds
code = try (do
starts <- many1 (char codeStart)
let num = length starts
result <- many1Till anyChar (try (count num (char codeEnd)))
-- get rid of any internal newlines
let result' = removeLeadingTrailingSpace $ joinWithSep " " $ lines result
return (Code result'))
-- parses inline code, between 2 codeStarts and 2 codeEnds
code2 = try (do
string [codeStart, codeStart]
result <- manyTill anyChar (try (string [codeEnd, codeEnd]))
let result' = removeLeadingTrailingSpace $ joinWithSep " " $ lines result
-- get rid of any internal newlines
return (Code result'))
mathWord = many1 (choice [ (noneOf (" \t\n\\" ++ [mathEnd])),
(try (do
c <- char '\\'