Copyright | (c) 2024 Sena |
---|---|
License | GPL-3.0-or-later |
Maintainer | contact@sena.pink |
Stability | stable |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Gemoire.Gemlog
Contents
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 existspath
- The given file path (non-overrideable)fname
- The file name without the extension and the directoriesmodified
- 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 gemlogauthor
- The author of the gemlogbase
- The base URL of the gemlogurl
- The permanent link to the feedentries
- 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
- data Gemlog = Gemlog {}
- generatePosts :: Gemlog -> FilePath -> IO ()
- generateGemfeed :: Gemlog -> FilePath -> IO ()
- generateAtom :: Gemlog -> FilePath -> IO ()
- defPost :: Template
- defGemfeed :: Template
- defGemfeedEntry :: Template
- defAtom :: Template
- defAtomEntry :: Template
Gemlog generation
A gemlog recipe to generate files for
Constructors
Gemlog | |
Fields
|
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
.