diff --git a/src/rougail/output_doc/doc.py b/src/rougail/output_doc/doc.py index 824815a02..9ec72fd11 100644 --- a/src/rougail/output_doc/doc.py +++ b/src/rougail/output_doc/doc.py @@ -117,9 +117,13 @@ class RougailOutputDoc(Examples, Changelog): self.property_to_string = get_properties_to_string() self.outputs = OutPuts().get() self.dynamic_paths = {} - config = self.config.unrestraint - self.populate_dynamics(config=config) - informations = self.parse_families(config) + if not self.config.isoptiondescription(): + informations = {} + self.parse_variable(self.config, None, informations) + else: + config = self.config.unrestraint + self.populate_dynamics(config=config) + informations = self.parse_families(config) if informations is None: informations = {} elif self.config.type() not in ['config', 'metaconfig', 'groupconfig', 'mixconfig']: @@ -129,8 +133,9 @@ class RougailOutputDoc(Examples, Changelog): for path in self.config.path().split('.'): family = family.option(path) name = family.name(uncalculated=True) - infos[name] = self.get_root_family(family) - infos = infos[name]["children"] + if family.isoptiondescription(): + infos[name] = self.get_root_family(family) + infos = infos[name]["children"] infos.update(informations) informations = root_informations self.informations = informations diff --git a/tests/root_a_family.a_second_family.a_variable.adoc b/tests/root_a_family.a_second_family.a_variable.adoc new file mode 100644 index 000000000..6bba74d69 --- /dev/null +++ b/tests/root_a_family.a_second_family.a_variable.adoc @@ -0,0 +1,22 @@ +== First family + +==== +**๐Ÿ›ˆ Informations** + +**Path**: a_family +==== +=== A second family + +==== +**๐Ÿ›ˆ Informations** + +**Path**: a_family.a_second_family +==== +[cols="1a,1a"] +|==== +| Variable | Description +| **a_family.a_second_family.a_variable** + +`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[boolean]` `mandatory` | A boolean variable. + +**Default**: true +|==== + diff --git a/tests/root_a_family.a_second_family.a_variable.gitlab.md b/tests/root_a_family.a_second_family.a_variable.gitlab.md new file mode 100644 index 000000000..ab72679b6 --- /dev/null +++ b/tests/root_a_family.a_second_family.a_variable.gitlab.md @@ -0,0 +1,18 @@ +
First family + +> [!note] ๐Ÿ›ˆ Informations +> **Path**: a_family + +
A second family + +> [!note] ๐Ÿ›ˆ Informations +> **Path**: a_family.a_second_family + +| Variable | Description | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------| +| **a_family.a_second_family.a_variable**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | A boolean variable.
**Default**: true | + +
+ +
+ diff --git a/tests/root_a_family.a_second_family.a_variable.html b/tests/root_a_family.a_second_family.a_variable.html new file mode 100644 index 000000000..bde579d86 --- /dev/null +++ b/tests/root_a_family.a_second_family.a_variable.html @@ -0,0 +1,17 @@ +

First family

+ +Path: a_family + +

A second family

+ +Path: a_family.a_second_family + + + + + + + + +
Variable Description
a_family.a_second_family.a_variable
boolean mandatory
A boolean variable.
Default: true
+ diff --git a/tests/root_a_family.a_second_family.a_variable.json b/tests/root_a_family.a_second_family.a_variable.json new file mode 100644 index 000000000..2e74a537c --- /dev/null +++ b/tests/root_a_family.a_second_family.a_variable.json @@ -0,0 +1,53 @@ +{ + "a_family": { + "type": "family", + "informations": { + "path": "a_family", + "names": [ + "a_family" + ], + "description": "First family", + "properties": [] + }, + "children": { + "a_second_family": { + "type": "family", + "informations": { + "path": "a_family.a_second_family", + "names": [ + "a_second_family" + ], + "description": "A second family", + "properties": [] + }, + "children": { + "a_variable": { + "type": "variable", + "default": { + "name": "Default", + "values": true + }, + "variable_type": "boolean", + "path": "a_family.a_second_family.a_variable", + "names": [ + "a_variable" + ], + "description": "A boolean variable.", + "properties": [ + { + "type": "property", + "name": "mandatory", + "ori_name": "mandatory", + "access_control": false + } + ], + "gen_examples": [ + true + ], + "mandatory_without_value": false + } + } + } + } + } +} \ No newline at end of file diff --git a/tests/root_a_family.a_second_family.a_variable.md b/tests/root_a_family.a_second_family.a_variable.md new file mode 100644 index 000000000..5195be120 --- /dev/null +++ b/tests/root_a_family.a_second_family.a_variable.md @@ -0,0 +1,16 @@ +# First family + +> [!NOTE] +> +> **Path**: a_family + +## A second family + +> [!NOTE] +> +> **Path**: a_family.a_second_family + +| Variable | Description | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------| +| **a_family.a_second_family.a_variable**
[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | A boolean variable.
**Default**: true | + diff --git a/tests/root_a_family.a_second_family.a_variable.sh b/tests/root_a_family.a_second_family.a_variable.sh new file mode 100644 index 000000000..5b60e305e --- /dev/null +++ b/tests/root_a_family.a_second_family.a_variable.sh @@ -0,0 +1,20 @@ +First family + +โ–Œ ๐Ÿ›ˆ Informations +โ–Œ  +โ–Œ Path: a_family + + A second family + +โ–Œ ๐Ÿ›ˆ Informations +โ–Œ  +โ–Œ Path: a_family.a_second_family + +โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“ +โ”ƒ Variable  โ”ƒ Description  โ”ƒ +โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ +โ”‚ a_family.a_second_family.a_variable โ”‚ A boolean variable. โ”‚ +โ”‚  boolean   mandatory  โ”‚ Default: true โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + + diff --git a/tests/test_root.py b/tests/test_root.py index 2e455e155..5eb57239f 100644 --- a/tests/test_root.py +++ b/tests/test_root.py @@ -50,6 +50,10 @@ def test_root_sub(): _test_root('a_family.an_other_family') +def test_root_variable(): + _test_root('a_family.a_second_family.a_variable') + + def test_root_changelog(): _test_root('a_family', "changelog")