git.iko.soy/typeable/pandoc
on master help sign in
Revised inline code parsing in Markdown reader to conform to
0d18277fiddlosopher
src/Text/Pandoc/Readers/Markdown.hs+6−14
@@ -519,7 +519,7 @@ rawLaTeXEnvironment' = do
519-- inline
519-- inline
520--
520--
521
521
522−text = choice [ math, strong, emph, code2, code1, str, linebreak, tabchar,
522+text = choice [ math, strong, emph, code, str, linebreak, tabchar,
523 whitespace, endline ] <?> "text"
523 whitespace, endline ] <?> "text"
524
524
525inline = choice [ rawLaTeXInline', escapedChar, special, hyphens, text,
525inline = choice [ rawLaTeXInline', escapedChar, special, hyphens, text,
@@ -548,23 +548,15 @@ hyphens = try (do
548 else do{ string ""; return Space }
548 else do{ string ""; return Space }
549 return (Str result))
549 return (Str result))
550
550
551−-- parses inline code, between codeStart and codeEnd
551+-- parses inline code, between n codeStarts and n codeEnds
552−code1 = try (do
552+code = try (do
553− char codeStart
553+ starts <- many1 (char codeStart)
554− result <- many (noneOf [codeEnd])
554+ let num = length starts
555− char codeEnd
555+ result <- many1Till anyChar (try (count num (char codeEnd)))
556 -- get rid of any internal newlines
556 -- get rid of any internal newlines
557 let result' = removeLeadingTrailingSpace $ joinWithSep " " $ lines result
557 let result' = removeLeadingTrailingSpace $ joinWithSep " " $ lines result
558 return (Code result'))
558 return (Code result'))
559
559
560−-- parses inline code, between 2 codeStarts and 2 codeEnds
561−code2 = try (do
562− string [codeStart, codeStart]
563− result <- manyTill anyChar (try (string [codeEnd, codeEnd]))
564− let result' = removeLeadingTrailingSpace $ joinWithSep " " $ lines result
565− -- get rid of any internal newlines
566− return (Code result'))
567−
568mathWord = many1 (choice [ (noneOf (" \t\n\\" ++ [mathEnd])),
560mathWord = many1 (choice [ (noneOf (" \t\n\\" ++ [mathEnd])),
569 (try (do
561 (try (do
570 c <- char '\\'
562 c <- char '\\'