diff options
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Roff.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/Roff.hs b/src/Text/Pandoc/Readers/Roff.hs index fdf9a7f06..0559bab42 100644 --- a/src/Text/Pandoc/Readers/Roff.hs +++ b/src/Text/Pandoc/Readers/Roff.hs @@ -212,6 +212,7 @@ readUnicodeChar _ = Nothing escapeNormal :: PandocMonad m => RoffLexer m [LinePart] escapeNormal = do c <- anyChar + optional expandString case c of ' ' -> return [RoffStr " "] '"' -> mempty <$ skipMany (satisfy (/='\n')) -- line comment @@ -313,13 +314,12 @@ signedNumber = try $ do -- Parses: [..] or (.. escapeArg :: PandocMonad m => RoffLexer m String escapeArg = choice - [ char '[' *> manyTill (expanding $ noneOf ['\n',']']) (char ']') - , char '(' *> count 2 (expanding $ satisfy (/='\n')) + [ char '[' *> optional expandString *> + manyTill (noneOf ['\n',']']) (char ']') + , char '(' *> optional expandString *> + count 2 (satisfy (/='\n')) ] -expanding :: PandocMonad m => RoffLexer m a -> RoffLexer m a -expanding parser = try $ optional expandString >> parser - expandString :: PandocMonad m => RoffLexer m () expandString = try $ do pos <- getPosition @@ -336,7 +336,7 @@ quoteArg = char '\'' *> manyTill (noneOf ['\n','\'']) (char '\'') escFont :: PandocMonad m => RoffLexer m [LinePart] escFont = do - font <- expanding (escapeArg <|> count 1 alphaNum) + font <- escapeArg <|> count 1 alphaNum font' <- if null font || font == "P" then prevFont <$> getState else return $ foldr processFontLetter defaultFontSpec font |