aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Man.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs
index c449590ff..d74836435 100644
--- a/src/Text/Pandoc/Readers/Man.hs
+++ b/src/Text/Pandoc/Readers/Man.hs
@@ -416,8 +416,12 @@ lexLine :: PandocMonad m => ManLexer m ManTokens
lexLine = do
lnparts <- mconcat <$> many1 linePart
eofline
- return $ singleTok $ MLine lnparts
- where
+ go lnparts
+ where -- return empty line if we only have empty strings;
+ -- this can happen if the line just contains \f[C], for example.
+ go [] = return mempty
+ go (RoffStr ("",_):xs) = go xs
+ go xs = return $ singleTok $ MLine xs
linePart :: PandocMonad m => ManLexer m [LinePart]
linePart = macroArg <|> esc <|> escStar <|>
@@ -647,15 +651,11 @@ parseCodeBlock = try $ do
mmacro "nf"
toks <- many (mline <|> memptyLine)
mmacro "fi"
- return $ codeBlock (removeFinalNewline $
- intercalate "\n" . catMaybes $
+ return $ codeBlock (intercalate "\n" . catMaybes $
extractText <$> toks)
where
- removeFinalNewline [] = []
- removeFinalNewline xs = if last xs == '\n' then init xs else xs
-
extractText :: ManToken -> Maybe String
extractText (MLine ss) = Just $ linePartsToString ss
extractText MEmptyLine = Just ""