From 22e839027d5fdb087dfebd8e0556436f1f76b7be Mon Sep 17 00:00:00 2001 From: Emmanuel Garette <egarette@silique.fr> Date: Mon, 31 Mar 2025 10:25:08 +0200 Subject: [PATCH] fix: doc a param with a set but with only one item --- locale/fr/LC_MESSAGES/rougail_output_doc.po | 8 ++--- locale/rougail_output_doc.pot | 4 +-- src/rougail/output_doc/doc.py | 4 ++- .../fr/LC_MESSAGES/rougail_output_doc.mo | Bin 6347 -> 6340 bytes src/rougail/output_doc/utils.py | 2 +- tests/results/test/00_6secret_param.adoc | 13 ++++++- tests/results/test/00_6secret_param.json | 33 +++++++++++++++++- tests/results/test/00_6secret_param.md | 3 +- tests/results/test/00_6secret_param.sh | 10 ++++-- .../results/test_examples/00_6secret_param.md | 1 + .../test_namespace/00_6secret_param.adoc | 13 ++++++- .../test_namespace/00_6secret_param.json | 33 +++++++++++++++++- .../test_namespace/00_6secret_param.md | 3 +- .../test_namespace/00_6secret_param.sh | 10 ++++-- .../00_6secret_param.md | 1 + 15 files changed, 120 insertions(+), 18 deletions(-) diff --git a/locale/fr/LC_MESSAGES/rougail_output_doc.po b/locale/fr/LC_MESSAGES/rougail_output_doc.po index d542437..7f8ae56 100644 --- a/locale/fr/LC_MESSAGES/rougail_output_doc.po +++ b/locale/fr/LC_MESSAGES/rougail_output_doc.po @@ -5,8 +5,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2025-03-30 19:45+0200\n" -"PO-Revision-Date: 2025-03-30 19:46+0200\n" +"POT-Creation-Date: 2025-03-31 09:14+0200\n" +"PO-Revision-Date: 2025-03-31 09:15+0200\n" "Last-Translator: \n" "Language-Team: \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" #: src/rougail/output_doc/utils.py:88 -msgid "forbidden characters are {0}" -msgstr "caractΓ¨res interdits sont {0}" +msgid "forbidden characters: {0}" +msgstr "caractΓ¨res interdits: {0}" #: src/rougail/output_doc/utils.py:93 msgid "this filename could be a relative path" diff --git a/locale/rougail_output_doc.pot b/locale/rougail_output_doc.pot index 8924f69..edb34e1 100644 --- a/locale/rougail_output_doc.pot +++ b/locale/rougail_output_doc.pot @@ -5,7 +5,7 @@ msgid "" msgstr "" "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" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -254,7 +254,7 @@ msgid "maximum length for the secret is {0} characters" msgstr "" #: src/rougail/output_doc/utils.py:88 -msgid "forbidden characters are {0}" +msgid "forbidden characters: {0}" msgstr "" #: src/rougail/output_doc/utils.py:93 diff --git a/src/rougail/output_doc/doc.py b/src/rougail/output_doc/doc.py index 7c457b2..a6f0f80 100644 --- a/src/rougail/output_doc/doc.py +++ b/src/rougail/output_doc/doc.py @@ -438,7 +438,9 @@ class RougailOutputDoc(Examples): if value is None: value = option.impl_get_extra(param) 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) informations.setdefault("validators", []).append(msg.format(value)) # get validation information from annotator diff --git a/src/rougail/output_doc/locale/fr/LC_MESSAGES/rougail_output_doc.mo b/src/rougail/output_doc/locale/fr/LC_MESSAGES/rougail_output_doc.mo index 12829983c6ccae89a9d514df883300b242a85a6e..4a8f2a64edae9a31b9d71cb30763b8bcdadbcad3 100644 GIT binary patch delta 953 zcmXZbPe@cz6vy%NYG%wv&77Px)5f$iXGZ5?<DY>RskF&<!E8zhB7!JHjLL<N6r@Ga zViqkzP!MaA8ncliq8Jiv(aJVKAY==7`KO)b_vbu#ywAOtH|L&n?wzl0!Ck!Ic(rEs zqSP#eZ;{8Ac(vna-%UKk{Pbb7qZr31Uc@%MhH;$0<G6t5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zhhxXEgZW@t&i^3;wQLUi@H?uK?QD<YY!G$njv|ju@=^zGqb}21Q~@92`NcSH;|A-} z?n7<-IQlq^{GseMI_1aixMSsJui~_qKY1mmJIvNhu5{C*=f}cFi3PW|H|-A;3;p5U S<VV*_Pn<n-Aw1n!^8N$L@MRGI diff --git a/src/rougail/output_doc/utils.py b/src/rougail/output_doc/utils.py index 37b6f53..9683df6 100644 --- a/src/rougail/output_doc/utils.py +++ b/src/rougail/output_doc/utils.py @@ -85,7 +85,7 @@ DocTypes = { "params": { "min_len": _("minimum 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": { diff --git a/tests/results/test/00_6secret_param.adoc b/tests/results/test/00_6secret_param.adoc index 089e337..c6683bd 100644 --- a/tests/results/test/00_6secret_param.adoc +++ b/tests/results/test/00_6secret_param.adoc @@ -15,7 +15,18 @@ The second variable. + **Validators**: * 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 |==== diff --git a/tests/results/test/00_6secret_param.json b/tests/results/test/00_6secret_param.json index 03147ca..8a56b9c 100644 --- a/tests/results/test/00_6secret_param.json +++ b/tests/results/test/00_6secret_param.json @@ -47,7 +47,7 @@ ], "validators": [ "maximum length for the secret is 10 characters", - "forbidden characters are \"$\" and \"^\"" + "forbidden characters: \"$\" and \"^\"" ], "paths": [ "secret2" @@ -58,5 +58,36 @@ "descriptions": [ "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." + ] } } \ No newline at end of file diff --git a/tests/results/test/00_6secret_param.md b/tests/results/test/00_6secret_param.md index 73881ca..f022c21 100644 --- a/tests/results/test/00_6secret_param.md +++ b/tests/results/test/00_6secret_param.md @@ -1,5 +1,6 @@ | Variable | Description | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **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 | diff --git a/tests/results/test/00_6secret_param.sh b/tests/results/test/00_6secret_param.sh index 61c6f7e..bcf6dbf 100644 --- a/tests/results/test/00_6secret_param.sh +++ b/tests/results/test/00_6secret_param.sh @@ -9,7 +9,13 @@ β [1;7m secret [0m [1;7m standard [0m [1;7m mandatory [0m β [1mValidators[0m: β β β - maximum length for the secret is β β β 10 characters β -β β - forbidden characters are "$" and β -β β "^" β +β β - forbidden characters: "$" and "^" β +β β [1mDefault[0m: value β +βββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ€ +β [1msecret3[0m β The third variable. β +β [1;7m secret [0m [1;7m standard [0m [1;7m mandatory [0m β [1mValidators[0m: β +β β - maximum length for the secret is β +β β 10 characters β +β β - forbidden characters: "$" β β β [1mDefault[0m: value β βββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ diff --git a/tests/results/test_examples/00_6secret_param.md b/tests/results/test_examples/00_6secret_param.md index 837d6f4..5a3d282 100644 --- a/tests/results/test_examples/00_6secret_param.md +++ b/tests/results/test_examples/00_6secret_param.md @@ -10,4 +10,5 @@ secret1: secrets --- secret1: secrets secret2: value +secret3: value ``` diff --git a/tests/results/test_namespace/00_6secret_param.adoc b/tests/results/test_namespace/00_6secret_param.adoc index bd609c0..b6f7bf7 100644 --- a/tests/results/test_namespace/00_6secret_param.adoc +++ b/tests/results/test_namespace/00_6secret_param.adoc @@ -17,7 +17,18 @@ The second variable. + **Validators**: * 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 |==== diff --git a/tests/results/test_namespace/00_6secret_param.json b/tests/results/test_namespace/00_6secret_param.json index ae80755..abc6ab1 100644 --- a/tests/results/test_namespace/00_6secret_param.json +++ b/tests/results/test_namespace/00_6secret_param.json @@ -65,7 +65,7 @@ ], "validators": [ "maximum length for the secret is 10 characters", - "forbidden characters are \"$\" and \"^\"" + "forbidden characters: \"$\" and \"^\"" ], "paths": [ "rougail.secret2" @@ -76,6 +76,37 @@ "descriptions": [ "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." + ] } } } diff --git a/tests/results/test_namespace/00_6secret_param.md b/tests/results/test_namespace/00_6secret_param.md index 177706c..fc32da6 100644 --- a/tests/results/test_namespace/00_6secret_param.md +++ b/tests/results/test_namespace/00_6secret_param.md @@ -3,5 +3,6 @@ | Variable | Description | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **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 | diff --git a/tests/results/test_namespace/00_6secret_param.sh b/tests/results/test_namespace/00_6secret_param.sh index 452f46f..c48f2c2 100644 --- a/tests/results/test_namespace/00_6secret_param.sh +++ b/tests/results/test_namespace/00_6secret_param.sh @@ -14,7 +14,13 @@ β [1;7m secret [0m [1;7m standard [0m [1;7m mandatory [0m β [1mValidators[0m: β β β - maximum length for the secret is β β β 10 characters β -β β - forbidden characters are "$" and β -β β "^" β +β β - forbidden characters: "$" and "^" β +β β [1mDefault[0m: value β +βββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ€ +β [1mrougail.secret3[0m β The third variable. β +β [1;7m secret [0m [1;7m standard [0m [1;7m mandatory [0m β [1mValidators[0m: β +β β - maximum length for the secret is β +β β 10 characters β +β β - forbidden characters: "$" β β β [1mDefault[0m: value β βββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ diff --git a/tests/results/test_namespace_examples/00_6secret_param.md b/tests/results/test_namespace_examples/00_6secret_param.md index 5230468..ab0e61b 100644 --- a/tests/results/test_namespace_examples/00_6secret_param.md +++ b/tests/results/test_namespace_examples/00_6secret_param.md @@ -12,4 +12,5 @@ rougail: rougail: secret1: secrets secret2: value + secret3: value ```