fix: yaml in output format do not convert object to str

This commit is contained in:
egarette@silique.fr 2026-01-14 15:37:50 +01:00
parent 9e2812c542
commit 78b649cf39
5 changed files with 7 additions and 7 deletions

View file

@ -21,7 +21,7 @@ from ruamel.yaml import CommentedMap
from ruamel.yaml.representer import RoundTripRepresenter
from .utils import _, calc_path
from .utils import _, calc_path, dump
# XXX explicit null (see rougail-output-formatter
@ -69,7 +69,7 @@ class Examples: # pylint: disable=no-member,too-few-public-methods
self.formatter.title(
_("Example with mandatory variables not filled in"), self.level
),
self.formatter.yaml(examples_mandatories),
self.formatter.yaml(dump(examples_mandatories)),
self.formatter.end_family(self.level),
])
if self.examples:
@ -84,7 +84,7 @@ class Examples: # pylint: disable=no-member,too-few-public-methods
datas.extend([self.formatter.title(
_("Example with all variables modifiable"), self.level
),
self.formatter.yaml(examples),
self.formatter.yaml(dump(examples)),
self.formatter.end_family(self.level),
])
return self.formatter.compute(datas)

View file

@ -124,7 +124,7 @@ class Formatter(CommonFormatter):
def yaml(self, _dump: dict) -> str:
"""Dump yaml part of documentation"""
return f"[,yaml]\n----\n---\n{dump(_dump)}\n----\n"
return f"[,yaml]\n----\n---\n{_dump}\n----\n"
def tabular(self, with_header: bool = True) -> str:
"""Transform list to a tabular in string format

View file

@ -164,7 +164,7 @@ class Formatter(CommonFormatter):
def yaml(self, _dump):
"""Dump yaml part of documentation"""
return self.rich_syntaxt(f'---\n{dump(_dump)}', 'yaml')
return self.rich_syntaxt(f'---\n{_dump}', 'yaml')
def link(
self,

View file

@ -147,7 +147,7 @@ class Formatter(CommonFormatter):
def yaml(self, _dump):
"""Dump yaml part of documentation"""
return f"```yaml\n---\n{dump(_dump)}\n```\n"
return f"```yaml\n---\n{_dump}\n```\n"
def link_variable(self,
path: str,

View file

@ -124,7 +124,7 @@ class Formatter(CommonFormatter):
def yaml(self, _dump: dict) -> str:
"""Dump yaml part of documentation"""
return f"<pre>{dump(_dump)}</pre>"
return f"<pre>{_dump}</pre>"
def link(
self,