fix: doc for param

This commit is contained in:
egarette@silique.fr 2025-03-29 14:37:45 +01:00
parent fd54b9ca00
commit 5c9c102245
6 changed files with 101 additions and 90 deletions
locale
src/rougail/output_doc
tests

View file

@ -5,8 +5,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"POT-Creation-Date: 2025-03-02 13:36+0100\n" "POT-Creation-Date: 2025-03-29 10:48+0100\n"
"PO-Revision-Date: 2025-03-02 13:37+0100\n" "PO-Revision-Date: 2025-03-29 12:15+0100\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: fr\n" "Language: fr\n"
@ -16,27 +16,27 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.5\n" "X-Generator: Poedit 3.5\n"
#: src/rougail/output_doc/annotator.py:288 #: src/rougail/output_doc/annotator.py:294
msgid "when the variable \"{0}\" hasn't the value \"{1}\"" msgid "when the variable \"{0}\" hasn't the value \"{1}\""
msgstr "lorsque la variable \"{0}\" n'a pas la valeur \"{1}\"" msgstr "lorsque la variable \"{0}\" n'a pas la valeur \"{1}\""
#: src/rougail/output_doc/annotator.py:294 #: src/rougail/output_doc/annotator.py:300
msgid "when the variable \"{0}\" has the value \"{1}\"" msgid "when the variable \"{0}\" has the value \"{1}\""
msgstr "lorsque la variable \"{0}\" a la valeur \"{1}\"" msgstr "lorsque la variable \"{0}\" a la valeur \"{1}\""
#: src/rougail/output_doc/annotator.py:310 #: src/rougail/output_doc/annotator.py:316
msgid "the value of the information \"{0}\" of the variable \"{1}\"" msgid "the value of the information \"{0}\" of the variable \"{1}\""
msgstr "la valeur de l'information \"{0}\" de la variable \"{1}\"" msgstr "la valeur de l'information \"{0}\" de la variable \"{1}\""
#: src/rougail/output_doc/annotator.py:313 #: src/rougail/output_doc/annotator.py:319
msgid "the value of the global information \"{0}\"" msgid "the value of the global information \"{0}\""
msgstr "la valeur de l'information globale \"{0}\"" msgstr "la valeur de l'information globale \"{0}\""
#: src/rougail/output_doc/annotator.py:320 #: src/rougail/output_doc/annotator.py:326
msgid "when the identifier is \"{0}\"" msgid "when the identifier is \"{0}\""
msgstr "lorsque l'identifiant est \"{0}\"" msgstr "lorsque l'identifiant est \"{0}\""
#: src/rougail/output_doc/annotator.py:322 #: src/rougail/output_doc/annotator.py:328
msgid "when the identifier is not \"{0}\"" msgid "when the identifier is not \"{0}\""
msgstr "lorsque l'identifiant n'est pas \"{0}\"" msgstr "lorsque l'identifiant n'est pas \"{0}\""
@ -52,35 +52,35 @@ msgstr "Configuration de rougail-doc"
msgid "Starting title level" msgid "Starting title level"
msgstr "Niveau de titre de départ" msgstr "Niveau de titre de départ"
#: src/rougail/output_doc/config.py:86 #: src/rougail/output_doc/config.py:87
msgid "Generate example" msgid "Generate example"
msgstr "Génération de l'exemple" msgstr "Génération de l'exemple"
#: src/rougail/output_doc/config.py:87 #: src/rougail/output_doc/config.py:88
msgid "Generate documentation" msgid "Generate documentation"
msgstr "Générer de la documentation" msgstr "Générer de la documentation"
#: src/rougail/output_doc/config.py:91 #: src/rougail/output_doc/config.py:93
msgid "Do not add families in documentation" msgid "Do not add families in documentation"
msgstr "Ne pas ajouter les familles dans la documentation" msgstr "Ne pas ajouter les familles dans la documentation"
#: src/rougail/output_doc/config.py:92 #: src/rougail/output_doc/config.py:94
msgid "Add families in documentation" msgid "Add families in documentation"
msgstr "Ajouter les familles dans la documentation" msgstr "Ajouter les familles dans la documentation"
#: src/rougail/output_doc/config.py:95 #: src/rougail/output_doc/config.py:98
msgid "Disable documentation for variables with those modes" msgid "Disable documentation for variables with those modes"
msgstr "Désactiver la documentation des variables avec ces modes" msgstr "Désactiver la documentation des variables avec ces modes"
#: src/rougail/output_doc/config.py:103 #: src/rougail/output_doc/config.py:106
msgid "disabled when there is no mode available" msgid "disabled when there is no mode available"
msgstr "désactiver lorsqu'il n'y a pas de mode valable" msgstr "désactiver lorsqu'il n'y a pas de mode valable"
#: src/rougail/output_doc/config.py:109 #: src/rougail/output_doc/config.py:112
msgid "verify if disable modes already exists" msgid "verify if disable modes already exists"
msgstr "vérifier le mode existe déjà" msgstr "vérifier le mode existe déjà"
#: src/rougail/output_doc/config.py:111 #: src/rougail/output_doc/config.py:115
msgid "Generate document in format" msgid "Generate document in format"
msgstr "Générer le document au format" msgstr "Générer le document au format"
@ -120,19 +120,19 @@ msgstr "multiple"
msgid "No attribute \"description\" for \"{0}\" in {1}" msgid "No attribute \"description\" for \"{0}\" in {1}"
msgstr "Aucun attribut \"description\" pour \"{0}\" dans {1}" msgstr "Aucun attribut \"description\" pour \"{0}\" dans {1}"
#: src/rougail/output_doc/doc.py:461 #: src/rougail/output_doc/doc.py:463
msgid "(default)" msgid "(default)"
msgstr "(défaut)" msgstr "(défaut)"
#: src/rougail/output_doc/doc.py:468 #: src/rougail/output_doc/doc.py:470
msgid "text based with regular expressions \"{0}\"" msgid "text based with regular expressions \"{0}\""
msgstr "texte avec expression rationnelle \"{0}\"" msgstr "texte avec expression rationnelle \"{0}\""
#: src/rougail/output_doc/doc.py:556 #: src/rougail/output_doc/doc.py:558
msgid "depends on a calculation" msgid "depends on a calculation"
msgstr "dépend d'un calcul" msgstr "dépend d'un calcul"
#: src/rougail/output_doc/doc.py:557 #: src/rougail/output_doc/doc.py:559
msgid "\"{0}\" is a calculation for {1} but has no description in {2}" msgid "\"{0}\" is a calculation for {1} but has no description in {2}"
msgstr "\"{0}\" est un calcul pour {1} mais n'a pas de description dans {2}" msgstr "\"{0}\" est un calcul pour {1} mais n'a pas de description dans {2}"
@ -144,15 +144,15 @@ msgstr "la valeur de la variable \"{0}\""
msgid "the value of an undocumented variable" msgid "the value of an undocumented variable"
msgstr "la valeur d'une variable non documentée" msgstr "la valeur d'une variable non documentée"
#: src/rougail/output_doc/doc.py:598 #: src/rougail/output_doc/doc.py:597
msgid "the values of undocumented variables" msgid "the values of undocumented variables"
msgstr "les valeurs de variables non documentées" msgstr "les valeurs de variables non documentées"
#: src/rougail/output_doc/doc.py:605 #: src/rougail/output_doc/doc.py:604
msgid "the value of the identifier" msgid "the value of the identifier"
msgstr "la valeur de l'identifiant" msgstr "la valeur de l'identifiant"
#: src/rougail/output_doc/doc.py:609 #: src/rougail/output_doc/doc.py:608
msgid "the value of the {0}" msgid "the value of the {0}"
msgstr "la valeur de l'{0}" msgstr "la valeur de l'{0}"
@ -166,7 +166,7 @@ msgstr "Exemple avec toutes les variables modifiable"
#: src/rougail/output_doc/utils.py:41 #: src/rougail/output_doc/utils.py:41
msgid "the domain name can starts by a dot" msgid "the domain name can starts by a dot"
msgstr "le nom de domaine peut commencé par un point" msgstr "le nom de domaine peut commencer par un point"
#: src/rougail/output_doc/utils.py:42 #: src/rougail/output_doc/utils.py:42
msgid "the domain name can be a hostname" msgid "the domain name can be a hostname"
@ -225,66 +225,70 @@ msgid "port 0 is allowed"
msgstr "le port 0 est autorisé" msgstr "le port 0 est autorisé"
#: src/rougail/output_doc/utils.py:79 #: src/rougail/output_doc/utils.py:79
msgid "ports 1 to 1023 are allowed" msgid "well-known ports (1 to 1023) are allowed"
msgstr "les ports entre 1 et 1023 sont autorisés" msgstr "les ports connus (de 1 à 1023) sont autorisés"
#: src/rougail/output_doc/utils.py:80 #: src/rougail/output_doc/utils.py:80
msgid "ports 1024 to 49151 are allowed" msgid "registred ports (1024 to 49151) are allowed"
msgstr "les ports entre 1024 et 49151 sont autorisés" msgstr "les ports enregistrés (de 1024 à 49151) sont autorisés"
#: src/rougail/output_doc/utils.py:81 #: src/rougail/output_doc/utils.py:81
msgid "ports greater than 49152 are allowed" msgid "private ports (greater than 49152) are allowed"
msgstr "les ports supérieurs à 49152 sont autorisés" msgstr "les ports privés (supérieurs à 49152) sont autorisés"
#: src/rougail/output_doc/utils.py:86 #: src/rougail/output_doc/utils.py:86
msgid "minimum length for the secret" msgid "minimum length for the secret is {0} characters"
msgstr "longueur minimum pour un secret" msgstr "longueur minimum pour le secret est de {0} caractères"
#: src/rougail/output_doc/utils.py:87 #: src/rougail/output_doc/utils.py:87
msgid "maximum length for the secret" msgid "maximum length for the secret is {0} characters"
msgstr "longueur maximal pour un secret" msgstr "longueur maximal pour le secret est de {0} caractères"
#: src/rougail/output_doc/utils.py:232 #: src/rougail/output_doc/utils.py:88
msgid "forbidden characters are {0}"
msgstr "caractères interdits sont {0}"
#: src/rougail/output_doc/utils.py:233
msgid "Variables for \"{0}\"" msgid "Variables for \"{0}\""
msgstr "Variables pour \"{0}\"" msgstr "Variables pour \"{0}\""
#: src/rougail/output_doc/utils.py:248 #: src/rougail/output_doc/utils.py:249
msgid "Identifiers" msgid "Identifiers"
msgstr "Identifiants" msgstr "Identifiants"
#: src/rougail/output_doc/utils.py:313 #: src/rougail/output_doc/utils.py:314
msgid "Validator" msgid "Validator"
msgstr "Validateur" msgstr "Validateur"
#: src/rougail/output_doc/utils.py:315 #: src/rougail/output_doc/utils.py:316
msgid "Validators" msgid "Validators"
msgstr "Validateurs" msgstr "Validateurs"
#: src/rougail/output_doc/utils.py:317 #: src/rougail/output_doc/utils.py:318
msgid "Choices" msgid "Choices"
msgstr "Choix" msgstr "Choix"
#: src/rougail/output_doc/utils.py:319 #: src/rougail/output_doc/utils.py:320
msgid "Default" msgid "Default"
msgstr "Défaut" msgstr "Défaut"
#: src/rougail/output_doc/utils.py:323 #: src/rougail/output_doc/utils.py:324
msgid "Example" msgid "Example"
msgstr "Exemple" msgstr "Exemple"
#: src/rougail/output_doc/utils.py:325 #: src/rougail/output_doc/utils.py:326
msgid "Examples" msgid "Examples"
msgstr "Exemples" msgstr "Exemples"
#: src/rougail/output_doc/utils.py:365 #: src/rougail/output_doc/utils.py:366
msgid "Description" msgid "Description"
msgstr "Description" msgstr "Description"
#: src/rougail/output_doc/utils.py:365 #: src/rougail/output_doc/utils.py:366
msgid "Variable" msgid "Variable"
msgstr "Variable" msgstr "Variable"
#: src/rougail/output_doc/utils.py:386 #: src/rougail/output_doc/utils.py:387
msgid "{0}: {1}" msgid "{0}: {1}"
msgstr "{0} : {1}" msgstr "{0} : {1}"

