diff --git a/src/rougail/output_doc/config.py b/src/rougail/output_doc/config.py
index 2f1da03..b3083ab 100644
--- a/src/rougail/output_doc/config.py
+++ b/src/rougail/output_doc/config.py
@@ -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
diff --git a/src/rougail/output_doc/doc.py b/src/rougail/output_doc/doc.py
index 05bb85a..500db2b 100644
--- a/src/rougail/output_doc/doc.py
+++ b/src/rougail/output_doc/doc.py
@@ -18,6 +18,7 @@ along with this program. If not, see .
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
diff --git a/tests/docs/base/12_1auto_save_expert.adoc b/tests/docs/base/12_1auto_save_expert.adoc
index 82f7a9f..202da56 100644
--- a/tests/docs/base/12_1auto_save_expert.adoc
+++ b/tests/docs/base/12_1auto_save_expert.adoc
@@ -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
+|====
+
diff --git a/tests/docs/base/12_1auto_save_expert.json b/tests/docs/base/12_1auto_save_expert.json
index 9e26dfe..368617e 100644
--- a/tests/docs/base/12_1auto_save_expert.json
+++ b/tests/docs/base/12_1auto_save_expert.json
@@ -1 +1 @@
-{}
\ No newline at end of file
+{"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."]}}}}
\ No newline at end of file
diff --git a/tests/docs/base/12_1auto_save_expert.md b/tests/docs/base/12_1auto_save_expert.md
index 7ae5957..3f43608 100644
--- a/tests/docs/base/12_1auto_save_expert.md
+++ b/tests/docs/base/12_1auto_save_expert.md
@@ -13,3 +13,9 @@ var:
mode: advanced
default: no
```
+# Variables for "Rougail"
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **rougail.var**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `advanced` `mandatory` `auto modified` | A variable.
**Default**: no |
+
diff --git a/tests/docs/base/12_1auto_save_expert.sh b/tests/docs/base/12_1auto_save_expert.sh
index c6d92a9..ae30a61 100644
--- a/tests/docs/base/12_1auto_save_expert.sh
+++ b/tests/docs/base/12_1auto_save_expert.sh
@@ -9,3 +9,16 @@ var:
mode: advanced
default: no
```
+┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
+┃ [1mVariables for "Rougail"[0m ┃
+┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
+
+
+
+
+ [1m [0m[1mVariable [0m[1m [0m [1m [0m[1mDescription [0m[1m [0m
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ [1mrougail.var[0m
+ [1;36;40mstring[0m [1;36;40madvanced[0m [1;36;40mmandatory[0m [1;36;40mauto modified[0m A variable.
+ [1mDefault[0m: no
+
diff --git a/tests/docs/base/20_0multi_family_expert.adoc b/tests/docs/base/20_0multi_family_expert.adoc
index 63dadfe..2ceead2 100644
--- a/tests/docs/base/20_0multi_family_expert.adoc
+++ b/tests/docs/base/20_0multi_family_expert.adoc
@@ -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.
+|====
+
diff --git a/tests/docs/base/20_0multi_family_expert.json b/tests/docs/base/20_0multi_family_expert.json
index 9e26dfe..1d55adc 100644
--- a/tests/docs/base/20_0multi_family_expert.json
+++ b/tests/docs/base/20_0multi_family_expert.json
@@ -1 +1 @@
-{}
\ No newline at end of file
+{"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."]}}}}}}}}
\ No newline at end of file
diff --git a/tests/docs/base/20_0multi_family_expert.md b/tests/docs/base/20_0multi_family_expert.md
index 1340984..9f0669d 100644
--- a/tests/docs/base/20_0multi_family_expert.md
+++ b/tests/docs/base/20_0multi_family_expert.md
@@ -15,3 +15,17 @@ family:
description: a variable
mandatory: false
```
+# Variables for "Rougail"
+
+## a family
+
+`advanced`
+
+### a sub family
+
+`advanced`
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **rougail.family.subfamily.variable**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `advanced` | A variable. |
+
diff --git a/tests/docs/base/20_0multi_family_expert.sh b/tests/docs/base/20_0multi_family_expert.sh
index daa11eb..1f5deee 100644
--- a/tests/docs/base/20_0multi_family_expert.sh
+++ b/tests/docs/base/20_0multi_family_expert.sh
@@ -11,3 +11,23 @@ family:
description: a variable
mandatory: false
```
+┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
+┃ [1mVariables for "Rougail"[0m ┃
+┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
+
+
+ [1;4ma family[0m
+
+[1;36;40madvanced[0m
+
+ [1ma sub family[0m
+
+[1;36;40madvanced[0m
+
+
+
+ [1m [0m[1mVariable [0m[1m [0m [1m [0m[1mDescription [0m[1m [0m
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ [1mrougail.family.subfamily.variable[0m
+ [1;36;40mstring[0m [1;36;40madvanced[0m A variable.
+
diff --git a/tests/docs/examples/12_1auto_save_expert.md b/tests/docs/examples/12_1auto_save_expert.md
index 7ae5957..c482fe2 100644
--- a/tests/docs/examples/12_1auto_save_expert.md
+++ b/tests/docs/examples/12_1auto_save_expert.md
@@ -13,3 +13,10 @@ var:
mode: advanced
default: no
```
+# Example with all variables modifiable
+
+```yaml
+---
+rougail:
+ var: no
+```
diff --git a/tests/docs/examples/20_0multi_family_expert.md b/tests/docs/examples/20_0multi_family_expert.md
index 1340984..7efdbbd 100644
--- a/tests/docs/examples/20_0multi_family_expert.md
+++ b/tests/docs/examples/20_0multi_family_expert.md
@@ -15,3 +15,12 @@ family:
description: a variable
mandatory: false
```
+# Example with all variables modifiable
+
+```yaml
+---
+rougail:
+ family:
+ subfamily:
+ variable: example
+```
diff --git a/tests/docs/no_namespace/12_1auto_save_expert.adoc b/tests/docs/no_namespace/12_1auto_save_expert.adoc
index 82f7a9f..90072b1 100644
--- a/tests/docs/no_namespace/12_1auto_save_expert.adoc
+++ b/tests/docs/no_namespace/12_1auto_save_expert.adoc
@@ -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
+|====
+
diff --git a/tests/docs/no_namespace/12_1auto_save_expert.json b/tests/docs/no_namespace/12_1auto_save_expert.json
index 9e26dfe..fe9baf5 100644
--- a/tests/docs/no_namespace/12_1auto_save_expert.json
+++ b/tests/docs/no_namespace/12_1auto_save_expert.json
@@ -1 +1 @@
-{}
\ No newline at end of file
+{"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."]}}
\ No newline at end of file
diff --git a/tests/docs/no_namespace/12_1auto_save_expert.md b/tests/docs/no_namespace/12_1auto_save_expert.md
index 7ae5957..e25582f 100644
--- a/tests/docs/no_namespace/12_1auto_save_expert.md
+++ b/tests/docs/no_namespace/12_1auto_save_expert.md
@@ -13,3 +13,9 @@ var:
mode: advanced
default: no
```
+# Variables
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **var**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `advanced` `mandatory` `auto modified` | A variable.
**Default**: no |
+
diff --git a/tests/docs/no_namespace/12_1auto_save_expert.sh b/tests/docs/no_namespace/12_1auto_save_expert.sh
index c6d92a9..2a180dd 100644
--- a/tests/docs/no_namespace/12_1auto_save_expert.sh
+++ b/tests/docs/no_namespace/12_1auto_save_expert.sh
@@ -9,3 +9,16 @@ var:
mode: advanced
default: no
```
+┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
+┃ [1mVariables[0m ┃
+┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
+
+
+
+
+ [1m [0m[1mVariable [0m[1m [0m [1m [0m[1mDescription [0m[1m [0m
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ [1mvar[0m
+ [1;36;40mstring[0m [1;36;40madvanced[0m [1;36;40mmandatory[0m [1;36;40mauto modified[0m A variable.
+ [1mDefault[0m: no
+
diff --git a/tests/docs/no_namespace/20_0multi_family_expert.adoc b/tests/docs/no_namespace/20_0multi_family_expert.adoc
index 63dadfe..657aabe 100644
--- a/tests/docs/no_namespace/20_0multi_family_expert.adoc
+++ b/tests/docs/no_namespace/20_0multi_family_expert.adoc
@@ -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.
+|====
+
diff --git a/tests/docs/no_namespace/20_0multi_family_expert.json b/tests/docs/no_namespace/20_0multi_family_expert.json
index 9e26dfe..3bbc3e2 100644
--- a/tests/docs/no_namespace/20_0multi_family_expert.json
+++ b/tests/docs/no_namespace/20_0multi_family_expert.json
@@ -1 +1 @@
-{}
\ No newline at end of file
+{"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."]}}}}}}
\ No newline at end of file
diff --git a/tests/docs/no_namespace/20_0multi_family_expert.md b/tests/docs/no_namespace/20_0multi_family_expert.md
index 1340984..8586972 100644
--- a/tests/docs/no_namespace/20_0multi_family_expert.md
+++ b/tests/docs/no_namespace/20_0multi_family_expert.md
@@ -15,3 +15,17 @@ family:
description: a variable
mandatory: false
```
+# Variables
+
+## a family
+
+`advanced`
+
+### a sub family
+
+`advanced`
+
+| Variable | Description |
+|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **family.subfamily.variable**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `advanced` | A variable. |
+
diff --git a/tests/docs/no_namespace/20_0multi_family_expert.sh b/tests/docs/no_namespace/20_0multi_family_expert.sh
index daa11eb..1e5debf 100644
--- a/tests/docs/no_namespace/20_0multi_family_expert.sh
+++ b/tests/docs/no_namespace/20_0multi_family_expert.sh
@@ -11,3 +11,23 @@ family:
description: a variable
mandatory: false
```
+┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
+┃ [1mVariables[0m ┃
+┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
+
+
+ [1;4ma family[0m
+
+[1;36;40madvanced[0m
+
+ [1ma sub family[0m
+
+[1;36;40madvanced[0m
+
+
+
+ [1m [0m[1mVariable [0m[1m [0m [1m [0m[1mDescription [0m[1m [0m
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ [1mfamily.subfamily.variable[0m
+ [1;36;40mstring[0m [1;36;40madvanced[0m A variable.
+
diff --git a/tests/mode/00_file.yml b/tests/mode/00_file.yml
new file mode 100644
index 0000000..80bd838
--- /dev/null
+++ b/tests/mode/00_file.yml
@@ -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
diff --git a/tests/mode_advanced.adoc b/tests/mode_advanced.adoc
new file mode 100644
index 0000000..6317f2b
--- /dev/null
+++ b/tests/mode_advanced.adoc
@@ -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".
+|====
+
diff --git a/tests/mode_basic.adoc b/tests/mode_basic.adoc
new file mode 100644
index 0000000..3bd1f36
--- /dev/null
+++ b/tests/mode_basic.adoc
@@ -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.
+|====
+
diff --git a/tests/mode_basic_advanced.adoc b/tests/mode_basic_advanced.adoc
new file mode 100644
index 0000000..af36353
--- /dev/null
+++ b/tests/mode_basic_advanced.adoc
@@ -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".
+|====
+
diff --git a/tests/mode_basic_standard.adoc b/tests/mode_basic_standard.adoc
new file mode 100644
index 0000000..c13b23d
--- /dev/null
+++ b/tests/mode_basic_standard.adoc
@@ -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.
+|====
+
diff --git a/tests/mode_standard.adoc b/tests/mode_standard.adoc
new file mode 100644
index 0000000..60007b7
--- /dev/null
+++ b/tests/mode_standard.adoc
@@ -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.
+|====
+
diff --git a/tests/mode_standard_advanced.adoc b/tests/mode_standard_advanced.adoc
new file mode 100644
index 0000000..ddb2d12
--- /dev/null
+++ b/tests/mode_standard_advanced.adoc
@@ -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.
+|====
+
diff --git a/tests/test_force_optional.py b/tests/test_force_optional.py
index cc470f0..cb9ee4e 100644
--- a/tests/test_force_optional.py
+++ b/tests/test_force_optional.py
@@ -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'
diff --git a/tests/test_mode.py b/tests/test_mode.py
new file mode 100644
index 0000000..e124c6b
--- /dev/null
+++ b/tests/test_mode.py
@@ -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'])