aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/ParserCombinators.hs2
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs8
-rw-r--r--src/Text/Pandoc/Readers/RST.hs19
3 files changed, 16 insertions, 13 deletions
diff --git a/src/Text/Pandoc/ParserCombinators.hs b/src/Text/Pandoc/ParserCombinators.hs
index 2e4c1413c..c49845597 100644
--- a/src/Text/Pandoc/ParserCombinators.hs
+++ b/src/Text/Pandoc/ParserCombinators.hs
@@ -76,7 +76,7 @@ enclosed :: GenParser Char st t -- ^ start parser
enclosed start end parser = try (do
start
notFollowedBy space
- result <- many1Till parser end
+ result <- many1Till parser (try end)
return result)
-- | Like @manyTill@, but reads at least one item.
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index feef85c2a..471417458 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -552,13 +552,11 @@ doubleQuoted = try (do
singleQuoteStart = char '`'
-singleQuoteEnd = try (do
- char '\''
- notFollowedBy alphaNum)
+singleQuoteEnd = char '\'' >> notFollowedBy alphaNum
-doubleQuoteStart = try (string "``")
+doubleQuoteStart = string "``"
-doubleQuoteEnd = try (string "''")
+doubleQuoteEnd = string "''"
ellipses = try (do
string "\\ldots"
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