View file

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-03-02 13:37+0100\n" "POT-Creation-Date: 2025-03-29 10:48+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -15,27 +15,27 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
#: src/rougail/output_doc/annotator.py:288 #: src/rougail/output_doc/annotator.py:294
msgid "when the variable \"{0}\" hasn't the value \"{1}\"" msgid "when the variable \"{0}\" hasn't the value \"{1}\""
msgstr "" msgstr ""
#: src/rougail/output_doc/annotator.py:294 #: src/rougail/output_doc/annotator.py:300
msgid "when the variable \"{0}\" has the value \"{1}\"" msgid "when the variable \"{0}\" has the value \"{1}\""
msgstr "" msgstr ""
#: src/rougail/output_doc/annotator.py:310 #: src/rougail/output_doc/annotator.py:316
msgid "the value of the information \"{0}\" of the variable \"{1}\"" msgid "the value of the information \"{0}\" of the variable \"{1}\""
msgstr "" msgstr ""
#: src/rougail/output_doc/annotator.py:313 #: src/rougail/output_doc/annotator.py:319
msgid "the value of the global information \"{0}\"" msgid "the value of the global information \"{0}\""
msgstr "" msgstr ""
#: src/rougail/output_doc/annotator.py:320 #: src/rougail/output_doc/annotator.py:326
msgid "when the identifier is \"{0}\"" msgid "when the identifier is \"{0}\""
msgstr "" msgstr ""
#: src/rougail/output_doc/annotator.py:322 #: src/rougail/output_doc/annotator.py:328
msgid "when the identifier is not \"{0}\"" msgid "when the identifier is not \"{0}\""
msgstr "" msgstr ""
@ -51,35 +51,35 @@ msgstr ""
msgid "Starting title level" msgid "Starting title level"
msgstr "" msgstr ""
#: src/rougail/output_doc/config.py:86 #: src/rougail/output_doc/config.py:87
msgid "Generate example" msgid "Generate example"
msgstr "" msgstr ""
#: src/rougail/output_doc/config.py:87 #: src/rougail/output_doc/config.py:88
msgid "Generate documentation" msgid "Generate documentation"
msgstr "" msgstr ""
#: src/rougail/output_doc/config.py:91 #: src/rougail/output_doc/config.py:93
msgid "Do not add families in documentation" msgid "Do not add families in documentation"
msgstr "" msgstr ""
#: src/rougail/output_doc/config.py:92 #: src/rougail/output_doc/config.py:94
msgid "Add families in documentation" msgid "Add families in documentation"
msgstr "" msgstr ""
#: src/rougail/output_doc/config.py:95 #: src/rougail/output_doc/config.py:98
msgid "Disable documentation for variables with those modes" msgid "Disable documentation for variables with those modes"
msgstr "" msgstr ""
#: src/rougail/output_doc/config.py:103 #: src/rougail/output_doc/config.py:106
msgid "disabled when there is no mode available" msgid "disabled when there is no mode available"
msgstr "" msgstr ""
#: src/rougail/output_doc/config.py:109 #: src/rougail/output_doc/config.py:112
msgid "verify if disable modes already exists" msgid "verify if disable modes already exists"
msgstr "" msgstr ""
#: src/rougail/output_doc/config.py:111 #: src/rougail/output_doc/config.py:115
msgid "Generate document in format" msgid "Generate document in format"
msgstr "" msgstr ""
@ -119,19 +119,19 @@ msgstr ""
msgid "No attribute \"description\" for \"{0}\" in {1}" msgid "No attribute \"description\" for \"{0}\" in {1}"
msgstr "" msgstr ""
#: src/rougail/output_doc/doc.py:461 #: src/rougail/output_doc/doc.py:463
msgid "(default)" msgid "(default)"
msgstr "" msgstr ""
#: src/rougail/output_doc/doc.py:468 #: src/rougail/output_doc/doc.py:470
msgid "text based with regular expressions \"{0}\"" msgid "text based with regular expressions \"{0}\""
msgstr "" msgstr ""
#: src/rougail/output_doc/doc.py:556 #: src/rougail/output_doc/doc.py:558
msgid "depends on a calculation" msgid "depends on a calculation"
msgstr "" msgstr ""
#: src/rougail/output_doc/doc.py:557 #: src/rougail/output_doc/doc.py:559
msgid "\"{0}\" is a calculation for {1} but has no description in {2}" msgid "\"{0}\" is a calculation for {1} but has no description in {2}"
msgstr "" msgstr ""
@ -143,15 +143,15 @@ msgstr ""
msgid "the value of an undocumented variable" msgid "the value of an undocumented variable"
msgstr "" msgstr ""
#: src/rougail/output_doc/doc.py:598 #: src/rougail/output_doc/doc.py:597
msgid "the values of undocumented variables" msgid "the values of undocumented variables"
msgstr "" msgstr ""
#: src/rougail/output_doc/doc.py:605 #: src/rougail/output_doc/doc.py:604
msgid "the value of the identifier" msgid "the value of the identifier"
msgstr "" msgstr ""
#: src/rougail/output_doc/doc.py:609 #: src/rougail/output_doc/doc.py:608
msgid "the value of the {0}" msgid "the value of the {0}"
msgstr "" msgstr ""
@ -224,66 +224,70 @@ msgid "port 0 is allowed"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:79 #: src/rougail/output_doc/utils.py:79
msgid "ports 1 to 1023 are allowed" msgid "well-known ports (1 to 1023) are allowed"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:80 #: src/rougail/output_doc/utils.py:80
msgid "ports 1024 to 49151 are allowed" msgid "registred ports (1024 to 49151) are allowed"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:81 #: src/rougail/output_doc/utils.py:81
msgid "ports greater than 49152 are allowed" msgid "private ports (greater than 49152) are allowed"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:86 #: src/rougail/output_doc/utils.py:86
msgid "minimum length for the secret" msgid "minimum length for the secret is {0} characters"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:87 #: src/rougail/output_doc/utils.py:87
msgid "maximum length for the secret" msgid "maximum length for the secret is {0} characters"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:232 #: src/rougail/output_doc/utils.py:88
msgid "forbidden characters are {0}"
msgstr ""
#: src/rougail/output_doc/utils.py:233
msgid "Variables for \"{0}\"" msgid "Variables for \"{0}\""
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:248 #: src/rougail/output_doc/utils.py:249
msgid "Identifiers" msgid "Identifiers"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:313 #: src/rougail/output_doc/utils.py:314
msgid "Validator" msgid "Validator"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:315 #: src/rougail/output_doc/utils.py:316
msgid "Validators" msgid "Validators"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:317 #: src/rougail/output_doc/utils.py:318
msgid "Choices" msgid "Choices"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:319 #: src/rougail/output_doc/utils.py:320
msgid "Default" msgid "Default"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:323 #: src/rougail/output_doc/utils.py:324
msgid "Example" msgid "Example"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:325 #: src/rougail/output_doc/utils.py:326
msgid "Examples" msgid "Examples"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:365 #: src/rougail/output_doc/utils.py:366
msgid "Description" msgid "Description"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:365 #: src/rougail/output_doc/utils.py:366
msgid "Variable" msgid "Variable"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:386 #: src/rougail/output_doc/utils.py:387
msgid "{0}: {1}" msgid "{0}: {1}"
msgstr "" msgstr ""

