fix: doc a param with a set but with only one item

This commit is contained in:
egarette@silique.fr 2025-03-31 10:25:08 +02:00
parent fcac55ae92
commit 22e839027d
15 changed files with 120 additions and 18 deletions

View file

@ -5,8 +5,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"POT-Creation-Date: 2025-03-30 19:45+0200\n" "POT-Creation-Date: 2025-03-31 09:14+0200\n"
"PO-Revision-Date: 2025-03-30 19:46+0200\n" "PO-Revision-Date: 2025-03-31 09:15+0200\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: fr\n" "Language: fr\n"
@ -255,8 +255,8 @@ msgid "maximum length for the secret is {0} characters"
msgstr "longueur maximal pour le secret est de {0} caractères" msgstr "longueur maximal pour le secret est de {0} caractères"
#: src/rougail/output_doc/utils.py:88 #: src/rougail/output_doc/utils.py:88
msgid "forbidden characters are {0}" msgid "forbidden characters: {0}"
msgstr "caractères interdits sont {0}" msgstr "caractères interdits: {0}"
#: src/rougail/output_doc/utils.py:93 #: src/rougail/output_doc/utils.py:93
msgid "this filename could be a relative path" msgid "this filename could be a relative path"

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-30 19:46+0200\n" "POT-Creation-Date: 2025-03-31 09:15+0200\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"
@ -254,7 +254,7 @@ msgid "maximum length for the secret is {0} characters"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:88 #: src/rougail/output_doc/utils.py:88
msgid "forbidden characters are {0}" msgid "forbidden characters: {0}"
msgstr "" msgstr ""
#: src/rougail/output_doc/utils.py:93 #: src/rougail/output_doc/utils.py:93

View file

@ -438,7 +438,9 @@ 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)): if isinstance(value, set):
value = list(value)
if isinstance(value, list):
value = display_list(value, add_quote=True) 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

View file

@ -85,7 +85,7 @@ DocTypes = {
"params": { "params": {
"min_len": _("minimum length for the secret is {0} characters"), "min_len": _("minimum length for the secret is {0} characters"),
"max_len": _("maximum length for the secret is {0} characters"), "max_len": _("maximum length for the secret is {0} characters"),
"forbidden_char": _("forbidden characters are {0}"), "forbidden_char": _("forbidden characters: {0}"),
}, },
}, },
"unix_filename": { "unix_filename": {

View file

@ -15,7 +15,18 @@ The second variable. +
**Validators**: **Validators**:
* maximum length for the secret is 10 characters * maximum length for the secret is 10 characters
* forbidden characters are "$" and "^" * 'forbidden characters: "$" and "^"'
**Default**: value
|
**secret3** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[secret]` `standard` `mandatory` |
The third variable. +
**Validators**:
* maximum length for the secret is 10 characters
* 'forbidden characters: "$"'
**Default**: value **Default**: value
|==== |====

View file

@ -47,7 +47,7 @@
], ],
"validators": [ "validators": [
"maximum length for the secret is 10 characters", "maximum length for the secret is 10 characters",
"forbidden characters are \"$\" and \"^\"" "forbidden characters: \"$\" and \"^\""
], ],
"paths": [ "paths": [
"secret2" "secret2"
@ -58,5 +58,36 @@
"descriptions": [ "descriptions": [
"The second variable." "The second variable."
] ]
},
"secret3": {
"type": "variable",
"default": "value",
"properties": [
{
"type": "type",
"name": "secret"
},
{
"type": "mode",
"name": "standard"
},
{
"type": "property",
"name": "mandatory"
}
],
"validators": [
"maximum length for the secret is 10 characters",
"forbidden characters: \"$\""
],
"paths": [
"secret3"
],
"names": [
"secret3"
],
"descriptions": [
"The third variable."
]
} }
} }

View file

@ -1,5 +1,6 @@
| Variable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **secret1**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | The first variable.<br/>**Validator**: minimum length for the secret is 10 characters | | **secret1**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | The first variable.<br/>**Validator**: minimum length for the secret is 10 characters |
| **secret2**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | The second variable.<br/>**Validators**: <br/>- maximum length for the secret is 10 characters<br/>- forbidden characters are "$" and "^"<br/>**Default**: value | | **secret2**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | The second variable.<br/>**Validators**: <br/>- maximum length for the secret is 10 characters<br/>- forbidden characters: "$" and "^"<br/>**Default**: value |
| **secret3**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | The third variable.<br/>**Validators**: <br/>- maximum length for the secret is 10 characters<br/>- forbidden characters: "$"<br/>**Default**: value |

View file

@ -9,7 +9,13 @@
 secret   standard   mandatory  │ Validators: │  secret   standard   mandatory  │ Validators: │
│ │ - maximum length for the secret is │ │ │ - maximum length for the secret is │
│ │ 10 characters │ │ │ 10 characters │
│ │ - forbidden characters are "$" and │ │ │ - forbidden characters: "$" and "^"
│ │ "^" │ │ Default: value │
├───────────────────────────────────────┼──────────────────────────────────────┤
secret3 │ The third variable. │
 secret   standard   mandatory  │ Validators: │
│ │ - maximum length for the secret is │
│ │ 10 characters │
│ │ - forbidden characters: "$"
│ │ Default: value │ │ │ Default: value │
└───────────────────────────────────────┴──────────────────────────────────────┘ └───────────────────────────────────────┴──────────────────────────────────────┘

View file

@ -10,4 +10,5 @@ secret1: secrets
--- ---
secret1: secrets secret1: secrets
secret2: value secret2: value
secret3: value
``` ```

View file

@ -17,7 +17,18 @@ The second variable. +
**Validators**: **Validators**:
* maximum length for the secret is 10 characters * maximum length for the secret is 10 characters
* forbidden characters are "$" and "^" * 'forbidden characters: "$" and "^"'
**Default**: value
|
**rougail.secret3** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[secret]` `standard` `mandatory` |
The third variable. +
**Validators**:
* maximum length for the secret is 10 characters
* 'forbidden characters: "$"'
**Default**: value **Default**: value
|==== |====

View file

@ -65,7 +65,7 @@
], ],
"validators": [ "validators": [
"maximum length for the secret is 10 characters", "maximum length for the secret is 10 characters",
"forbidden characters are \"$\" and \"^\"" "forbidden characters: \"$\" and \"^\""
], ],
"paths": [ "paths": [
"rougail.secret2" "rougail.secret2"
@ -76,6 +76,37 @@
"descriptions": [ "descriptions": [
"The second variable." "The second variable."
] ]
},
"rougail.secret3": {
"type": "variable",
"default": "value",
"properties": [
{
"type": "type",
"name": "secret"
},
{
"type": "mode",
"name": "standard"
},
{
"type": "property",
"name": "mandatory"
}
],
"validators": [
"maximum length for the secret is 10 characters",
"forbidden characters: \"$\""
],
"paths": [
"rougail.secret3"
],
"names": [
"secret3"
],
"descriptions": [
"The third variable."
]
} }
} }
} }

