headroom-0.2.1.0: License Header Manager
Copyright(c) 2019-2020 Vaclav Svejcar
LicenseBSD-3
Maintainervaclav.svejcar@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Headroom.Template

Description

Module providing generic representation of supported template type, using the Template type class.

Synopsis

Documentation

class Template t where Source #

Type class representing generic license header template support.

Methods

templateExtensions Source #

Arguments

:: NonEmpty Text

list of supported file extensions

Returns list of supported file extensions for this template type.

parseTemplate Source #

Arguments

:: MonadThrow m 
=> Maybe Text

name of the template (optional)

-> Text

raw template text

-> m t

parsed template

Parses template from given raw text.

renderTemplate Source #

Arguments

:: MonadThrow m 
=> HashMap Text Text

values of variables to replace

-> t

parsed template to render

-> m Text

rendered template text

Renders parsed template and replaces all variables with actual values.

Instances

Instances details
Template Mustache Source #

Support for Mustache templates.

Instance details

Defined in Headroom.Template.Mustache

Methods

templateExtensions :: NonEmpty Text Source #

parseTemplate :: MonadThrow m => Maybe Text -> Text -> m Mustache Source #

renderTemplate :: MonadThrow m => HashMap Text Text -> Mustache -> m Text Source #