Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
The main two functions are:
tryTransform
: transform Pandoc documents, ignoring those where thealectryon
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
- tryTransform :: Options -> Item Pandoc -> Compiler (Item Pandoc)
- tryTransform_ :: Item Pandoc -> Compiler (Item Pandoc)
- transform :: Options -> Maybe FilePath -> [String] -> Pandoc -> Compiler Pandoc
- transformAlectryon :: Options -> Maybe FilePath -> [String] -> Pandoc -> Compiler Pandoc
- transformPygments :: Options -> Maybe FilePath -> Pandoc -> Compiler Pandoc
- data Options = Options {
- runAlectryon :: Bool
- enableAll :: Bool
- defaultOptions :: Options
- enabledOptions :: Options
- hakyll :: (Options -> Rules ()) -> IO ()
- hakyllWith :: Configuration -> (Options -> Rules ()) -> IO ()
- optionParser :: Parser Options
- execParser :: Parser a -> Configuration -> IO (Options, a)
- parserInfo :: Parser a -> Configuration -> ParserInfo (Options, a)
- hakyllWithArgsParser :: Parser a -> Configuration -> (a -> Rules ()) -> IO ()
- updateAlectryonBlocks :: [Text] -> Pandoc -> Pandoc
- updateBlocks :: Text -> [Text] -> Pandoc -> Pandoc
- onCoqBlocks :: b -> (Text -> b) -> Block -> b
- onAlectryonBlocks :: b -> (Text -> b) -> Block -> b
- onBlocks :: Text -> b -> (Text -> b) -> Block -> b
- doRunAlectryon :: Options -> Maybe FilePath -> [String] -> [Text] -> Compiler [Text]
- doRunPygments :: Options -> Maybe FilePath -> [Text] -> Compiler [Text]
- name :: Text
- splitAlectryonHTML :: Text -> [Text]
- callAlectryon :: [String] -> FilePath -> Text -> IO ()
- splitPygmentsHTML :: Text -> [Text]
- callPygments :: Text -> IO Text
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.
:: Options | |
-> Maybe FilePath | Cache directory location |
-> [String] | Alectryon options (e.g., Coq |
-> Pandoc | |
-> Compiler Pandoc |
Convert alectryon
and coq
code blocks to HTML using Alectryon and
pygments respectively.
Alectryon and pygments
:: Options | |
-> Maybe FilePath | Cache file location |
-> [String] | Alectryon options (e.g., Coq |
-> Pandoc | |
-> Compiler Pandoc |
Convert alectryon
code blocks to HTML using Alectryon.
transform opt cache args :: Pandoc -> Compiler Pandoc
Convert coq
code blocks to HTML using pygments.
Options
Configurations for hakyll-alectryon.
Avoid using the Options
constructor directly, prefer record updates on
defaultOptions
.
Options | |
|
enabledOptions :: Options Source #
Always run Alectryon on all posts.
hakyllWith :: Configuration -> (Options -> Rules ()) -> IO () Source #
Extend Hakyll with custom parsers
execParser :: Parser a -> Configuration -> IO (Options, a) Source #
parserInfo :: Parser a -> Configuration -> ParserInfo (Options, a) Source #
hakyllWithArgsParser :: Parser a -> Configuration -> (a -> Rules ()) -> IO () Source #
Low-level interface
onCoqBlocks :: b -> (Text -> b) -> Block -> b Source #
onAlectryonBlocks :: 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.
Call Alectryon
splitAlectryonHTML :: Text -> [Text] Source #
Split Alectryon output.
Call Pygments
splitPygmentsHTML :: Text -> [Text] Source #
Split pygments output.