fix: root could be a variable

This commit is contained in:
egarette@silique.fr 2026-01-19 17:12:20 +01:00
parent fe3c28f6d4
commit 0024c2cb2a
8 changed files with 160 additions and 5 deletions

View file

@ -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

View file

@ -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
|====

View file

@ -0,0 +1,18 @@
<details><summary>First family</summary>
> [!note] 🛈 Informations
> **Path**: a_family
<details><summary>A second family</summary>
> [!note] 🛈 Informations
> **Path**: a_family.a_second_family
| Variable | Description |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|
| **<a id="a_family.a_second_family.a_variable" name="a_family.a_second_family.a_variable">a_family.a_second_family.a_variable</a>**<br/>[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | A boolean variable.<br/>**Default**: true |
</details>
</details>

View file

@ -0,0 +1,17 @@
<h1>First family</h1>
<b>Path</b>: a_family
<h2>A second family</h2>
<b>Path</b>: a_family.a_second_family
<table>
<thead>
<tr><th>Variable </th><th>Description </th></tr>
</thead>
<tbody>
<tr><td><b>a_family.a_second_family.a_variable</b><br/><mark><a href='https://rougail.readthedocs.io/en/latest/variable.html#variables-types'>boolean</a></mark> <mark>mandatory</mark></td><td>A boolean variable.<br/><b>Default</b>: true</td></tr>
</tbody>
</table>

View file

@ -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
}
}
}
}
}
}

View file

@ -0,0 +1,16 @@
# First family
> [!NOTE]
>
> **Path**: a_family
## A second family
> [!NOTE]
>
> **Path**: a_family.a_second_family
| Variable | Description |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|
| **<a id="a_family.a_second_family.a_variable" name="a_family.a_second_family.a_variable">a_family.a_second_family.a_variable</a>**<br/>[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | A boolean variable.<br/>**Default**: true |

View file

@ -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
└───────────────────────────────────────┴──────────────────────────────────────┘

View file

@ -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")