headroom-0.1.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

Provides generic support for the license header templates, represented by the Template type class. Various implementations can be plugged in by creating custom instance of this type class.

Synopsis

Documentation

class Template t where Source #

Type class representing generic license header template support.

Methods

templateExtensions Source #

Arguments

:: proxy t

phantom parameter, not used

-> [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

variables to replace

-> t

parsed template to render

-> m Text

rendered template text

Renders parsed template and replaces all variables.

Instances

Instances details
Template Mustache Source #

Support for Mustache templates.

Instance details

Defined in Headroom.Template.Mustache

Methods

templateExtensions :: proxy Mustache -> [Text] Source #

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

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

loadTemplate Source #

Arguments

:: (MonadIO m, Template t) 
=> FilePath

path to template file

-> m t

loaded and parsed template

Loads and parses template from file.