Pretty: Added nestle. API change, minor version bump to 1.12.3.
This commit is contained in:
parent
4e7aadb903
commit
452a140d0c
2 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
Name: pandoc
|
||||
Version: 1.12.2.1
|
||||
Version: 1.12.3
|
||||
Cabal-Version: >= 1.10
|
||||
Build-Type: Custom
|
||||
License: GPL
|
||||
|
|
|
@ -60,6 +60,7 @@ module Text.Pandoc.Pretty (
|
|||
, hsep
|
||||
, vcat
|
||||
, vsep
|
||||
, nestle
|
||||
, chomp
|
||||
, inside
|
||||
, braces
|
||||
|
@ -72,7 +73,7 @@ module Text.Pandoc.Pretty (
|
|||
)
|
||||
|
||||
where
|
||||
import Data.Sequence (Seq, fromList, (<|), singleton, mapWithIndex)
|
||||
import Data.Sequence (Seq, fromList, (<|), singleton, mapWithIndex, viewl, ViewL(..))
|
||||
import Data.Foldable (toList)
|
||||
import Data.List (intercalate)
|
||||
import Data.Monoid
|
||||
|
@ -186,6 +187,14 @@ vcat = foldr ($$) empty
|
|||
vsep :: [Doc] -> Doc
|
||||
vsep = foldr ($+$) empty
|
||||
|
||||
-- | Removes leading blank lines from a 'Doc'.
|
||||
nestle :: Doc -> Doc
|
||||
nestle (Doc d) = Doc $ go d
|
||||
where go x = case viewl x of
|
||||
(BlankLine :< rest) -> go rest
|
||||
(NewLine :< rest) -> go rest
|
||||
_ -> x
|
||||
|
||||
-- | Chomps trailing blank space off of a 'Doc'.
|
||||
chomp :: Doc -> Doc
|
||||
chomp d = Doc (fromList dl')
|
||||
|
|
Loading…
Add table
Reference in a new issue