git.iko.soy/typeable/pandoc
on master help sign in
Added a "try" to the end parser in enclosed (Text.Pandoc.ParserCombinators).
c1f3976fiddlosopher
src/Text/Pandoc/ParserCombinators.hs+1−1
@@ -76,7 +76,7 @@ enclosed :: GenParser Char st t -- ^ start parser
76enclosed start end parser = try (do
76enclosed start end parser = try (do
77 start
77 start
78 notFollowedBy space
78 notFollowedBy space
79− result <- many1Till parser end
79+ result <- many1Till parser (try end)
80 return result)
80 return result)
81
81
82-- | Like @manyTill@, but reads at least one item.
82-- | Like @manyTill@, but reads at least one item.
src/Text/Pandoc/Readers/LaTeX.hs+3−5
@@ -552,13 +552,11 @@ doubleQuoted = try (do
552
552
553singleQuoteStart = char '`'
553singleQuoteStart = char '`'
554
554
555−singleQuoteEnd = try (do
556− char '\''
557− notFollowedBy alphaNum)
555+singleQuoteEnd = char '\'' >> notFollowedBy alphaNum
558
556
559−doubleQuoteStart = try (string "``")
557+doubleQuoteStart = string "``"
560
558
561−doubleQuoteEnd = try (string "''")
559+doubleQuoteEnd = string "''"
562
560
563ellipses = try (do
561ellipses = try (do
564 string "\\ldots"
562 string "\\ldots"
src/Text/Pandoc/Readers/RST.hs+12−7
@@ -536,12 +536,9 @@ regularKey = try $ do
536 -- inline
536 -- inline
537 --
537 --
538
538
539+inline = choice [ escapedChar, link, image, hyphens, strong, emph,
540+ superscript, subscript, code,
539−text = choice [ strong, emph, code, str, tabchar, whitespace,
541+ str, tabchar, whitespace, endline, symbol ] <?> "inline"
540− endline ] <?> "text"
541−
542−inline = choice [ escapedChar, special, hyphens, text, symbol ] <?> "inline"
543−
544−special = choice [ link, image ] <?> "link, inline html, or image"
545
542
546hyphens = try (do
543hyphens = try (do
547 result <- many1 (char '-')
544 result <- many1 (char '-')
@@ -567,9 +564,17 @@ emph = do
567 return (Emph (normalizeSpaces result))
564 return (Emph (normalizeSpaces result))
568
565
569strong = do
566strong = do
570− result <- enclosed (try (string "**")) (try (string "**")) inline
567+ result <- enclosed (string "**") (string "**") inline
571 return (Strong (normalizeSpaces result))
568 return (Strong (normalizeSpaces result))
572
569
570+superscript = do
571+ result <- enclosed (string "\\ :sup:`") (string "`\\ ") anyChar
572+ return (Superscript [Str result])
573+
574+subscript = do
575+ result <- enclosed (string "\\ :sub:`") (string "`\\ ") anyChar
576+ return (Subscript [Str result])
577+
573whitespace = do
578whitespace = do
574 many1 spaceChar <?> "whitespace"
579 many1 spaceChar <?> "whitespace"
575 return Space
580 return Space