Compare commits

..

No commits in common. "78096446dc2119a280aa2589772c85c03e510325" and "6f18fbb70197aa7a6a0e9899917709c91be9fc1f" have entirely different histories.

7 changed files with 7 additions and 73 deletions

View file

@ -1,9 +1,3 @@
## 0.1.0a18 (2025-09-30)
### Feat
- family or dynamic could needs type attribute
## 0.1.0a17 (2025-09-29)
### Feat

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.output_formatter"
version = "0.1.0a18"
version = "0.1.0a17"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail output formatter"

View file

@ -77,18 +77,6 @@ RoundTripRepresenter.add_representer(str, represent_str)
# XXX
class RougailConvertFormatter(RougailConvert):
def parse_root_file(
self,
filename: str,
path: str,
version: str,
objects: dict,
) -> None:
self.objects = objects
super().parse_root_file(filename, path, version, objects)
class RougailOutputFormatter:
output_name = "formatter"
@ -173,7 +161,7 @@ class RougailOutputFormatter:
filename
)
self.version_name, datas = RougailUpgrade(self.rougailconfig).run(filename)
self.rougail = RougailConvertFormatter(self.rougailconfig)
self.rougail = RougailConvert(self.rougailconfig)
self.rougail.load_config()
self.rougail.init()
self.filename_str = str(filename)
@ -251,36 +239,10 @@ class RougailOutputFormatter:
attr = f"_{attr}"
family[attr] = self.object_to_yaml(attr, type_, value, False, path)
if type_ == "dynamic" or (children and type_ == "family"):
tmp_family = family.copy()
if "_type" in tmp_family:
del tmp_family["_type"]
if "_type" in family:
del family["_type"]
else:
del tmp_family["type"]
for child_path in self.rougail.parents[path]:
child = self.rougail.objects
if self.rougail.has_namespace:
split_path = child_path.split('.')[1:]
else:
split_path = child_path.split('.')
for cpath in split_path:
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 }}')
child = child[cpath]
tmp_family[cpath] = child
family_type = self.rougail.is_family_or_variable("", tmp_family, False, "")
if family_type == "family":
family_type = self.rougail.get_family_or_variable_type(tmp_family)
if family_type is None:
family_type = 'family'
if family_type == type_:
if "_type" in family:
del family["_type"]
else:
del family["type"]
del family["type"]
if not set(family):
ret[name] = CommentedMap()
ret.yaml_value_comment_extend(

View file

@ -1 +1 @@
__version__ = "0.1.0a18"
__version__ = "0.1.0a17"

View file

@ -1,13 +0,0 @@
%YAML 1.2
---
version: 1.1
my_family:
type: family
dynamic:
- val1
- val2
var: true # a variable
...

View file

@ -1,9 +0,0 @@
%YAML 1.2
---
version: 1.1
my_family:
type: family
default: true
...

View file

@ -15,7 +15,7 @@ excludes = [
]
test_ok = get_structures_list(excludes)
# test_ok = [Path('../rougail-tests/structures/60_6family_dynamic_sub_dynamic_1_0_2')]
# test_ok = [Path('../rougail-tests/structures/40_2leadership_calculation_index')]
def idfn(fixture_value):