diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-22 21:01:17 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-22 21:01:17 +0000 |
commit | c1f397622dc0fb3643041f0099d6b5e004d03fd0 (patch) | |
tree | 57300572052bb6242c3de062756c113681d2dbf7 /src/Text/Pandoc/Readers/RST.hs | |
parent | 3ca9932ca6a4d7ac7ca08bf06f4051674a2981f1 (diff) | |
download | pandoc-c1f397622dc0fb3643041f0099d6b5e004d03fd0.tar.gz |
Added a "try" to the end parser in enclosed (Text.Pandoc.ParserCombinators).
This makes errors in its use less likely. Removed some now-unneeded try's
in calling code.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@776 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Readers/RST.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 36d0f8403..7fed7cbd3 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -536,12 +536,9 @@ regularKey = try $ do -- inline -- -text = choice [ strong, emph, code, str, tabchar, whitespace, - endline ] <?> "text" - -inline = choice [ escapedChar, special, hyphens, text, symbol ] <?> "inline" - -special = choice [ link, image ] <?> "link, inline html, or image" +inline = choice [ escapedChar, link, image, hyphens, strong, emph, + superscript, subscript, code, + str, tabchar, whitespace, endline, symbol ] <?> "inline" hyphens = try (do result <- many1 (char '-') @@ -567,9 +564,17 @@ emph = do return (Emph (normalizeSpaces result)) strong = do - result <- enclosed (try (string "**")) (try (string "**")) inline + result <- enclosed (string "**") (string "**") inline return (Strong (normalizeSpaces result)) +superscript = do + result <- enclosed (string "\\ :sup:`") (string "`\\ ") anyChar + return (Superscript [Str result]) + +subscript = do + result <- enclosed (string "\\ :sub:`") (string "`\\ ") anyChar + return (Subscript [Str result]) + whitespace = do many1 spaceChar <?> "whitespace" return Space |