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

Headroom.FileSupport.Haskell.Haddock

Description

Support for extracting data from Haddock module headers present in Haskell source code files or templates.

Synopsis

Documentation

data HaddockModuleHeader Source #

Extracted fields from the Haddock module header.

Constructors

HaddockModuleHeader 

Fields

extractOffsets Source #

Arguments

:: Template a 
=> a

parsed template

-> HeaderSyntax

copyright header syntax

-> HaddockOffsets

extracted offsets

Extracts offsets for selected haddock fields (i.e. number of chars between start of line and field value). This is needed to properly format multi-line field values rendered in new license headers.

extractModuleHeader Source #

Arguments

:: SourceCode

source code containing Haddock module header

-> TemplateData

extracted metadata from corresponding template

-> HeaderSyntax

copyright header syntax

-> HaddockModuleHeader

extracted metadata

Extracts metadata from given Haddock module header.

indentField Source #

Arguments

:: Maybe Int

offset (in number of black chars) for 2nd and subsequent lines

-> Text

input text to indent

-> Text

processed text

Adds correct indentation to multi-line Haddock field values. It's usually desired to have such values indented like this:

Copyright        : (c) 2020, 1st Author
                   (c) 2020, 2nd Author

This functions achieves that using the offset value, which specifies number of empty characters that should be placed before second (and any subsequent) line.

>>> indentField (Just 2) "foo\nbar\nbaz"
"foo\n  bar\n  baz"