Module tpnote_lib::workflow

source ·
Expand description

Tp-Note’s high level API. The low level API is documented in the module tpnote_lib::note.

Functions

Create a new note by inserting Tp-Note’s environment in a template. If the note to be created exists already, append a so called copy_counter to the filename and try to save it again. In case this does not succeed either, increment the copy_counter until a free filename is found. The return path in <Note>.rendered_filename points to the (new) note file on disk. Depending on the context, Tp-Note chooses one TemplateKind to operate (c.f. tpnote_lib::template::TemplateKind::from()). The tk-filter allows to overwrite this choice, e.g. you may set TemplateKind::None under certain circumstances. This way the caller can inject command line parameters like --no-filename-sync.
Open the note file path on disk and read its YAML front matter. Then calculate from the front matter how the filename should be to be in sync. If it is different, rename the note on disk. Returns the note’s new or existing filename in <Note>.rendered_filename.