View file

@ -3,5 +3,6 @@
| Variable&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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nbsp;&nbsp;&nbsp; | Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **rougail.secret1**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | The first variable.<br/>**Validator**: minimum length for the secret is 10 characters | | **rougail.secret1**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | The first variable.<br/>**Validator**: minimum length for the secret is 10 characters |
| **rougail.secret2**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | The second variable.<br/>**Validators**: <br/>- maximum length for the secret is 10 characters<br/>- forbidden characters are "$" and "^"<br/>**Default**: value | | **rougail.secret2**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | The second variable.<br/>**Validators**: <br/>- maximum length for the secret is 10 characters<br/>- forbidden characters: "$" and "^"<br/>**Default**: value |
| **rougail.secret3**<br/>[`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | The third variable.<br/>**Validators**: <br/>- maximum length for the secret is 10 characters<br/>- forbidden characters: "$"<br/>**Default**: value |

View file

@ -14,7 +14,13 @@
 secret   standard   mandatory  │ Validators: │  secret   standard   mandatory  │ Validators: │
│ │ - maximum length for the secret is │ │ │ - maximum length for the secret is │
│ │ 10 characters │ │ │ 10 characters │
│ │ - forbidden characters are "$" and │ │ │ - forbidden characters: "$" and "^"
│ │ "^" │ │ Default: value │
├───────────────────────────────────────┼──────────────────────────────────────┤
rougail.secret3 │ The third variable. │
 secret   standard   mandatory  │ Validators: │
│ │ - maximum length for the secret is │
│ │ 10 characters │
│ │ - forbidden characters: "$"
│ │ Default: value │ │ │ Default: value │
└───────────────────────────────────────┴──────────────────────────────────────┘ └───────────────────────────────────────┴──────────────────────────────────────┘

View file

@ -12,4 +12,5 @@ rougail:
rougail: rougail:
secret1: secrets secret1: secrets
secret2: value secret2: value
secret3: value
``` ```