hakyll-alectryon-0.1.1.0: Hakyll extension for rendering Coq code using Alectryon

Safe HaskellNone
LanguageHaskell2010

Hakyll.Alectryon

Contents

Description

Hakyll extension for rendering Coq code blocks using Alectryon.

Import this module qualified:

import qualified Hakyll.Alectryon as Alectryon

The main two functions are:

  • tryTransform: transform Pandoc documents, ignoring those where the alectryon field is not set.
  • hakyllWith: extend the Hakyll CLI with an option to enable processing code blocks with Alectryon. This is disabled by default, assuming that the output is already cached.
Synopsis

Transformations

tryTransform :: Options -> Item Pandoc -> Compiler (Item Pandoc) Source #

If the alectryon flag is set, transform.

Do nothing if "alectryon" flag is not set.

tryTransform_ :: Item Pandoc -> Compiler (Item Pandoc) Source #

If the alectryon flag is set, transform.

Do nothing if "alectryon" flag is not set.

This is tryTransform with all options enabled.

transform Source #

Arguments

:: Options 
-> Maybe FilePath

Cache directory location

-> [String]

Alectryon options (e.g., Coq -Q, -R)

-> Pandoc 
-> Compiler Pandoc 

Convert alectryon and coq code blocks to HTML using Alectryon and pygments respectively.

Alectryon and pygments

transformAlectryon Source #

Arguments

:: Options 
-> Maybe FilePath

Cache file location

-> [String]

Alectryon options (e.g., Coq -Q, -R)

-> Pandoc 
-> Compiler Pandoc 

Convert alectryon code blocks to HTML using Alectryon.

transform opt cache args :: Pandoc -> Compiler Pandoc

transformPygments Source #

Arguments

:: Options 
-> Maybe FilePath

Cache file location

-> Pandoc 
-> Compiler Pandoc 

Convert coq code blocks to HTML using pygments.

Options

data Options Source #

Configurations for hakyll-alectryon.

Avoid using the Options constructor directly, prefer record updates on defaultOptions.

Constructors

Options 

Fields

  • runAlectryon :: Bool

    If True, actually process code blocks using Alectryon and Pygments. If False, use the cached output, and fail if the cache is not found (this is to ensure the site is buildable without Alectryon).

  • enableAll :: Bool

    If True, process all posts. If False, process only posts whose metadata contains an alectryon field set to a list.

    That list contains options to pass to the Alectryon executable. It defaults to the empty list if enableAll = True and it is not present in the metadata of a post.

enabledOptions :: Options Source #

Always run Alectryon on all posts.

hakyll :: (Options -> Rules ()) -> IO () Source #

Extend Hakyll with custom parsers

Low-level interface

onCoqBlocks :: b -> (Text -> b) -> Block -> b Source #

onAlectryonBlocks :: b -> (Text -> b) -> Block -> b Source #

onBlocks :: Text -> b -> (Text -> b) -> Block -> b Source #

doRunAlectryon :: Options -> Maybe FilePath -> [String] -> [Text] -> Compiler [Text] Source #

Transform a list of blocks using alectryon.

If the input list is empty, return the empty list immediately, saving an external call.

doRunPygments :: Options -> Maybe FilePath -> [Text] -> Compiler [Text] Source #

Transform a list of blocks using pygments.

If the input list is empty, return the empty list immediately, saving an external call.

name :: Text Source #

"alectryon"

Call Alectryon

splitAlectryonHTML :: Text -> [Text] Source #

Split Alectryon output.

callAlectryon :: [String] -> FilePath -> Text -> IO () Source #

Call the Alectryon executable.

Call Pygments

splitPygmentsHTML :: Text -> [Text] Source #

Split pygments output.

callPygments :: Text -> IO Text Source #

Call the pygments script.