hakyll-alectryon 0.1.1.0 → 0.1.2.0
raw patch · 4 files changed
+43/−9 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- README.md +33/−5
- hakyll-alectryon.cabal +1/−1
- src/Hakyll/Alectryon.hs +5/−3
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.1.2.0++- Adapt to Alectryon 1.4.0+ # 0.1.1.0 - Fix Pygments cache
README.md view
@@ -12,13 +12,18 @@ ## Dependencies -To use this package, first install [Alectryon][alectryon].-The executables `alectryon` and `python3` must be on your `$PATH`.+To use this package, first install [Alectryon][alectryon]: -(Pygments is also used by this package, and is required by Alectryon anyway.)+```+pip install alectryon+opam install coq-serapi # OCaml package used by alectryon+``` -## Usage+The executables `alectryon` and `python3` must be on your `$PATH`.+(`python3` is used to load Pygments, which is required by Alectryon anyway.) +## Basic usage+ The simplest way to use this package is to stick the `tryTransform_` function in a compiler for Markdown blog posts: @@ -54,7 +59,30 @@ --- ``` -The compiled `.vo` files must already be present.+The compiled `.vo` files that your post depends on must already be present+(Alectryon will not compile dependencies for you).++You should also add the CSS file from the Alectryon repository (MIT Licensed)+to your blog: `alectryon/assets/alectryon.css`.++### Caution advised for RSS and Atom feeds++If your blog has an RSS or Atom feed, readers might not get the CSS files to+render proof scripts properly.+If your feed follows [the Hakyll tutorial](https://jaspervdj.be/hakyll/tutorials/05-snapshots-feeds.html)+using Hakyll snapshots, you should take a snapshot before running+`Alectryon.tryTransform_`.++```haskell+compile $ do+ (...)+ _ <- saveSnapshot snap (writePandoc doc)+ Alectryon.tryTransform_ doc >>= (...)++{- INSTEAD OF+ Alectryon.tryTransform_ doc >>= (...) >>= saveSnapshot snap >>= (...)+-}+``` ### Modular usage
hakyll-alectryon.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hakyll-alectryon-version: 0.1.1.0+version: 0.1.2.0 synopsis: Hakyll extension for rendering Coq code using Alectryon description: An extension to write Literate Coq blog posts using Hakyll.
src/Hakyll/Alectryon.hs view
@@ -3,6 +3,8 @@ {- | Hakyll extension for rendering Coq code blocks using Alectryon. + See the README for instructions on how to use this module.+ Import this module qualified: > import qualified Hakyll.Alectryon as Alectryon@@ -94,7 +96,7 @@ -- | If the @alectryon@ flag is set, 'transform'. ----- Do nothing if "alectryon" flag is not set.+-- Do nothing if @alectryon@ flag is not set. tryTransform :: Options -> Item Pandoc -> Compiler (Item Pandoc) tryTransform opt idoc = do m <- getMetadata (itemIdentifier idoc)@@ -106,7 +108,7 @@ -- | If the @alectryon@ flag is set, 'transform'. ----- Do nothing if "alectryon" flag is not set.+-- Do nothing if @alectryon@ flag is not set. -- -- This is 'tryTransform' with all options enabled. tryTransform_ :: Item Pandoc -> Compiler (Item Pandoc)@@ -232,7 +234,7 @@ callAlectryon args snippets x = do _ <- readProcess "alectryon"- (["--frontend", "json", "--backend", "snippets-html", "--stdin-filename", "stdin", "-o", snippets, "-"] ++ args)+ (["--frontend", "coq.json", "--backend", "snippets-html", "--stdin-filename", "stdin", "-o", snippets, "-"] ++ args) (Text.unpack x) pure ()