From 82dca7b1d02f80dbec20f1ded061fd627e109aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 5 Mar 2025 22:15:15 +0100 Subject: [PATCH] Fix doc forms template --- doc/forms_doc_template.md.j2 | 59 ++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/doc/forms_doc_template.md.j2 b/doc/forms_doc_template.md.j2 index e6b00a500a..d455f2e640 100644 --- a/doc/forms_doc_template.md.j2 +++ b/doc/forms_doc_template.md.j2 @@ -14,35 +14,42 @@ Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{{ You may encounter some named types which are used for simplicity. - `Translation`: a translated property - - used for properties: `ask`, `help` and `Pattern.error` - - a `dict` with locales as keys and translations as values: - ```toml - ask.en = "The text in english" - ask.fr = "Le texte en français" - ``` - It is not currently possible for translators to translate those string in weblate. - - a single `str` for a single english default string - ```toml - help = "The text in english" - ``` + - used for properties: `ask`, `help` and `Pattern.error` + - a `dict` with locales as keys and translations as values: + + ```toml + ask.en = "The text in english" + ask.fr = "Le texte en français" + ``` + + It is not currently possible for translators to translate those string in weblate. + + - a single `str` for a single english default string + + ```toml + help = "The text in english" + ``` + - `JSExpression`: a `str` JS expression to be evaluated to `true` or `false`: - - used for properties: `visible` and `enabled` - - operators availables: `==`, `!=`, `>`, `>=`, `<`, `<=`, `!`, `&&`, `||`, `+`, `-`, `*`, `/`, `%` and `match()` + - used for properties: `visible` and `enabled` + - operators availables: `==`, `!=`, `>`, `>=`, `<`, `<=`, `!`, `&&`, `||`, `+`, `-`, `*`, `/`, `%` and `match()` - `Binding`: bind a value to a file/property/variable/getter/setter/validator - - save the value in `settings.yaml` when not defined - - nothing at all with `"null"` - - a custom getter/setter/validator with `"null"` + a function starting with `get__`, `set__`, `validate__` in `scripts/config` - - a variable/property in a file with `:__FINALPATH__/my_file.php` - - a whole file with `__FINALPATH__/my_file.php` + - save the value in `settings.yaml` when not defined + - nothing at all with `"null"` + - a custom getter/setter/validator with `"null"` + a function starting with `get__`, `set__`, `validate__` in `scripts/config` + - a variable/property in a file with `:__FINALPATH__/my_file.php` + - a whole file with `__FINALPATH__/my_file.php` - `Pattern`: a `dict` with a regex to match the value against and an error message - ```toml - pattern.regexp = '^[A-F]\d\d$' - pattern.error = "Provide a room number such as F12: one uppercase and 2 numbers" - # or with translated error - pattern.error.en = "Provide a room number such as F12: one uppercase and 2 numbers" - pattern.error.fr = "Entrez un numéro de salle comme F12: une lettre majuscule et deux chiffres." - ``` - - IMPORTANT: your `pattern.regexp` should be between simple quote, not double. + + ```toml + pattern.regexp = '^[A-F]\d\d$' + pattern.error = "Provide a room number such as F12: one uppercase and 2 numbers" + # or with translated error + pattern.error.en = "Provide a room number such as F12: one uppercase and 2 numbers" + pattern.error.fr = "Entrez un numéro de salle comme F12: une lettre majuscule et deux chiffres." + ``` + + - IMPORTANT: your `pattern.regexp` should be between simple quote, not double. ## Configuration panel structure {% for name, docstring in configpanel.items() %}