feat: personalize mode that we want disable documentation

This commit is contained in:
egarette@silique.fr 2024-11-20 21:59:21 +01:00
parent af652eda76
commit 9f5d0e2497
29 changed files with 381 additions and 9 deletions

View file

@ -87,6 +87,22 @@ doc:
negative_description: Hide example in documentation
alternative_name: de
default: false
disabled_modes:
description: Disable documentation for variable with those modes
multi: true
mandatory: false
disabled:
jinja: |
{% if not modes_level %}
there is no mode
{% endif %}
description: disabled when there is no mode available
validators:
- jinja: |
{% if _.disabled_modes not in modes_level %}
this mode is not available
{% endif %}
description: verify if disable modes already exists
output_format:
description: Generate document in format
alternative_name: do

View file

@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
from warnings import warn
from typing import Optional
from itertools import chain
from tiramisu import Calculation, undefined, groups
from tiramisu.error import ConfigError
@ -65,14 +66,19 @@ class RougailOutputDoc(Examples):
rougail.converted.plugins.append("output_doc")
config = rougail.run()
self.conf = config
self.conf.property.setdefault(frozenset({"advanced"}), "read_write", "append")
self.modes_level = rougailconfig["modes_level"]
if self.modes_level:
self.disabled_modes = rougailconfig["doc.disabled_modes"]
if self.disabled_modes:
self.conf.property.setdefault(frozenset(self.disabled_modes), "read_write", "append")
else:
self.disabled_modes = []
self.conf.property.read_write()
# self.conf.property.remove("cache")
self.formater = outputs[output]()
self.level = rougailconfig["doc.title_level"]
self.dynamic_paths = {}
self.with_example = rougailconfig["doc.with_example"]
self.modes_level = rougailconfig["modes_level"]
self.informations = None
try:
groups.namespace
@ -156,8 +162,7 @@ class RougailOutputDoc(Examples):
do not comment this family
"""
properties = child.property.get(uncalculated=True)
# FIXME advanced is hard coded
for hidden_property in ["hidden", "disabled", "advanced"]:
for hidden_property in chain(["hidden", "disabled"], self.disabled_modes):
if hidden_property in properties:
return True
return False

View file

@ -10,3 +10,16 @@ var:
mode: advanced
default: no
----
== Variables for "Rougail"
[cols="1a,1a"]
|====
| Variable | Description
|
**rougail.var** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `advanced` `mandatory` `auto modified` |
A variable. +
**Default**: no
|====

View file

@ -1 +1 @@
{}
{"rougail": {"type": "namespace", "informations": {"paths": ["rougail"], "names": ["rougail"], "description": "Rougail", "properties": [{"type": "mode", "name": "advanced"}]}, "children": {"var": {"type": "variable", "default": "no", "properties": [{"type": "type", "name": "string"}, {"type": "mode", "name": "advanced"}, {"type": "property", "name": "mandatory"}, {"type": "property", "name": "auto modified"}], "paths": ["rougail.var"], "names": ["var"], "descriptions": ["A variable."]}}}}

View file

@ -13,3 +13,9 @@ var:
mode: advanced
default: no
```
# Variables for "Rougail"
| 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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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.var**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `advanced` `mandatory` `auto modified` | A variable.<br/>**Default**: no |

View file

@ -9,3 +9,16 @@ var:
mode: advanced
default: no
```
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
Variables for "Rougail" ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
 Variable                                           Description                                      
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
rougail.var
string advanced mandatory auto modified A variable.
Default: no

View file

@ -12,3 +12,23 @@ family:
description: a variable
mandatory: false
----
== Variables for "Rougail"
=== a family
`advanced`
==== a sub family
`advanced`
[cols="1a,1a"]
|====
| Variable | Description
|
**rougail.family.subfamily.variable** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `advanced` |
A variable.
|====

View file

@ -1 +1 @@
{}
{"rougail": {"type": "namespace", "informations": {"paths": ["rougail"], "names": ["rougail"], "description": "Rougail", "properties": [{"type": "mode", "name": "advanced"}]}, "children": {"family": {"type": "family", "informations": {"paths": ["rougail.family"], "names": ["family"], "description": "a family", "properties": [{"type": "mode", "name": "advanced"}]}, "children": {"subfamily": {"type": "family", "informations": {"paths": ["rougail.family.subfamily"], "names": ["subfamily"], "description": "a sub family", "properties": [{"type": "mode", "name": "advanced"}]}, "children": {"variable": {"type": "variable", "properties": [{"type": "type", "name": "string"}, {"type": "mode", "name": "advanced"}], "paths": ["rougail.family.subfamily.variable"], "names": ["variable"], "descriptions": ["A variable."]}}}}}}}}

View file

@ -15,3 +15,17 @@ family:
description: a variable
mandatory: false
```
# Variables for "Rougail"
## a family
`advanced`
### a sub family
`advanced`
| 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; | 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; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **rougail.family.subfamily.variable**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `advanced` | A variable. |

View file

@ -11,3 +11,23 @@ family:
description: a variable
mandatory: false
```
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
Variables for "Rougail" ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
a family
advanced
a sub family
advanced
 Variable                                 Description                            
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
rougail.family.subfamily.variable
string advanced A variable.

View file

@ -13,3 +13,10 @@ var:
mode: advanced
default: no
```
# Example with all variables modifiable
```yaml
---
rougail:
var: no
```

View file

@ -15,3 +15,12 @@ family:
description: a variable
mandatory: false
```
# Example with all variables modifiable
```yaml
---
rougail:
family:
subfamily:
variable: example
```

View file

@ -10,3 +10,16 @@ var:
mode: advanced
default: no
----
== Variables
[cols="1a,1a"]
|====
| Variable | Description
|
**var** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `advanced` `mandatory` `auto modified` |
A variable. +
**Default**: no
|====

View file

@ -1 +1 @@
{}
{"var": {"type": "variable", "default": "no", "properties": [{"type": "type", "name": "string"}, {"type": "mode", "name": "advanced"}, {"type": "property", "name": "mandatory"}, {"type": "property", "name": "auto modified"}], "paths": ["var"], "names": ["var"], "descriptions": ["A variable."]}}

View file

@ -13,3 +13,9 @@ var:
mode: advanced
default: no
```
# Variables
| 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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **var**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `advanced` `mandatory` `auto modified` | A variable.<br/>**Default**: no |

View file

@ -9,3 +9,16 @@ var:
mode: advanced
default: no
```
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
Variables ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
 Variable                                           Description                                      
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
var
string advanced mandatory auto modified A variable.
Default: no

View file

@ -12,3 +12,23 @@ family:
description: a variable
mandatory: false
----
== Variables
=== a family
`advanced`
==== a sub family
`advanced`
[cols="1a,1a"]
|====
| Variable | Description
|
**family.subfamily.variable** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `advanced` |
A variable.
|====

View file

@ -1 +1 @@
{}
{"family": {"type": "family", "informations": {"paths": ["family"], "names": ["family"], "description": "a family", "properties": [{"type": "mode", "name": "advanced"}]}, "children": {"subfamily": {"type": "family", "informations": {"paths": ["family.subfamily"], "names": ["subfamily"], "description": "a sub family", "properties": [{"type": "mode", "name": "advanced"}]}, "children": {"variable": {"type": "variable", "properties": [{"type": "type", "name": "string"}, {"type": "mode", "name": "advanced"}], "paths": ["family.subfamily.variable"], "names": ["variable"], "descriptions": ["A variable."]}}}}}}

View file

@ -15,3 +15,17 @@ family:
description: a variable
mandatory: false
```
# Variables
## a family
`advanced`
### a sub family
`advanced`
| 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; | 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; |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **family.subfamily.variable**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `advanced` | A variable. |

View file

@ -11,3 +11,23 @@ family:
description: a variable
mandatory: false
```
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
Variables ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
a family
advanced
a sub family
advanced
 Variable                         Description                    
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
family.subfamily.variable
string advanced A variable.

22
tests/mode/00_file.yml Normal file
View file

@ -0,0 +1,22 @@
---
version: 1.1
var1:
description: my var1
mode: basic
var2:
description: my var2
default:
variable: var1
mode: standard
var3:
description: my var3
mode: advanced
hidden:
jinja: |
{% if var1 == 'value' %}
it's hidden
{% endif %}
description: var could be hidden

18
tests/mode_advanced.adoc Normal file
View file

@ -0,0 +1,18 @@
== Variables
[cols="1a,1a"]
|====
| Variable | Description
|
**var1** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `basic` `mandatory` |
My var1.
|
**var2** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `standard` `mandatory` |
My var2. +
**Default**: the value of the variable "var1".
|====

19
tests/mode_basic.adoc Normal file
View file

@ -0,0 +1,19 @@
== Variables
[cols="1a,1a"]
|====
| Variable | Description
|
**var2** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `standard` `mandatory` |
My var2. +
**Default**: the value of the variable "var1".
|
**var3** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `advanced` `mandatory` `__hidden__` |
My var3. +
**Hidden**: var could be hidden.
|====

View file

@ -0,0 +1,13 @@
== Variables
[cols="1a,1a"]
|====
| Variable | Description
|
**var2** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `standard` `mandatory` |
My var2. +
**Default**: the value of the variable "var1".
|====

View file

@ -0,0 +1,13 @@
== Variables
[cols="1a,1a"]
|====
| Variable | Description
|
**var3** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `advanced` `mandatory` `__hidden__` |
My var3. +
**Hidden**: var could be hidden.
|====

18
tests/mode_standard.adoc Normal file
View file

@ -0,0 +1,18 @@
== Variables
[cols="1a,1a"]
|====
| Variable | Description
|
**var1** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `basic` `mandatory` |
My var1.
|
**var3** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `advanced` `mandatory` `__hidden__` |
My var3. +
**Hidden**: var could be hidden.
|====

View file

@ -0,0 +1,12 @@
== Variables
[cols="1a,1a"]
|====
| Variable | Description
|
**var1** +
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `basic` `mandatory` |
My var1.
|====

View file

@ -3,7 +3,7 @@ from rougail.config import get_rougail_config
from rougail.output_doc import RougailOutputDoc
def test_dictionaries():
def test_force_optional():
test_dir = Path(__file__).resolve().parent
rougailconfig = get_rougail_config(backward_compatibility=False)
rougailconfig['step.output'] = 'doc'

48
tests/test_mode.py Normal file
View file

@ -0,0 +1,48 @@
from pathlib import Path
from rougail.config import get_rougail_config
from rougail.output_doc import RougailOutputDoc
def _test(modes):
test_dir = Path(__file__).resolve().parent
rougailconfig = get_rougail_config(backward_compatibility=False)
rougailconfig['step.output'] = 'doc'
# rougailconfig['tiramisu_cache'] = 'p.py'
dirs = [str(test_dir / 'mode')]
rougailconfig['modes_level'] = ['basic', 'standard', 'advanced']
rougailconfig['main_dictionaries'] = dirs
rougailconfig['doc.output_format'] = 'asciidoc'
rougailconfig['doc.disabled_modes'] = modes
inventory = RougailOutputDoc(rougailconfig=rougailconfig)
doc = inventory.gen_doc()
result_file = test_dir / f'mode_{"_".join(modes)}.adoc'
if not result_file.is_file():
with open(str(result_file), 'w') as docfh:
docfh.write(doc)
with open(str(result_file)) as docfh:
result = docfh.read()
assert doc == result
def test_mode_advanced():
_test(['basic', 'standard'])
def test_mode_basic_only():
_test(['standard', 'advanced'])
def test_mode_standard():
_test(['basic', 'advanced'])
def test_mode_standard_advanced():
_test(['basic'])
def test_mode_basic_advanced():
_test(['standard'])
def test_mode_basic_standard():
_test(['advanced'])