libdenote added (not used yet)

This commit is contained in:
2026-03-02 16:50:09 +01:00
parent c3ed08e42f
commit 2270ab9069
2 changed files with 268 additions and 7 deletions

View File

@@ -7,13 +7,19 @@ This is the documentation for the denote plugin.
==============================================================================
CONTENTS *vim-denote* *denote*
1. Introduction |denote-intro|
2. Commands |denote-commands|
2.1 Universal commands |denote-universal-commands|
2.2 Note command |denote-note-command|
2.3 Denote-list commands |denote-list-commands|
3. Settings |denote-settings|
4. Keys |denote-keys|
1. Introduction |denote-intro|
2. Commands |denote-commands|
2.1 Universal commands |denote-universal-commands|
2.2 Note command |denote-note-command|
2.3 Denote-list commands |denote-list-commands|
3. Settings |denote-settings|
4. Keys |denote-keys|
Appendices
A. The libdenote plugin |libdenote|
A.1 File-naming functions |libdentoe-filenaming|
A.2 Front-matter functions |libdenote-frontmatter|
B. Package API |denote-api|
==============================================================================
INTRODUCTION *denote-intro*
@@ -245,4 +251,64 @@ dd Delete the selected entry.
{Visual}d Delete the visually selected entries.
==============================================================================
APPENDIX A - THE LIBDENOTE PLUGIN *libdenote*
The present package has as constituent the libdenote plugin for basic
denote-centered operations. That plugin is given by the file
autoload/libdenote.vim. Each function in this plugin is pure, i.e., produces
no side effects. There are two classes of functions: functions concerning the
file-naming scheme (prefixed with scheme_, see |libdenote-filenaming|) and
functions concerning the front matter (prefixed with fmt_, see
|libdenote-frontmatter|).
*libdenote-filenaming*
File-naming functions~
*libdenote#scheme_idgen()*
libdenote#scheme_idgen()
This function generates a new identifier. If the function |strftime()|
is available, than strftime(%Y%m%dT%H%M%S) is used, otherwise a random
identifier is generated using |rand()|.
*libdenote#scheme_filename()*
libdenote#scheme_filename({ext}, {id}, {title}, {tags}, {sig})
With this, the file name of the denote entry with the given metadata
is returned. The parameter {ext} describes the extension of the file
is is one of 'md', 'txt', or 'org'. The parameter {id} is the denote
identifier, possibly generated via |libdenote#scheme_idgen()|. The
{title} parameter is optional and describes the title of the note. By
default, it is set to the empty string ''. The {tags} parameter is
optional as well, is a list of tags associated to the note. The
default value is the empty list []. Also, the {sig} parameter is
optional, and used to describe the signature of the entry.
*libdenote#scheme_metadata()*
libdenote#scheme_metadata({filename})
This function returns the metadata of the file given by {filename}.
This parameter may describe the path to the file, or the tail only.
The returned |dict| has the keys 'id' for the identifier, 'title' for
the title, 'tags' for the list of tags, and 'sig' for the signature.
*libdenote-frontmatter*
Front-matter functions~
*libdenote#fm_gen()*
libdenote#fm_gen({ext}, {id}, {title}, {tags}, {md_type})
This function returns the list of lines for the front matter that
stores the given metadata. The paramter {ext} is the extension of the
file, the parameter {id} the identifier, the parameter {title}, the
title of the note, and {tags} the optional parameter as a list of tags
associated to the note. Per default {tags} is set to the empty list
[]. Finally, {md_type} descries the format to be used in markdown. For
markdown files (extension 'md'), two formats are possible: 'yaml' and
'toml'. The former format is used per default.
*libdenote#fm_alter()*
libdenote#fm_alter({fm}, {ext}, {id}, {title}, {tags}, {md_type})
Similar to |libdenote#fm_gen()|, this function returns a list
containing the lines of a front matter. In contrast to the above
function, this functions takes a front matter {fm} as base (again,
given as list of lines), and alters the title or tags associated with
the note. The arguments {title} and {tags} are optional. When set,
then {fm} is returned with the corresponding replaced lines.
vim:tw=78:sw=4:ts=8:noet:ft=help:norl: