| Copyright | (c) 2021-2022 Mirko Westermeier |
|---|---|
| License | MIT |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
HTMell.Content
Description
HTMell content related types and functions
Synopsis
- class HTMellContent c where
- newtype RawHTMLContent = RawHTMLContent Text
The content type class
class HTMellContent c where #
Content stored in HTree trees. Instances must provide
a function to read content from filesystem and extract metadata and HTML
from a content value.
Methods
getContent :: FilePath -> IO (Maybe c) #
Extract content from a given file. The instance can ignore the file
with Nothing, for example if it has the wrong extension.
metadata :: c -> Map String String #
Extract metadata from a given content value.
Extract plain HTML Text from a given content value.
Instances
| HTMellContent RawHTMLContent # | |
Defined in HTMell.Content Methods getContent :: FilePath -> IO (Maybe RawHTMLContent) # metadata :: RawHTMLContent -> Map String String # toHTML :: RawHTMLContent -> Text # | |
| HTMellContent MarkdownContent # | |
Defined in HTMell.Content.Markdown Methods getContent :: FilePath -> IO (Maybe MarkdownContent) # metadata :: MarkdownContent -> Map String String # toHTML :: MarkdownContent -> Text # | |
| HTMellContent PseudoContent # | |
Defined in HTMell.Util Methods getContent :: FilePath -> IO (Maybe PseudoContent) # metadata :: PseudoContent -> Map String String # toHTML :: PseudoContent -> Text # | |
Predefined content types
newtype RawHTMLContent #
The simplest possible useful content type as the extracted HTML via
toHTMLis just the file content. Ignores files that have no ".html"
extension and extracts an empty metadata Map via metadata.
Constructors
| RawHTMLContent Text |
Instances
| Eq RawHTMLContent # | |
Defined in HTMell.Content Methods (==) :: RawHTMLContent -> RawHTMLContent -> Bool # (/=) :: RawHTMLContent -> RawHTMLContent -> Bool # | |
| Show RawHTMLContent # | |
Defined in HTMell.Content Methods showsPrec :: Int -> RawHTMLContent -> ShowS # show :: RawHTMLContent -> String # showList :: [RawHTMLContent] -> ShowS # | |
| HTMellContent RawHTMLContent # | |
Defined in HTMell.Content Methods getContent :: FilePath -> IO (Maybe RawHTMLContent) # metadata :: RawHTMLContent -> Map String String # toHTML :: RawHTMLContent -> Text # | |