hakyll-process: Hakyll compiler for arbitrary external processes.

[ bsd3, library, web ] [ Propose Tags ] [ Report a vulnerability ]

Exposes Hakyll compilers for passing file paths to external processes. Transformed results are made available as Hakyll Items.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.1.0, 0.0.2.0, 0.0.3.0
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), bytestring (>=0.10 && <0.12), hakyll (>=4.12 && <5), typed-process (>=0.2.3 && <0.3) [details]
License BSD-3-Clause
Copyright 2020 Jim McStanton
Author Jim McStanton
Maintainer jim@jhmcstanton.com
Category Web
Home page https://github.com/jhmcstanton/hakyll-process#readme
Source repo head: git clone https://github.com/jhmcstanton/hakyll-process
Uploaded by jhmcstanton at 2021-09-24T15:21:18Z
Distributions NixOS:0.0.3.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 588 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-09-24 [all 1 reports]

Readme for hakyll-process-0.0.3.0

[back to package description]

hakyll-process

Hakyll compilers for passing Hakyll items to external processes. This is useful for tools that do not have Haskell bindings or may not make sense to have Haskell bindings, like Typescript or LaTex compilers.

Common Usage

There are a few main entry points for this library:

  • execCompilerWith is the most common. This allows the caller to declaratively run an external process and includes support for passing arguments.
  • execCompiler is an aliased version of execCompilerWith that provides no arguments to the external executable/process.
  • unsafeExecCompiler is the less type safe and more manual method to calling external executables. This provides no helper functionality but may be useful if you are already manually building out a compiler in your site generator.

Example

This example shows how this library can be used to include latex files in your site source and include the output pdf in your target site.

import qualified Data.ByteString.Lazy.Char8 as B
import           Hakyll.Process

main = do
  hakyll $ do
    match "resume/*.tex" $ do
      route   $ setExtension "pdf"
      compile $ execCompilerWith (execName "xelatex") [ProcArg "-output-directory=resume/", HakFilePath] (newExtOutFilePath "pdf")

    -- alternative, manual method, using unsafeExecCompiler
    match "resume/*.tex" $ do
      route   $ setExtension "pdf"
      compile $ do
        input <- getResourceFilePath
        let outputReader _ = B.readFile (newExtension "pdf" input)
        unsafeExecCompiler (execName "xelatex") ["-output-directory=resume/", input] outputReader