git.iko.soy/typeable/pandoc
on master help sign in
Pretty: Fixed chomp so it works inside Prefixed elements.
commit68c95f4857923f260794418a9769d0896a963f63 authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 28 Feb 2013, 20:22 (14 years ago) parent0c49658
1 file changed+8−6
src/Text/Pandoc/Pretty.hs+8−6
src/Text/Pandoc/Pretty.hs+8−6
@@ -190,12 +190,14 @@ vsep = foldr ($+$) empty
190190chomp :: Doc -> Doc
191191chomp d = Doc (fromList dl')
192192 where dl = toList (unDoc d)
193− dl' = reverse $ dropWhile removeable $ reverse dl
194− removeable BreakingSpace = True
195− removeable CarriageReturn = True
196− removeable NewLine = True
197− removeable BlankLine = True
198− removeable _ = False
193+ dl' = reverse $ go $ reverse dl
194+ go [] = []
195+ go (BreakingSpace : xs) = go xs
196+ go (CarriageReturn : xs) = go xs
197+ go (NewLine : xs) = go xs
198+ go (BlankLine : xs) = go xs
199+ go (Prefixed s d' : xs) = Prefixed s (chomp d') : xs
200+ go xs = xs
199201
200202outp :: (IsString a, Monoid a)
201203 => Int -> String -> DocState a