Skip to content

v1.25.8

Choose a tag to compare

@getreu getreu released this 24 Apr 16:49
Allow localization schemes

This release comes with a major refactoring of Tp-Note's core, which

* introduces a (type state) state machine providing all templates
  with the variables they need.
* merges the templates: `from_clipboard_*`, `from_yaml_clipboard_*` and
  `from_dir_*` into to the `from_dir_*` templates, which had been generalized
  for that purpose.
* renames the following template variables:

  | before                   | now                    |
  |--------------------------|------------------------|
  | `stdin_header`           | `stdin.header`         |
  | `stdin`                  | `stdin.body`           |
  | `html_clipboard_header`  | `html_clipboard.header`|
  | `html_clipboard`         | `html_clipboard.body`  |
  | `txt_clipboard_header`   | `txt_clipboard.header` |
  | `txt_clipboard`          | `txt_clipboard.body`   |

You can now define "localization" schemes, e.g.:

```toml
[[scheme]]
name = 'Deutsch'
[scheme.tmpl]
fm_var.localization = [
    ["fm_title", "Titel"],
    ["fm_subtitle", "Untertitel"],
    ["fm_author", "Autor"],
    ["fm_date", "Datum"],
    ["fm_lang", "Sprache"],
    ["fm_languages", "Sprachen"],
    ["fm_sort_tag", "Kennzeichen"],
    ["fm_file_ext", "Dateierweiterung"],
    ["fm_no_filename_sync", "Keine_Sync"],
    ["fm_filename_sync", "Dateinamensync"],
    ["fm_scheme", "Schema"],
]
```

To create a now note with the new scheme `Deutsch`, invoke Tp-Note with:

```sh
tpnote --scheme Deutsch
```

To reopen an existing note file written with the new scheme, just add the file
name as usual, e.g. `tpnote '20250123-My note file.md'`.