mathiassm
Safe HaskellNone
LanguageGHC2024

MathiasSM.Content

Description

Typed views of the content files: posts (front matter) and projects (YAML)

Synopsis

Documentation

data Language #

Language a page is written in

Constructors

En 
Es 
Jp 

Instances

Instances details
FromJSON Language # 
Instance details

Defined in MathiasSM.Content

Methods

parseJSON :: Value -> Parser Language

parseJSONList :: Value -> Parser [Language]

omittedField :: Maybe Language

Bounded Language # 
Instance details

Defined in MathiasSM.Content

Enum Language # 
Instance details

Defined in MathiasSM.Content

Show Language # 
Instance details

Defined in MathiasSM.Content

Eq Language # 
Instance details

Defined in MathiasSM.Content

languageCode :: Language -> String #

The code used in front matter and in lang attributes

data Status #

How far along a project is

Instances

Instances details
FromJSON Status # 
Instance details

Defined in MathiasSM.Content

Methods

parseJSON :: Value -> Parser Status

parseJSONList :: Value -> Parser [Status]

omittedField :: Maybe Status

Bounded Status # 
Instance details

Defined in MathiasSM.Content

Enum Status # 
Instance details

Defined in MathiasSM.Content

Show Status # 
Instance details

Defined in MathiasSM.Content

Eq Status # 
Instance details

Defined in MathiasSM.Content

Methods

(==) :: Status -> Status -> Bool #

(/=) :: Status -> Status -> Bool #

data Post #

What a post (blog, creative-writing) needs to be published

Instances

Instances details
Show Post # 
Instance details

Defined in MathiasSM.Content

Methods

showsPrec :: Int -> Post -> ShowS #

show :: Post -> String #

showList :: [Post] -> ShowS #

Eq Post # 
Instance details

Defined in MathiasSM.Content

Methods

(==) :: Post -> Post -> Bool #

(/=) :: Post -> Post -> Bool #

data Project #

What a showcase project needs to be listed

Instances

Instances details
Show Project # 
Instance details

Defined in MathiasSM.Content

Eq Project # 
Instance details

Defined in MathiasSM.Content

Methods

(==) :: Project -> Project -> Bool #

(/=) :: Project -> Project -> Bool #

data NavEntry #

A page that appears in the site menu (`nav: label`, `navOrder: n` in its front matter)

Constructors

NavEntry 

Fields

Instances

Instances details
Show NavEntry # 
Instance details

Defined in MathiasSM.Content

Eq NavEntry # 
Instance details

Defined in MathiasSM.Content

isDraft :: Metadata -> Bool #

Whether an item is marked `draft: true`, and so left out of the site

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