| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
MathiasSM.Content
Description
Typed views of the content files: posts (front matter) and projects (YAML)
Synopsis
- data Language
- languageCode :: Language -> String
- data Status
- = Alpha
- | Finished
- | Ongoing
- | Unmaintained
- statusName :: Status -> String
- data Post = Post {}
- data Project = Project {}
- data NavEntry = NavEntry {}
- isDraft :: Metadata -> Bool
- aliasesOf :: Metadata -> Either [String] [FilePath]
- parseAliasesYaml :: String -> Either [String] [FilePath]
- parsePost :: Metadata -> Either [String] Post
- parsePostYaml :: String -> Either [String] Post
- parseProject :: Object -> Either [String] Project
- parseProjectYaml :: String -> Either [String] Project
- parseNavEntry :: Metadata -> Either [String] (Maybe NavEntry)
- parseNavYaml :: String -> Either [String] (Maybe NavEntry)
- showcaseKey :: Project -> (Int, Down Day)
- requirePost :: Compiler Post
- requirePostOf :: Identifier -> Compiler Post
- requireLanguage :: Identifier -> Compiler Language
- requireNav :: Identifier -> Compiler (Maybe NavEntry)
- requireProject :: Item String -> Compiler Project
Documentation
Language a page is written in
Instances
| FromJSON Language # | |
Defined in MathiasSM.Content | |
| Bounded Language # | |
| Enum Language # | |
Defined in MathiasSM.Content | |
| Show Language # | |
| Eq Language # | |
languageCode :: Language -> String #
The code used in front matter and in lang attributes
How far along a project is
Constructors
| Alpha | |
| Finished | |
| Ongoing | |
| Unmaintained |
statusName :: Status -> String #
What a post (blog, creative-writing) needs to be published
Constructors
| Post | |
What a showcase project needs to be listed
Constructors
| Project | |
Fields
| |
Constructors
| NavEntry | |
Instances
aliasesOf :: Metadata -> Either [String] [FilePath] #
Old paths an item should redirect from (`aliases: [old]`, or a single `aliases: old`)
Each must be an absolute path other than the home page.
parseAliasesYaml :: String -> Either [String] [FilePath] #
aliasesOf on YAML text (the same shape as front matter)
parsePost :: Metadata -> Either [String] Post #
Parses front matter, reporting every problem (not just the first)
parsePostYaml :: String -> Either [String] Post #
parsePost on YAML text (the same shape as front matter)
parseProject :: Object -> Either [String] Project #
Parses a project, reporting every problem (not just the first)
parseProjectYaml :: String -> Either [String] Project #
parseProject on the contents of a project file
parseNavEntry :: Metadata -> Either [String] (Maybe NavEntry) #
The menu entry a page asks for, if it has a `nav:` label (it then also needs navOrder
and path)
parseNavYaml :: String -> Either [String] (Maybe NavEntry) #
parseNavEntry on YAML text (the same shape as front matter)
showcaseKey :: Project -> (Int, Down Day) #
Sort key for the showcase: projects with a priority first (lowest number
first), then the rest, newest start first
requirePost :: Compiler Post #
Parses the current item's front matter, failing the build with the problems found
requirePostOf :: Identifier -> Compiler Post #
Parses the front matter of any item, failing the build (naming it) with the problems found
requireLanguage :: Identifier -> Compiler Language #
The language of an item, failing the build if it's not a known one
requireNav :: Identifier -> Compiler (Maybe NavEntry) #
The menu entry of any page, failing the build (naming the page) if it's invalid
requireProject :: Item String -> Compiler Project #
Parses a project item (its body is the YAML), failing the build with the problems found