pandoc-lens 0.7.0 → 0.8.0
raw patch · 3 files changed
+40/−29 lines, 3 filesdep ~basedep ~containersdep ~lensPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, containers, lens, pandoc-types, text
API changes (from Hackage documentation)
- Text.Pandoc.Lens: _Null :: Prism' Block ()
+ Text.Pandoc.Lens: blockPrePlate :: Traversal' Block [Block]
- Text.Pandoc.Lens: _Table :: Prism' Block ([Inline], [Alignment], [Double], [TableCell], [[TableCell]])
+ Text.Pandoc.Lens: _Table :: Prism' Block (Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
Files
- Text/Pandoc/Lens.hs +19/−22
- changelog.mkd +13/−0
- pandoc-lens.cabal +8/−7
Text/Pandoc/Lens.hs view
@@ -28,7 +28,7 @@ , _HorizontalRule , _Table , _Div- , _Null+ , blockPrePlate -- * Inlines -- | Prisms are provided for the constructors of 'Inline' -- as well as a 'Plated' instance.@@ -162,10 +162,12 @@ f _ = Nothing -- | A prism on a 'Table' 'Block'-_Table :: Prism' Block ([Inline], [Alignment], [Double], [TableCell], [[TableCell]])-_Table = prism' (\(a, b, c, d, e) -> Table a b c d e) f+_Table :: Prism' Block (Attr, Caption,[ColSpec],TableHead,[TableBody],TableFoot)+_Table = prism' (\(attr, caption, colSpecs, tableHead, tableBodies, tableFoot)+ -> Table attr caption colSpecs tableHead tableBodies tableFoot) f where- f (Table a b c d e) = Just (a, b, c, d, e)+ f (Table attr caption colSpecs tableHead tableBodies tableFoot)+ = Just (attr, caption, colSpecs, tableHead, tableBodies, tableFoot) f _ = Nothing -- | A prism on a 'Div' 'Block'@@ -175,24 +177,20 @@ f (Div _ a) = Just a f _ = Nothing --- | A prism on a 'Null' 'Block'-_Null :: Prism' Block ()-_Null = prism' (const Null) f- where- f Null = Just ()- f _ = Nothing+-- | An affine traversal over the '[Block]' in the last argument of an 'Block' constructor+blockPrePlate :: Traversal' Block [Block]+blockPrePlate f blk =+ case blk of+ BlockQuote blks -> BlockQuote <$> f blks+ OrderedList attrs' blks -> OrderedList attrs' <$> traverseOf each f blks+ BulletList blks -> BulletList <$> traverseOf each f blks+ DefinitionList blks -> DefinitionList <$> traverseOf (each . _2 . each) f blks+ Figure a b blks -> Figure a b <$> f blks+ Div attrs' blks -> Div attrs' <$> f blks+ _ -> pure blk instance Plated Block where- plate f blk =- case blk of- BlockQuote blks -> BlockQuote <$> traverse f blks- OrderedList attrs' blks -> OrderedList attrs' <$> traverseOf (each . each) f blks- BulletList blks -> BulletList <$> traverseOf (each . each) f blks- DefinitionList blks -> DefinitionList <$> traverseOf (each . _2 . each . each) f blks- Table a b c hdrs rows -> Table a b c <$> traverseOf (each . each) f hdrs- <*> traverseOf (each . each . each) f rows- Div attrs' blks -> Div attrs' <$> traverseOf each f blks- _ -> pure blk+ plate = blockPrePlate . each -- | Traverse over the 'Inline' children of a 'Block' blockInlines :: Traversal' Block Inline@@ -200,10 +198,9 @@ case blk of Plain inls -> Plain <$> traverse f inls Para inls -> Para <$> traverse f inls+ LineBlock inlss -> LineBlock <$> traverseOf (each . each) f inlss DefinitionList xs -> DefinitionList <$> traverseOf (each . _1 . each) f xs Header n attr inls -> Header n attr <$> traverse f inls- Table capt a b c d -> Table <$> traverse f capt- <*> pure a <*> pure b <*> pure c <*> pure d _ -> pure blk -- | A prism on a 'Str' 'Inline'
+ changelog.mkd view
@@ -0,0 +1,13 @@+# `pandoc-lens` changelog++## 0.8++* Update for `pandoc-types-0.23`++## 0.7++* Update for `pandoc-types-0.21`++## 0.6 and earlier++Pre-history.
pandoc-lens.cabal view
@@ -1,5 +1,5 @@ name: pandoc-lens-version: 0.7.0+version: 0.8.0 synopsis: Lenses for Pandoc documents description: Lenses for Pandoc documents. homepage: http://github.com/bgamari/pandoc-lens@@ -11,18 +11,19 @@ category: Text build-type: Simple cabal-version: >=1.10+extra-source-files: changelog.mkd tested-with: GHC==8.8.1, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2 source-repository head type: git- location: git://github.com/bgamari/pandoc-lenses+ location: https://github.com/bgamari/pandoc-lenses library exposed-modules: Text.Pandoc.Lens ghc-options: -Wall -fno-warn-orphans- build-depends: base >=4.7 && <4.15,- containers >=0.5 && <0.7,- pandoc-types >=1.20 && <1.21,- lens >=4.2 && <4.20,- text+ build-depends: base >=4.7 && <4.22,+ containers >=0.5 && <0.9,+ pandoc-types >=1.23 && <1.24,+ lens >=4.2 && <5.4,+ text < 2.2 default-language: Haskell2010