diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-10-18 23:52:07 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-10-18 23:54:13 -0700 |
commit | b59ba39e1ad17d62f67b071a97b4dc820b447be5 (patch) | |
tree | 59d78c8e54a07b298839fc3f3a7fae52ce9f002a /src/Text/Pandoc | |
parent | e9c422649df5504ab58616a51e30671af23265a0 (diff) | |
download | pandoc-b59ba39e1ad17d62f67b071a97b4dc820b447be5.tar.gz |
Man reader: remove final newline in code blocks.
This is consistent with other readers.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Man.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs index 3aab375ab..f10546839 100644 --- a/src/Text/Pandoc/Readers/Man.hs +++ b/src/Text/Pandoc/Readers/Man.hs @@ -530,10 +530,14 @@ parseCodeBlock = do mmacro KCodeBlStart toks <- many (mstr <|> mline <|> mmaybeLink <|> memplyLine <|> munknownMacro <|> mcomment) mmacro KCodeBlEnd - return $ codeBlock (intercalate "\n" . catMaybes $ extractText <$> toks) + return $ codeBlock (removeFinalNewline $ + intercalate "\n" . catMaybes $ + extractText <$> toks) where + removeFinalNewline [] = [] + removeFinalNewline xs = if last xs == '\n' then init xs else xs extractText :: ManToken -> Maybe String extractText (MStr (s, _)) = Just s extractText (MLine ss) = Just . concat $ map fst ss -- TODO maybe unwords? |