gemoire-1.0.1: yet another static gemlog generator + converter
Copyright(c) 2024 Sena
LicenseGPL-3.0-or-later
Maintainercontact@sena.pink
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Gemoire.Gemlog.Post

Description

Minimal gemlog post parser/formatter and default templates

For posts, the template components are also usable, following the same syntax described in Template. Variables available to the post will be applied while parsing like in templates.

The variables available in a post may change depending on what function parses them. Unless doing heavy customization, see Gemlog for the variables available in the intended use. Otherwise, see each function below.

Additionally, variables can also be set (or overridden) in the post like so, assuming a single variable per line:

{= variable value =}
Synopsis

Parsers

parsePost Source #

Arguments

:: Values

Extra variable overrides

-> Text 
-> Values 

Parses a GemText post into a map of Values to use in templates.

The post content will be evaluated and formatted using template and format before creating the map.

Some special variables are also generated while parsing. Those are:

  • title - The first heading in the document if it exists
  • post - The post content (non-overrideable by the post text)

readPost Source #

Arguments

:: Values

Extra variable overrides

-> FilePath 
-> IO Values 

Reads and parses a GemText post file into a map of Values to use in templates.

See parsePost for how this function works. Everything there applies here as well. This function adds some additional formatting variables, which are:

  • path - The given file path
  • fname - The file name without the extension and the directories
  • modified - File modification date and time (yyyy-mm-ddThh:mm:ss[.ss]±hh:mm)
  • modified_date - File modification date (yyyy-mm-dd)

These variables are not overrideable by the post text.

Templates