| Copyright | (c) 2019-2021 Vaclav Svejcar |
|---|---|
| License | BSD-3-Clause |
| Maintainer | vaclav.svejcar@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Headroom.Template.TemplateRef
Description
TemplateRef data type represents reference to template file, either local or
remote, which can be later opened/downloaded and parsed into template.
Synopsis
Data Types
data TemplateRef Source #
Reference to the template (e.g. local file, URI address).
Constructors
| InlineRef Text | |
| LocalTemplateRef FilePath | template path on local file system |
| UriTemplateRef URI | remote template URI adress |
| BuiltInRef LicenseType FileType |
Instances
| Eq TemplateRef Source # | |
Defined in Headroom.Template.TemplateRef | |
| Ord TemplateRef Source # | |
Defined in Headroom.Template.TemplateRef Methods compare :: TemplateRef -> TemplateRef -> Ordering # (<) :: TemplateRef -> TemplateRef -> Bool # (<=) :: TemplateRef -> TemplateRef -> Bool # (>) :: TemplateRef -> TemplateRef -> Bool # (>=) :: TemplateRef -> TemplateRef -> Bool # max :: TemplateRef -> TemplateRef -> TemplateRef # min :: TemplateRef -> TemplateRef -> TemplateRef # | |
| Show TemplateRef Source # | |
Defined in Headroom.Template.TemplateRef Methods showsPrec :: Int -> TemplateRef -> ShowS # show :: TemplateRef -> String # showList :: [TemplateRef] -> ShowS # | |
| FromJSON TemplateRef Source # | |
Defined in Headroom.Template.TemplateRef | |
Constructor Functions
Arguments
| :: MonadThrow m | |
| => Text | input text |
| -> m TemplateRef | created |
Creates a TemplateRef from given text. If the raw text appears to be
valid URL with either http or https as protocol, it considers it as
UriTemplateRef, otherwise it creates LocalTemplateRef.
>>>mkTemplateRef "/path/to/haskell.mustache" :: Maybe TemplateRefJust (LocalTemplateRef "/path/to/haskell.mustache")
>>>mkTemplateRef "https://foo.bar/haskell.mustache" :: Maybe TemplateRefJust (UriTemplateRef (URI {uriScheme = Just "https", uriAuthority = Right (Authority {authUserInfo = Nothing, authHost = "foo.bar", authPort = Nothing}), uriPath = Just (False,"haskell.mustache" :| []), uriQuery = [], uriFragment = Nothing}))
Public Functions
Arguments
| :: TemplateRef |
|
| -> Text | rendered text |
Renders given TemplateRef into human-friendly text.
Error Types
data TemplateRefError Source #
Error related to template references.
Constructors
| UnrecognizedTemplateName Text | not a valid format for template name |
| UnsupportedUriProtocol Text Text | URI protocol not supported |
Instances
| Eq TemplateRefError Source # | |
Defined in Headroom.Template.TemplateRef Methods (==) :: TemplateRefError -> TemplateRefError -> Bool # (/=) :: TemplateRefError -> TemplateRefError -> Bool # | |
| Show TemplateRefError Source # | |
Defined in Headroom.Template.TemplateRef Methods showsPrec :: Int -> TemplateRefError -> ShowS # show :: TemplateRefError -> String # showList :: [TemplateRefError] -> ShowS # | |
| Exception TemplateRefError Source # | |
Defined in Headroom.Template.TemplateRef Methods toException :: TemplateRefError -> SomeException # | |