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.
How to integrate this in your text editor code?
First, call create_new_note_or_synchronize_filename()
with the first positional command line parameter <path>.
Then open the text file <Note>.rendered_filename in your
text editor or alternatively, load the string
<Note>.content.as_str() directly into your text editor.
After saving the text file, call synchronize_filename()
and update your file path with <Note>.rendered_filename.
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.