packages feed

document-build-0.1.0.0: src/Document/Build.hs

{-# OPTIONS_GHC -Wall #-}

{- | Build documents: convert them between formats, get information about
them, and replace strings in them.

The library has four layers:

1. "System.FilePather" (the @filepather@ package): 'FilePather', a
   computation that depends on the file path being operated on, and
   'Tracked', named build steps that record the files they make, so that a
   chain of steps that would go round in a cycle is stopped.
2. "Document.Build.Operations": the canonical document operations, every one
   a 'FilePather' value, such as 'pdfPages', 'markdownToPdf' and 'sha256'.
3. "Document.Build.Context", "Document.Build.Rules" and
   "Document.Build.Documents": the rules that wrap the operations in named
   steps, each with its settings as arguments, the combinators that choose
   the files rules apply to, and 'build', which runs rules over a project.
4. The build file of each project, a cabal script, which gives 'build' the
   directories of the project and its rules:

@
import Document.Build

main :: IO ()
main =
  'build'
    ('Directories' "public" ["src"] Nothing)
    ( 'prepareRules' ["md"] 'filePlaceholders' "src"
        <> 'markdownRules' (flip replaceExtension) [("pdf", pure ["--standalone"])]
        <> 'pageOneRules' (\p -> dropExtension p <> "-1.pdf") (\`replaceExtension\` "png")
    )
@
-}
module Document.Build (
  module Document.Build.Build,
  module Document.Build.Context,
  module Document.Build.Documents,
  module Document.Build.Error,
  module Document.Build.Operations,
  module Document.Build.Output,
  module Document.Build.Project,
  module Document.Build.Rules,
  module System.FilePather,
) where

import Document.Build.Build
import Document.Build.Context
import Document.Build.Documents
import Document.Build.Error
import Document.Build.Operations
import Document.Build.Output
import Document.Build.Project
import Document.Build.Rules
import System.FilePather