From 706ddd369e6c12ca16d96694305f70d0e5a11920 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 18 Jun 2025 07:42:33 +0300 Subject: [PATCH] fix: rougail separation --- src/rougail/output_doc/annotator.py | 2 +- src/rougail/output_doc/doc.py | 6 +- ...lated_variable_description_multi_line.adoc | 24 +++++ ...lated_variable_description_multi_line.json | 81 ++++++++++++++ ...culated_variable_description_multi_line.md | 9 ++ ...culated_variable_description_multi_line.sh | 15 +++ ...calculated_variable_description_multi_line | 1 + ...culated_variable_description_multi_line.md | 15 +++ ...calculated_variable_description_multi_line | 1 + ...lated_variable_description_multi_line.adoc | 26 +++++ ...lated_variable_description_multi_line.json | 101 ++++++++++++++++++ ...culated_variable_description_multi_line.md | 11 ++ ...culated_variable_description_multi_line.sh | 20 ++++ ...calculated_variable_description_multi_line | 1 + ...culated_variable_description_multi_line.md | 17 +++ ...calculated_variable_description_multi_line | 1 + 16 files changed, 327 insertions(+), 4 deletions(-) create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line.adoc create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line.json create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line.md create mode 100644 tests/results/test/00_2default_calculated_variable_description_multi_line.sh create mode 100644 tests/results/test/warnings_00_2default_calculated_variable_description_multi_line create mode 100644 tests/results/test_examples/00_2default_calculated_variable_description_multi_line.md create mode 100644 tests/results/test_examples/warnings_00_2default_calculated_variable_description_multi_line create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.adoc create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.json create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.md create mode 100644 tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.sh create mode 100644 tests/results/test_namespace/warnings_00_2default_calculated_variable_description_multi_line create mode 100644 tests/results/test_namespace_examples/00_2default_calculated_variable_description_multi_line.md create mode 100644 tests/results/test_namespace_examples/warnings_00_2default_calculated_variable_description_multi_line diff --git a/src/rougail/output_doc/annotator.py b/src/rougail/output_doc/annotator.py index 0c8e2f41a..5e433f937 100644 --- a/src/rougail/output_doc/annotator.py +++ b/src/rougail/output_doc/annotator.py @@ -25,7 +25,7 @@ from rougail.utils import undefined from rougail.annotator.variable import Walk from rougail.output_doc.i18n import _ -from rougail.object_model import ( +from rougail.convert.object_model import ( Calculation, JinjaCalculation, VariableCalculation, diff --git a/src/rougail/output_doc/doc.py b/src/rougail/output_doc/doc.py index a58038273..35fce9940 100644 --- a/src/rougail/output_doc/doc.py +++ b/src/rougail/output_doc/doc.py @@ -23,9 +23,9 @@ from re import compile from tiramisu import Calculation, groups from tiramisu.error import ConfigError, display_list, PropertiesOptionError -from rougail.error import display_xmlfiles -from rougail.object_model import PROPERTY_ATTRIBUTE -from rougail.utils import normalize_family, undefined +from rougail.tiramisu import display_xmlfiles, normalize_family +from rougail.convert.object_model import PROPERTY_ATTRIBUTE +from rougail.utils import undefined from .config import OutPuts from .i18n import _ diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line.adoc b/tests/results/test/00_2default_calculated_variable_description_multi_line.adoc new file mode 100644 index 000000000..cf0ec8c92 --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line.adoc @@ -0,0 +1,24 @@ +[cols="1a,1a"] +|==== +| Variable | Description +| + +**var1** + +`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `basic` `mandatory` | +A first variable. +| + +**var2** + +`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `standard` `mandatory` | +A second variable. + +**Default**: value +of +a +variable!. +| + +**var3** + +`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `basic` `mandatory` | +A new variable. +|==== + diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line.json b/tests/results/test/00_2default_calculated_variable_description_multi_line.json new file mode 100644 index 000000000..57e73ba14 --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line.json @@ -0,0 +1,81 @@ +{ + "var1": { + "type": "variable", + "properties": [ + { + "type": "type", + "name": "string" + }, + { + "type": "mode", + "name": "basic" + }, + { + "type": "property", + "name": "mandatory" + } + ], + "paths": [ + "var1" + ], + "names": [ + "var1" + ], + "descriptions": [ + "A first variable." + ] + }, + "var2": { + "type": "variable", + "default": "value\nof\na\nvariable!.", + "properties": [ + { + "type": "type", + "name": "string" + }, + { + "type": "mode", + "name": "standard" + }, + { + "type": "property", + "name": "mandatory" + } + ], + "paths": [ + "var2" + ], + "names": [ + "var2" + ], + "descriptions": [ + "A second variable." + ] + }, + "var3": { + "type": "variable", + "properties": [ + { + "type": "type", + "name": "string" + }, + { + "type": "mode", + "name": "basic" + }, + { + "type": "property", + "name": "mandatory" + } + ], + "paths": [ + "var3" + ], + "names": [ + "var3" + ], + "descriptions": [ + "A new variable." + ] + } +} \ No newline at end of file diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line.md b/tests/results/test/00_2default_calculated_variable_description_multi_line.md new file mode 100644 index 000000000..22d65e4a6 --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line.md @@ -0,0 +1,9 @@ +| Variable                                                                                                   | Description                                                                                                | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **var1**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | A first variable. | +| **var2**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | A second variable.
**Default**: value +of +a +variable!. | +| **var3**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | A new variable. | + diff --git a/tests/results/test/00_2default_calculated_variable_description_multi_line.sh b/tests/results/test/00_2default_calculated_variable_description_multi_line.sh new file mode 100644 index 000000000..ae2b1d1c7 --- /dev/null +++ b/tests/results/test/00_2default_calculated_variable_description_multi_line.sh @@ -0,0 +1,15 @@ +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ Variable  ┃ Description  ┃ +┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ +│ var1 │ A first variable. │ +│  string   basic   mandatory  │ │ +├───────────────────────────────────────┼──────────────────────────────────────┤ +│ var2 │ A second variable. │ +│  string   standard   mandatory  │ Default: value │ +│ │ of │ +│ │ a │ +│ │ variable!. │ +├───────────────────────────────────────┼──────────────────────────────────────┤ +│ var3 │ A new variable. │ +│  string   basic   mandatory  │ │ +└───────────────────────────────────────┴──────────────────────────────────────┘ diff --git a/tests/results/test/warnings_00_2default_calculated_variable_description_multi_line b/tests/results/test/warnings_00_2default_calculated_variable_description_multi_line new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/tests/results/test/warnings_00_2default_calculated_variable_description_multi_line @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/results/test_examples/00_2default_calculated_variable_description_multi_line.md b/tests/results/test_examples/00_2default_calculated_variable_description_multi_line.md new file mode 100644 index 000000000..f85d1a535 --- /dev/null +++ b/tests/results/test_examples/00_2default_calculated_variable_description_multi_line.md @@ -0,0 +1,15 @@ +# Example with mandatory variables not filled in + +```yaml +--- +var1: example +var3: example +``` +# Example with all variables modifiable + +```yaml +--- +var1: example +var2: example +var3: example +``` diff --git a/tests/results/test_examples/warnings_00_2default_calculated_variable_description_multi_line b/tests/results/test_examples/warnings_00_2default_calculated_variable_description_multi_line new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/tests/results/test_examples/warnings_00_2default_calculated_variable_description_multi_line @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.adoc b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.adoc new file mode 100644 index 000000000..ae43d23ec --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.adoc @@ -0,0 +1,26 @@ +== Variables for "Rougail" + +[cols="1a,1a"] +|==== +| Variable | Description +| + +**rougail.var1** + +`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `basic` `mandatory` | +A first variable. +| + +**rougail.var2** + +`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `standard` `mandatory` | +A second variable. + +**Default**: value +of +a +variable!. +| + +**rougail.var3** + +`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `basic` `mandatory` | +A new variable. +|==== + diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.json b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.json new file mode 100644 index 000000000..8d32597b3 --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.json @@ -0,0 +1,101 @@ +{ + "rougail": { + "type": "namespace", + "informations": { + "paths": [ + "rougail" + ], + "names": [ + "rougail" + ], + "description": "Rougail", + "properties": [ + { + "type": "mode", + "name": "basic" + } + ] + }, + "children": { + "rougail.var1": { + "type": "variable", + "properties": [ + { + "type": "type", + "name": "string" + }, + { + "type": "mode", + "name": "basic" + }, + { + "type": "property", + "name": "mandatory" + } + ], + "paths": [ + "rougail.var1" + ], + "names": [ + "var1" + ], + "descriptions": [ + "A first variable." + ] + }, + "rougail.var2": { + "type": "variable", + "default": "value\nof\na\nvariable!.", + "properties": [ + { + "type": "type", + "name": "string" + }, + { + "type": "mode", + "name": "standard" + }, + { + "type": "property", + "name": "mandatory" + } + ], + "paths": [ + "rougail.var2" + ], + "names": [ + "var2" + ], + "descriptions": [ + "A second variable." + ] + }, + "rougail.var3": { + "type": "variable", + "properties": [ + { + "type": "type", + "name": "string" + }, + { + "type": "mode", + "name": "basic" + }, + { + "type": "property", + "name": "mandatory" + } + ], + "paths": [ + "rougail.var3" + ], + "names": [ + "var3" + ], + "descriptions": [ + "A new variable." + ] + } + } + } +} \ No newline at end of file diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.md b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.md new file mode 100644 index 000000000..6cf0fa036 --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.md @@ -0,0 +1,11 @@ +# Variables for "Rougail" + +| Variable                                                                                                   | Description                                                                                                | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **rougail.var1**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | A first variable. | +| **rougail.var2**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | A second variable.
**Default**: value +of +a +variable!. | +| **rougail.var3**
[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | A new variable. | + diff --git a/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.sh b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.sh new file mode 100644 index 000000000..9c7402387 --- /dev/null +++ b/tests/results/test_namespace/00_2default_calculated_variable_description_multi_line.sh @@ -0,0 +1,20 @@ + + +Variables for "Rougail" + + +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ Variable  ┃ Description  ┃ +┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ +│ rougail.var1 │ A first variable. │ +│  string   basic   mandatory  │ │ +├───────────────────────────────────────┼──────────────────────────────────────┤ +│ rougail.var2 │ A second variable. │ +│  string   standard   mandatory  │ Default: value │ +│ │ of │ +│ │ a │ +│ │ variable!. │ +├───────────────────────────────────────┼──────────────────────────────────────┤ +│ rougail.var3 │ A new variable. │ +│  string   basic   mandatory  │ │ +└───────────────────────────────────────┴──────────────────────────────────────┘ diff --git a/tests/results/test_namespace/warnings_00_2default_calculated_variable_description_multi_line b/tests/results/test_namespace/warnings_00_2default_calculated_variable_description_multi_line new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/tests/results/test_namespace/warnings_00_2default_calculated_variable_description_multi_line @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/results/test_namespace_examples/00_2default_calculated_variable_description_multi_line.md b/tests/results/test_namespace_examples/00_2default_calculated_variable_description_multi_line.md new file mode 100644 index 000000000..2eda2f196 --- /dev/null +++ b/tests/results/test_namespace_examples/00_2default_calculated_variable_description_multi_line.md @@ -0,0 +1,17 @@ +# Example with mandatory variables not filled in + +```yaml +--- +rougail: + var1: example + var3: example +``` +# Example with all variables modifiable + +```yaml +--- +rougail: + var1: example + var2: example + var3: example +``` diff --git a/tests/results/test_namespace_examples/warnings_00_2default_calculated_variable_description_multi_line b/tests/results/test_namespace_examples/warnings_00_2default_calculated_variable_description_multi_line new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/tests/results/test_namespace_examples/warnings_00_2default_calculated_variable_description_multi_line @@ -0,0 +1 @@ +[] \ No newline at end of file