[][src]Crate tp_note

Tp-Note is a note-taking-tool and a template system, that consistently synchronizes the note's meta-data with its filename. tp-note collects various information about its environment and the clipboard and stores them in variables. New notes are created by filling these variables in predefined and customizable Tera-templates. In case <path> points to an existing tp-note-file, the note's meta-data is analysed and, if necessary, its filename is modified. For all other file types, tp-note creates a new note that annotates the file <path> points to. If <path> is a directory (or, when omitted the current working directory), a new note is created in that directory. After creation, tp-note launches an external editor of your choice. Although the note's structure follows pandoc-conventions, it is not tied to any specific Markup language.

Modules

config

Collects tp-note's configuration from a configuration file, the command-line parameters. It also reads the clipboard.

content

Deals with the note's content string.

error

Prints error messages and exceptional states.

filename

Helper funtions that deal with filenames.

filter

Extends the built-in Tera filters.

note

Creates a memory representations of the note by inserting tp-note's environment data in some templates. If the note exists on disk already, the memory representation is established be reading the note-file with its front matter.

sse_server
viewer

Constants

AUTHOR

(c) Jens Getreu

MIN_CONFIG_FILE_VERSION

Set the minimum required config file version that is compatible with this Tp-Note version.

VERSION

Use the version-number defined in ../Cargo.toml.

Functions

create_new_note_or_synchronize_filename

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.

launch_editor

Launch some external editor. The editor can be chosen through tp-note's configuration file.

launch_viewer

Launches a file watcher and Markdown renderer and displays the result in the system's default browser.

main

Print some error message if run() does not complete. Exit prematurely if the configuration file version does not match the programm version.

run

Run Tp-Note and return the (modified) path to the (new) note file.

synchronize_filename

Open the note file path on disk and reads 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 and return the new filename.