slick 1.1.0.0 → 1.1.1.0
raw patch · 3 files changed
+22/−7 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +3/−0
- slick.cabal +2/−2
- src/Slick/Pandoc.hs +17/−5
ChangeLog.md view
@@ -3,6 +3,9 @@ ## 1.1.0.0 - Upgrade to lts-16.29 +## 1.1.1.0+- Add `loadUsingMeta` to allow specifying a separate pandoc meta writer.+ ## 1.0.1.0 - Add `makePandocReaderWithMetaWriter` and `makePandocReaderWithMetaWriter'` for reading in resources with custom Pandoc Writers for metadata.
slick.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: f019959f739078bea3aa52701675229ce0976332382c3b5757380aef7c5e49dc+-- hash: ed2daf4cedbda6a1a41895f4c176fa62e5966613f2e5de2999685f0939e51627 name: slick-version: 1.1.0.0+version: 1.1.1.0 synopsis: A quick & easy static site builder built with shake and pandoc. description: Please see the README on GitHub at <https://github.com/ChrisPenner/slick#readme> category: Web
src/Slick/Pandoc.hs view
@@ -164,21 +164,33 @@ -------------------------------------------------------------------------------- -- | Load in a source document using the given 'PandocReader', then render the 'Pandoc'--- into text using the given 'PandocWriter'.+-- into text using the given 'PandocWriter'. Takes a second 'PandocWriter' to render+-- metadata. -- Returns a 'Value' wherein the rendered text is set to the "content" key and -- any metadata is set to its respective key in the 'Value'-loadUsing :: PandocReader textType- -> PandocWriter+loadUsingMeta :: PandocReader textType -- ^ The reader used to load the document+ -> PandocWriter -- ^ The writer used to render the document itself+ -> PandocWriter -- ^ The writer used to process metadata. -> textType -> Action Value-loadUsing reader writer text = do- (pdoc, meta) <- makePandocReaderWithMetaWriter reader writer text+loadUsingMeta reader writer metaWriter text = do+ (pdoc, meta) <- makePandocReaderWithMetaWriter reader metaWriter text outText <- unPandocM $ writer pdoc withContent <- case meta of Object m -> return . Object $ HM.insert "content" (String outText) m -- meta & _Object . at "content" ?~ String outText _ -> fail "Failed to parse metadata" return withContent++-- | Load in a source document using the given 'PandocReader', then render the 'Pandoc'+-- into text using the given 'PandocWriter'.+-- Returns a 'Value' wherein the rendered text is set to the "content" key and+-- any metadata is set to its respective key in the 'Value'+loadUsing :: PandocReader textType+ -> PandocWriter+ -> textType+ -> Action Value+loadUsing reader writer text = loadUsingMeta reader writer writer text -- | Like 'loadUsing' but allows also deserializes the 'Value' into any object -- which implements 'FromJSON'. Failure to deserialize will fail the Shake