Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 843d72406b | |||
| 5a7b69472f | |||
| 360ce32d18 | |||
| 7d673766c8 | |||
| 64c8dcb63e | |||
| ddf3267146 |
6 changed files with 97 additions and 212 deletions
205
CHANGELOG.md
205
CHANGELOG.md
|
|
@ -1,199 +1,52 @@
|
|||
## 0.1.0a26 (2026-06-11)
|
||||
## 1.0.0 (2026-06-21)
|
||||
|
||||
### Feat
|
||||
|
||||
- leadership => sequence
|
||||
|
||||
## 0.1.0a25 (2026-04-30)
|
||||
|
||||
### Fix
|
||||
|
||||
- better path detection
|
||||
|
||||
## 0.1.0a24 (2025-12-30)
|
||||
|
||||
### Feat
|
||||
|
||||
- add doc
|
||||
|
||||
### Fix
|
||||
|
||||
- update tests
|
||||
|
||||
## 0.1.0a23 (2025-12-22)
|
||||
|
||||
### Fix
|
||||
|
||||
- update tests
|
||||
|
||||
## 0.1.0a22 (2025-11-21)
|
||||
|
||||
### Fix
|
||||
|
||||
- ExtentionError => ExtensionError
|
||||
|
||||
## 0.1.0a21 (2025-11-06)
|
||||
|
||||
### Feat
|
||||
|
||||
- add some tests
|
||||
|
||||
### Fix
|
||||
|
||||
- always remove choice type + support warnings
|
||||
|
||||
## 0.1.0a20 (2025-11-03)
|
||||
|
||||
### Feat
|
||||
|
||||
- allow extra kwargs
|
||||
|
||||
### Fix
|
||||
|
||||
- update tests
|
||||
|
||||
## 0.1.0a19 (2025-10-10)
|
||||
|
||||
### Fix
|
||||
|
||||
- update tests
|
||||
- tests
|
||||
|
||||
## 0.1.0a18 (2025-09-30)
|
||||
|
||||
### Feat
|
||||
|
||||
- family or dynamic could needs type attribute
|
||||
|
||||
## 0.1.0a17 (2025-09-29)
|
||||
|
||||
### Feat
|
||||
|
||||
- param line size
|
||||
|
||||
### Fix
|
||||
|
||||
- support numeric string
|
||||
|
||||
## 0.1.0a16 (2025-09-29)
|
||||
|
||||
### Feat
|
||||
|
||||
- variable with an index is an integer variable
|
||||
- default value for a calculated variable with an unknown optional variable
|
||||
- **#26**: convert cidr and network_cidr format
|
||||
- add integer type which will replace number type
|
||||
|
||||
## 0.1.0a15 (2025-09-22)
|
||||
|
||||
### Fix
|
||||
|
||||
- dictionary => structure
|
||||
|
||||
## 0.1.0a14 (2025-06-18)
|
||||
|
||||
### Fix
|
||||
|
||||
- rougail separation
|
||||
|
||||
## 0.1.0a13 (2025-05-15)
|
||||
|
||||
### Fix
|
||||
|
||||
- no multi empty line when a variable finish by a multi line description
|
||||
|
||||
## 0.1.0a12 (2025-05-12)
|
||||
|
||||
### Fix
|
||||
|
||||
- black
|
||||
|
||||
## 0.1.0a11 (2025-05-09)
|
||||
|
||||
### Fix
|
||||
|
||||
- format with default_dictionary_format_version configuration
|
||||
|
||||
## 0.1.0a10 (2025-05-02)
|
||||
|
||||
### Fix
|
||||
|
||||
- do not load use_data with rougail cli
|
||||
- support {{ suffix }} name in 1.1 format version
|
||||
|
||||
## 0.1.0a9 (2025-04-30)
|
||||
|
||||
### Feat
|
||||
|
||||
- add yamllint validation
|
||||
|
||||
### Fix
|
||||
|
||||
- update tests
|
||||
- add version
|
||||
|
||||
## 0.1.0a8 (2025-04-01)
|
||||
|
||||
### Fix
|
||||
|
||||
- update tests
|
||||
|
||||
## 0.1.0a7 (2025-03-30)
|
||||
|
||||
### Feat
|
||||
|
||||
- support multi lines for help
|
||||
|
||||
## 0.1.0a6 (2025-03-28)
|
||||
|
||||
### Fix
|
||||
|
||||
- do not add multi \n at ends of export
|
||||
|
||||
## 0.1.0a5 (2025-03-27)
|
||||
|
||||
### Fix
|
||||
|
||||
- if and for in 3 lines
|
||||
|
||||
## 0.1.0a4 (2025-03-27)
|
||||
|
||||
### Feat
|
||||
|
||||
- format jinja template
|
||||
|
||||
## 0.1.0a3 (2025-03-27)
|
||||
|
||||
### Feat
|
||||
|
||||
- add secret_manager support
|
||||
- add Namespace(Param|Calculation) support
|
||||
|
||||
### Fix
|
||||
|
||||
- do not add namespace in param
|
||||
- an empty variable is []
|
||||
|
||||
## 0.1.0a2 (2025-03-26)
|
||||
|
||||
### Fix
|
||||
|
||||
- pyproject.toml
|
||||
|
||||
## 0.1.0a1 (2025-03-26)
|
||||
|
||||
### Fix
|
||||
|
||||
- add pyproject.toml
|
||||
|
||||
## 0.1.0a0 (2025-02-10)
|
||||
|
||||
### Feat
|
||||
|
||||
- output return status too
|
||||
|
||||
## 0.0.1a0 (2025-01-04)
|
||||
|
||||
### Fix
|
||||
|
||||
- rougail dependencies
|
||||
- black
|
||||
- update tests
|
||||
- better path detection
|
||||
- update tests
|
||||
- update tests
|
||||
- ExtentionError => ExtensionError
|
||||
- always remove choice type + support warnings
|
||||
- update tests
|
||||
- update tests
|
||||
- tests
|
||||
- support numeric string
|
||||
- dictionary => structure
|
||||
- rougail separation
|
||||
- no multi empty line when a variable finish by a multi line description
|
||||
- black
|
||||
- format with default_dictionary_format_version configuration
|
||||
- do not load use_data with rougail cli
|
||||
- support {{ suffix }} name in 1.1 format version
|
||||
- update tests
|
||||
- add version
|
||||
- update tests
|
||||
- do not add multi \n at ends of export
|
||||
- if and for in 3 lines
|
||||
- do not add namespace in param
|
||||
- an empty variable is []
|
||||
- pyproject.toml
|
||||
- add pyproject.toml
|
||||
- remove prefix_path
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "rougail.output_formatter"
|
||||
version = "0.1.0a26"
|
||||
version = "1.0.0"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "Rougail output formatter"
|
||||
|
|
@ -24,8 +24,8 @@ classifiers = [
|
|||
|
||||
]
|
||||
dependencies = [
|
||||
"rougail >= 1.1,<2",
|
||||
"djlint == 1.36.4",
|
||||
"rougail >= 1.2.0,<2",
|
||||
"djlint == 1.39.2",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
|
|
|||
|
|
@ -172,10 +172,16 @@ class RougailOutputFormatter:
|
|||
filenames = self.rougailconfig["main_structural_directories"]
|
||||
extra = False
|
||||
if len(filenames) > 1:
|
||||
raise ExtensionError(_('only one filename is allowed, not "{0}"').format(filenames))
|
||||
raise ExtensionError(
|
||||
_('only one filename is allowed, not "{0}"').format(filenames)
|
||||
)
|
||||
filename = Path(filenames[0])
|
||||
if not filename.is_file():
|
||||
raise ExtensionError(_('"{0}" is not a valid file, but only a file is allowed').format(filename))
|
||||
raise ExtensionError(
|
||||
_('"{0}" is not a valid file, but only a file is allowed').format(
|
||||
filename
|
||||
)
|
||||
)
|
||||
|
||||
self.version_name, self.original_yaml = RougailUpgrade(self.rougailconfig).run(
|
||||
filename
|
||||
|
|
@ -272,19 +278,19 @@ class RougailOutputFormatter:
|
|||
for child_path in self.rougail.parents[path]:
|
||||
child = self.rougail.objects
|
||||
if self.rougail.has_namespace:
|
||||
split_path = child_path.split('.')[1:]
|
||||
split_path = child_path.split(".")[1:]
|
||||
else:
|
||||
split_path = child_path.split('.')
|
||||
split_path = child_path.split(".")
|
||||
for cpath in split_path:
|
||||
if cpath not in child and '{{ identifier }}' in cpath:
|
||||
if cpath not in child and "{{ identifier }}" in cpath:
|
||||
# support format 1.0
|
||||
if cpath.replace('{{ identifier }}', '') in child:
|
||||
cpath = cpath.replace('{{ identifier }}', '')
|
||||
elif cpath.replace('{{ identifier }}', '{{ suffix }}') in child:
|
||||
cpath = cpath.replace('{{ identifier }}', '{{ suffix }}')
|
||||
if cpath.replace("{{ identifier }}", "") in child:
|
||||
cpath = cpath.replace("{{ identifier }}", "")
|
||||
elif cpath.replace("{{ identifier }}", "{{ suffix }}") in child:
|
||||
cpath = cpath.replace("{{ identifier }}", "{{ suffix }}")
|
||||
child = child[cpath]
|
||||
tmp_family[cpath] = child
|
||||
#family_type = self.rougail.is_family_or_variable("", tmp_family, False, "")
|
||||
# family_type = self.rougail.is_family_or_variable("", tmp_family, False, "")
|
||||
collect = Collect(
|
||||
self.rougail,
|
||||
name,
|
||||
|
|
@ -299,7 +305,7 @@ class RougailOutputFormatter:
|
|||
if family_type == "family":
|
||||
family_type = collect.user_type
|
||||
if family_type is None:
|
||||
family_type = 'family'
|
||||
family_type = "family"
|
||||
if family_type == type_:
|
||||
if "_type" in family:
|
||||
del family["_type"]
|
||||
|
|
@ -346,16 +352,16 @@ class RougailOutputFormatter:
|
|||
type_ = obj.type
|
||||
if type_ in RENAME_TYPE:
|
||||
type_ = RENAME_TYPE[type_]
|
||||
if type_ == 'cidr' or type_ == 'network_cidr':
|
||||
if type_ == 'cidr':
|
||||
type_ = 'ip'
|
||||
if type_ == "cidr" or type_ == "network_cidr":
|
||||
if type_ == "cidr":
|
||||
type_ = "ip"
|
||||
else:
|
||||
type_ = 'network'
|
||||
type_ = "network"
|
||||
if not obj.params:
|
||||
obj.params = []
|
||||
key = 'cidr'
|
||||
key = "cidr"
|
||||
param = AnyParam(
|
||||
key='cidr',
|
||||
key="cidr",
|
||||
value=True,
|
||||
type="any",
|
||||
path=None,
|
||||
|
|
@ -365,7 +371,7 @@ class RougailOutputFormatter:
|
|||
xmlfiles=obj.xmlfiles,
|
||||
)
|
||||
obj.params.append(param)
|
||||
if type_ == 'choice':
|
||||
if type_ == "choice":
|
||||
variable_obj = self.rougail.choices
|
||||
elif type_ == "regexp":
|
||||
variable_obj = self.rougail.regexp
|
||||
|
|
@ -385,7 +391,9 @@ class RougailOutputFormatter:
|
|||
continue
|
||||
value = self.object_to_yaml(attr, type_, value, multi, path)
|
||||
if isinstance(value, dict) and "identifier" in value:
|
||||
value["identifier"] = self.object_to_yaml("identifier", type_, value["identifier"], True, path)
|
||||
value["identifier"] = self.object_to_yaml(
|
||||
"identifier", type_, value["identifier"], True, path
|
||||
)
|
||||
variable[attr] = value
|
||||
if variable.get("mandatory") is True and None not in variable.get(
|
||||
"choices", []
|
||||
|
|
@ -395,14 +403,20 @@ class RougailOutputFormatter:
|
|||
if isinstance(obj.default, VariableCalculation):
|
||||
is_multi = "multi" in variable and variable["multi"] is True
|
||||
if "type" in variable or is_multi:
|
||||
other_path = self.rougail.paths.get_full_path(obj.default.variable, path)
|
||||
other_path = self.rougail.paths.get_full_path(
|
||||
obj.default.variable, path
|
||||
)
|
||||
if other_path in self.rougail.paths:
|
||||
other_obj = self.rougail.paths[other_path]
|
||||
if "type" in variable and variable["type"] == other_obj.type:
|
||||
del variable["type"]
|
||||
if is_multi and obj.multi:
|
||||
del variable["multi"]
|
||||
if "type" in variable and isinstance(obj.default, IndexCalculation) and variable["type"] == "integer":
|
||||
if (
|
||||
"type" in variable
|
||||
and isinstance(obj.default, IndexCalculation)
|
||||
and variable["type"] == "integer"
|
||||
):
|
||||
del variable["type"]
|
||||
if "type" in variable and variable["type"] in [
|
||||
"string",
|
||||
|
|
@ -555,7 +569,9 @@ class RougailOutputFormatter:
|
|||
jinja["return_type"] = return_type
|
||||
if value.description:
|
||||
if "\n" in value.description:
|
||||
jinja["description"] = LiteralScalarString(value.description.strip())
|
||||
jinja["description"] = LiteralScalarString(
|
||||
value.description.strip()
|
||||
)
|
||||
else:
|
||||
jinja["description"] = value.description.strip()
|
||||
if value.warnings:
|
||||
|
|
@ -598,7 +614,9 @@ class RougailOutputFormatter:
|
|||
del variable["type"]
|
||||
if value.description:
|
||||
if "\n" in value.description:
|
||||
variable["description"] = LiteralScalarString(value.description.strip())
|
||||
variable["description"] = LiteralScalarString(
|
||||
value.description.strip()
|
||||
)
|
||||
else:
|
||||
variable["description"] = value.description.strip()
|
||||
return variable
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "0.1.0a26"
|
||||
__version__ = "1.0.0"
|
||||
|
|
|
|||
|
|
@ -24,4 +24,3 @@ t = translation(
|
|||
)
|
||||
|
||||
_ = t.gettext
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
%YAML 1.2
|
||||
---
|
||||
version: 1.1
|
||||
|
||||
var: # A suffix variable
|
||||
- val1
|
||||
- val2
|
||||
|
||||
dyn{{ identifier }}:
|
||||
description: A dynamic family
|
||||
dynamic:
|
||||
variable: _.var
|
||||
|
||||
variable: # A dynamic variable
|
||||
...
|
||||
Loading…
Reference in a new issue