diff options
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Pretty.hs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs index 3b905b1c5..21121a506 100644 --- a/src/Text/Pandoc/Pretty.hs +++ b/src/Text/Pandoc/Pretty.hs @@ -190,12 +190,14 @@ vsep = foldr ($+$) empty chomp :: Doc -> Doc chomp d = Doc (fromList dl') where dl = toList (unDoc d) - dl' = reverse $ dropWhile removeable $ reverse dl - removeable BreakingSpace = True - removeable CarriageReturn = True - removeable NewLine = True - removeable BlankLine = True - removeable _ = False + dl' = reverse $ go $ reverse dl + go [] = [] + go (BreakingSpace : xs) = go xs + go (CarriageReturn : xs) = go xs + go (NewLine : xs) = go xs + go (BlankLine : xs) = go xs + go (Prefixed s d' : xs) = Prefixed s (chomp d') : xs + go xs = xs outp :: (IsString a, Monoid a) => Int -> String -> DocState a |