ansi-wl-pprint 0.6.1 → 0.6.2
raw patch · 3 files changed
+26/−22 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.PrettyPrint.ANSI.Leijen: removeANSIFormatting :: Doc -> Doc
+ Text.PrettyPrint.ANSI.Leijen: plain :: Doc -> Doc
Files
- Text/PrettyPrint/ANSI/Example.hs +5/−1
- Text/PrettyPrint/ANSI/Leijen.hs +20/−20
- ansi-wl-pprint.cabal +1/−1
Text/PrettyPrint/ANSI/Example.hs view
@@ -17,4 +17,8 @@ putStr $ show $ green (text "I will be green on Unix but uncolored on Windows") <> linebreak -- Let's see some non-color formatting:- putDoc $ text "We can do" <+> bold (text "boldness") <> text ", if your terminal supports it, and even perhaps" <+> underline (text "underlining")+ putDoc $ text "We can do" <+> bold (text "boldness") <> text ", if your terminal supports it, and even perhaps" <+> underline (text "underlining") <> linebreak++ -- Just a little test of the formatting removal:+ putDoc $ text "There is a handy utility called 'plain' to" <+> plain (bold $ text "remove formatting") <+>+ plain (text "if you need to e.g. support" <+> red (text "non-ANSI") <+> text "terminals")
Text/PrettyPrint/ANSI/Leijen.hs view
@@ -124,7 +124,7 @@ underline, deunderline, -- * Removing formatting- removeANSIFormatting,+ plain, -- * Primitive type documents string, int, integer, float, double, rational,@@ -763,12 +763,12 @@ | SSGR [SGR] SimpleDoc --- MCB: Not in the wl-pprint package that we forked from. I added this when--- the "pretty" package from base gained a Monoid instance:+-- MCB: Not in the wl-pprint package that we forked from. I added this when the "pretty" package+-- from base gained a Monoid instance (<http://thread.gmane.org/gmane.comp.lang.haskell.libraries/14031>): instance Monoid Doc where mempty = empty- mappend = (<$$>)- mconcat = vcat+ mappend = (<>)+ mconcat = hcat -- | The empty document is, indeed, empty. Although @empty@ has no@@ -1010,21 +1010,21 @@ ----------------------------------------------------------- -- | Removes all colorisation, emboldening and underlining from a document-removeANSIFormatting :: Doc -> Doc-removeANSIFormatting e@Empty = e-removeANSIFormatting c@(Char _) = c-removeANSIFormatting t@(Text _ _) = t-removeANSIFormatting l@(Line _) = l-removeANSIFormatting (Cat x y) = Cat (removeANSIFormatting x) (removeANSIFormatting y)-removeANSIFormatting (Nest i x) = Nest i (removeANSIFormatting x)-removeANSIFormatting (Union x y) = Union (removeANSIFormatting x) (removeANSIFormatting y)-removeANSIFormatting (Column f) = Column (removeANSIFormatting . f)-removeANSIFormatting (Nesting f) = Nesting (removeANSIFormatting . f)-removeANSIFormatting (Color _ _ _ x) = removeANSIFormatting x-removeANSIFormatting (Intensify _ x) = removeANSIFormatting x-removeANSIFormatting (Italicize _ x) = removeANSIFormatting x-removeANSIFormatting (Underline _ x) = removeANSIFormatting x-removeANSIFormatting (RestoreFormat _ _ _ _ _) = Empty+plain :: Doc -> Doc+plain e@Empty = e+plain c@(Char _) = c+plain t@(Text _ _) = t+plain l@(Line _) = l+plain (Cat x y) = Cat (plain x) (plain y)+plain (Nest i x) = Nest i (plain x)+plain (Union x y) = Union (plain x) (plain y)+plain (Column f) = Column (plain . f)+plain (Nesting f) = Nesting (plain . f)+plain (Color _ _ _ x) = plain x+plain (Intensify _ x) = plain x+plain (Italicize _ x) = plain x+plain (Underline _ x) = plain x+plain (RestoreFormat _ _ _ _ _) = Empty ----------------------------------------------------------- -- Renderers
ansi-wl-pprint.cabal view
@@ -1,5 +1,5 @@ Name: ansi-wl-pprint-Version: 0.6.1+Version: 0.6.2 Cabal-Version: >= 1.2 Category: User Interfaces, Text Synopsis: The Wadler/Leijen Pretty Printer for colored ANSI terminal output