Templates

Templates are implemented using the excellent etlua package.

Files

Each template set is a pair of files; marker and main.etlua.

marker

The marker file contains a “magic” string, that is used to find the location in the NEWS file to insert new entries.

It is matched with lua‘s string.match function, and should be as tight as possible to prevent false matches. The default template’s marker is %.%. contents:: which matches a reST table of contents directive.

main.etlua

The main.etlua file is the template that is used to generate the header and individual entries for the NEWS file.

It is provided with the following data:

Variable Description
date The data provided by the user with the histofile update --date option.
entries The new entries to add to the output.
old_entries The previously existing data in the NEWS file.
version The version provided by the user with the version argument.

The following formatting functions are provided for convenience:

Function Description
stylise() Basic terminal formatting support
wrap_entry() A simple line wrapper for text inputs

Along with the following variables for formatting output:

Variable Type Description
bg string indexed table Colours to set terminal background.
bold string Set terminal to bold
fg string indexed table Colours to set terminal foreground.
form_feed string Force a form feed
reset string Reset terminal formatting
underline string et terminal to underline