aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-10-28 18:11:57 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-10-28 18:11:57 -0700
commitb1e71013933f0f5b98188639ea7e11f0c5f65ec8 (patch)
tree41f20049dbcb840dc28568b4904fbbda2f9521fb /src/Text
parent22755a35b78c8aed6fe6a6fc0ea881540d351eda (diff)
downloadpandoc-b1e71013933f0f5b98188639ea7e11f0c5f65ec8.tar.gz
Roff tokenizer: refactor escString.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Roff.hs21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/Text/Pandoc/Readers/Roff.hs b/src/Text/Pandoc/Readers/Roff.hs
index 7bcf5305d..cf9056aa7 100644
--- a/src/Text/Pandoc/Readers/Roff.hs
+++ b/src/Text/Pandoc/Readers/Roff.hs
@@ -212,7 +212,7 @@ escapeNormal = do
'C' -> quoteArg >>= resolveGlyph '\''
'f' -> escFont
's' -> escFontSize
- '*' -> escStar
+ '*' -> escString
'"' -> mempty <$ skipMany (satisfy (/='\n')) -- line comment
'#' -> mempty <$ manyTill anyChar newline
'%' -> return mempty
@@ -568,23 +568,14 @@ lexArgs = do
char '"'
return [RoffStr "\""]
-escStar :: PandocMonad m => RoffLexer m [LinePart]
-escStar = try $ do
+escString :: PandocMonad m => RoffLexer m [LinePart]
+escString = try $ do
pos <- getPosition
- c <- anyChar
- case c of
- '(' -> do
- cs <- count 2 anyChar
- resolveString cs pos
- '[' -> do
- cs <- many (noneOf "\t\n\r ]")
- char ']'
- resolveString cs pos
- 'S' -> return mempty -- switch back to default font size
- _ -> resolveString [c] pos
+ (do cs <- escapeArg
+ resolveString cs pos)
+ <|> mempty <$ char 'S'
where
-
-- strings and macros share namespace
resolveString stringname pos = do
RoffTokens ts <- resolveMacro stringname [] pos