View file

@ -21,7 +21,7 @@ from typing import Optional
from itertools import chain from itertools import chain
from tiramisu import Calculation, undefined, groups from tiramisu import Calculation, undefined, groups
from tiramisu.error import ConfigError from tiramisu.error import ConfigError, display_list
from rougail.error import display_xmlfiles from rougail.error import display_xmlfiles
from rougail.object_model import PROPERTY_ATTRIBUTE from rougail.object_model import PROPERTY_ATTRIBUTE
@ -438,6 +438,8 @@ class RougailOutputDoc(Examples):
if value is None: if value is None:
value = option.impl_get_extra(param) value = option.impl_get_extra(param)
if value is not None and value is not False: if value is not None and value is not False:
if isinstance(value, (list, set)):
value = display_list(value, add_quote=True)
informations.setdefault("validators", []).append(msg.format(value)) informations.setdefault("validators", []).append(msg.format(value))
# get validation information from annotator # get validation information from annotator
for name in variable.information.list(): for name in variable.information.list():

View file

@ -76,15 +76,16 @@ DocTypes = {
"allow_range": _("can be range of port"), "allow_range": _("can be range of port"),
"allow_protocol": _("can have the protocol"), "allow_protocol": _("can have the protocol"),
"allow_zero": _("port 0 is allowed"), "allow_zero": _("port 0 is allowed"),
"allow_wellknown": _("ports 1 to 1023 are allowed"), "allow_wellknown": _("well-known ports (1 to 1023) are allowed"),
"allow_registred": _("ports 1024 to 49151 are allowed"), "allow_registred": _("registred ports (1024 to 49151) are allowed"),
"allow_private": _("ports greater than 49152 are allowed"), "allow_private": _("private ports (greater than 49152) are allowed"),
}, },
}, },
"secret": { "secret": {
"params": { "params": {
"min_len": _("minimum length for the secret"), "min_len": _("minimum length for the secret is {0} characters"),
"max_len": _("maximum length for the secret"), "max_len": _("maximum length for the secret is {0} characters"),
"forbidden_char": _("forbidden characters are {0}"),
}, },
}, },
} }

View file

@ -14,7 +14,7 @@ excludes = [
] ]
test_ok = get_structures_list(excludes) test_ok = get_structures_list(excludes)
# test_ok = [Path('../rougail-tests/structures/60_6family_dynamic_sub_dynamic_empty2')] # test_ok = [Path('../rougail-tests/structures/60_9family_dynamic_calc_both')]
os.environ['COLUMNS'] = '80' os.environ['COLUMNS'] = '80'