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

Description

A tiny static gemlog generator

To make a gemlog, you need two essential types of materials: posts and templates.

The template syntax detailed in Template is also usable in posts. The posts processed using this module have some special variables available to them while generating. Those are, including others:

  • title - The first heading in the document if it exists
  • path - The given file path (non-overrideable)
  • 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)
  • url - The permanent link to post (non-overrideable)
  • gemlog - The title of the gemlog (non-overrideable)
  • author - The author of the gemlog (non-overrideable)

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

{= variable value =}

For the templates, see Template. However, as with posts, feeds also have special variables available. Those are, for the feed itself:

  • title - The title of the gemlog
  • author - The author of the gemlog
  • base - The base URL of the gemlog
  • url - The permanent link to the feed
  • entries - The formatted entries

For each entry in the feed, every variable the post associated with the entry has is available.

See the README.md for a roughly step-by-step guide.

Synopsis

Gemlog generation

data Gemlog Source #

A gemlog recipe to generate files for

Constructors

Gemlog 

Fields

Instances

Instances details
Show Gemlog Source # 
Instance details

Defined in Gemoire.Gemlog

Eq Gemlog Source # 
Instance details

Defined in Gemoire.Gemlog

Methods

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

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

generatePosts :: Gemlog -> FilePath -> IO () Source #

Generates and writes all the posts in the given Gemlog to the given directory.

The output directory is flat and the structure of the source is never retained.

See the module description for the variables available in the post.

generateGemfeed :: Gemlog -> FilePath -> IO () Source #

Generates a gemfeed in the given path.

See the module description for the variables available in the feed.

If the given path is a directory, the feed file will be named index.gmi by default.

The entries are sorted by last modified in the feed. Every variable in the post is available in its respective entry. See generatePosts above.

generateAtom :: Gemlog -> FilePath -> IO () Source #

Generates an feed Atom in the given path.

See the module description for the variables available in the feed.

If the given path is a directory, the feed file will be named atom.xml by default.

The entries are sorted by last modified in the feed. Every variable in the post is available in its respective entry. See generatePosts above.

Additionally, every variable is escaped to make the XML valid. Variables ending with url are escaped using percent encodings for URLs instead of ampersand. See escapeAtom.

Re-exports