Copyright | (c) 2019-2021 Vaclav Svejcar |
---|---|
License | BSD-3-Clause |
Maintainer | vaclav.svejcar@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Support for extracting data from Haddock module headers present in Haskell source code files or templates.
Synopsis
- data HaddockModuleHeader = HaddockModuleHeader {}
- extractOffsets :: Template a => a -> HeaderSyntax -> HaddockOffsets
- extractModuleHeader :: SourceCode -> TemplateData -> HeaderSyntax -> HaddockModuleHeader
- indentField :: Maybe Int -> Text -> Text
Documentation
data HaddockModuleHeader Source #
Extracted fields from the Haddock module header.
HaddockModuleHeader | |
|
Instances
Eq HaddockModuleHeader Source # | |
Defined in Headroom.FileSupport.Haskell.Haddock (==) :: HaddockModuleHeader -> HaddockModuleHeader -> Bool # (/=) :: HaddockModuleHeader -> HaddockModuleHeader -> Bool # | |
Show HaddockModuleHeader Source # | |
Defined in Headroom.FileSupport.Haskell.Haddock showsPrec :: Int -> HaddockModuleHeader -> ShowS # show :: HaddockModuleHeader -> String # showList :: [HaddockModuleHeader] -> ShowS # |
:: 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.
:: 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.
:: 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"