fix: yaml in output format do not convert object to str
This commit is contained in:
parent
9e2812c542
commit
78b649cf39
5 changed files with 7 additions and 7 deletions
|
|
@ -21,7 +21,7 @@ from ruamel.yaml import CommentedMap
|
||||||
from ruamel.yaml.representer import RoundTripRepresenter
|
from ruamel.yaml.representer import RoundTripRepresenter
|
||||||
|
|
||||||
|
|
||||||
from .utils import _, calc_path
|
from .utils import _, calc_path, dump
|
||||||
|
|
||||||
|
|
||||||
# XXX explicit null (see rougail-output-formatter
|
# XXX explicit null (see rougail-output-formatter
|
||||||
|
|
@ -69,7 +69,7 @@ class Examples: # pylint: disable=no-member,too-few-public-methods
|
||||||
self.formatter.title(
|
self.formatter.title(
|
||||||
_("Example with mandatory variables not filled in"), self.level
|
_("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),
|
self.formatter.end_family(self.level),
|
||||||
])
|
])
|
||||||
if self.examples:
|
if self.examples:
|
||||||
|
|
@ -84,7 +84,7 @@ class Examples: # pylint: disable=no-member,too-few-public-methods
|
||||||
datas.extend([self.formatter.title(
|
datas.extend([self.formatter.title(
|
||||||
_("Example with all variables modifiable"), self.level
|
_("Example with all variables modifiable"), self.level
|
||||||
),
|
),
|
||||||
self.formatter.yaml(examples),
|
self.formatter.yaml(dump(examples)),
|
||||||
self.formatter.end_family(self.level),
|
self.formatter.end_family(self.level),
|
||||||
])
|
])
|
||||||
return self.formatter.compute(datas)
|
return self.formatter.compute(datas)
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class Formatter(CommonFormatter):
|
||||||
|
|
||||||
def yaml(self, _dump: dict) -> str:
|
def yaml(self, _dump: dict) -> str:
|
||||||
"""Dump yaml part of documentation"""
|
"""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:
|
def tabular(self, with_header: bool = True) -> str:
|
||||||
"""Transform list to a tabular in string format
|
"""Transform list to a tabular in string format
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ class Formatter(CommonFormatter):
|
||||||
|
|
||||||
def yaml(self, _dump):
|
def yaml(self, _dump):
|
||||||
"""Dump yaml part of documentation"""
|
"""Dump yaml part of documentation"""
|
||||||
return self.rich_syntaxt(f'---\n{dump(_dump)}', 'yaml')
|
return self.rich_syntaxt(f'---\n{_dump}', 'yaml')
|
||||||
|
|
||||||
def link(
|
def link(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ class Formatter(CommonFormatter):
|
||||||
|
|
||||||
def yaml(self, _dump):
|
def yaml(self, _dump):
|
||||||
"""Dump yaml part of documentation"""
|
"""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,
|
def link_variable(self,
|
||||||
path: str,
|
path: str,
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class Formatter(CommonFormatter):
|
||||||
|
|
||||||
def yaml(self, _dump: dict) -> str:
|
def yaml(self, _dump: dict) -> str:
|
||||||
"""Dump yaml part of documentation"""
|
"""Dump yaml part of documentation"""
|
||||||
return f"<pre>{dump(_dump)}</pre>"
|
return f"<pre>{_dump}</pre>"
|
||||||
|
|
||||||
def link(
|
def link(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue