packages feed

casa-reoc-0.1.0.0: src/ReOC/Render/OperationsManual.hs

{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -Wall #-}

{- | The RPAS operations manual of a 'ReOC', as Flat ODF text.

The manual is the template @template/rpas-operations-manual.fodt@, read when
the package is compiled, with each hole filled from the value (see
"ReOC.Render.OperationsManual.Holes"). The placeholders of the document
build, @${CI_COMMIT_SHA}@ and @${CI_PAGES_URL}@, are kept, so that each build
gives the version it was built from.
-}
module ReOC.Render.OperationsManual (
  renderOperationsManual,
) where

import Data.Text (Text)
import qualified Data.Text as Text
import ReOC.Data.ReOC (ReOC)
import ReOC.Render.OperationsManual.Holes
import ReOC.Render.Template (embedTemplate)

template :: [Either Text (ReOC -> Text)]
template =
  $(embedTemplate "template/rpas-operations-manual.fodt")

-- | The operations manual, as Flat ODF text.
renderOperationsManual :: ReOC -> Text
renderOperationsManual r =
  Text.concat (map (either id ($ r)) template)