diff --git a/src/rougail/output_doc/output/asciidoc.py b/src/rougail/output_doc/output/asciidoc.py index f563641a3..75ec4af9e 100644 --- a/src/rougail/output_doc/output/asciidoc.py +++ b/src/rougail/output_doc/output/asciidoc.py @@ -112,11 +112,11 @@ class Formater(CommonFormater): """Dump yaml part of documentation""" return f"[,yaml]\n----\n---\n{dump(_dump)}\n----\n" - def table(self, datas) -> str: + def table(self, datas: list, with_header: bool=True) -> str: """Transform list to a table in string format we change the first line because we want that col has the same width """ - table = super().table(datas) + table = super().table(datas, with_header) stable = table.split("\n", 1) return '[cols="1a,1a"]\n' + stable[1] diff --git a/src/rougail/output_doc/output/console.py b/src/rougail/output_doc/output/console.py index 56d0657b2..7ed84481a 100644 --- a/src/rougail/output_doc/output/console.py +++ b/src/rougail/output_doc/output/console.py @@ -154,11 +154,12 @@ class Formater(CommonFormater): for l in line.split(self.enter_table): self.max_line = max(self.max_line, len(l) + 1) - def table(self, datas: list) -> str: + def table(self, datas: list, with_header: bool=True) -> str: """Transform list to a table in string format""" table = self.rich_table(show_lines=True) - table.add_column(_("Variable"), width=self.max_line) - table.add_column(_("Description"), width=self.max_line) + if with_header: + table.add_column(_("Variable"), width=self.max_line) + table.add_column(_("Description"), width=self.max_line) for data in datas: table.add_row(str(data[0]), data[1]) return table diff --git a/src/rougail/output_doc/utils.py b/src/rougail/output_doc/utils.py index 6ce8cc2b8..0a22125bc 100644 --- a/src/rougail/output_doc/utils.py +++ b/src/rougail/output_doc/utils.py @@ -650,12 +650,16 @@ class CommonFormater: """Manage column""" return - def table(self, datas: list) -> str: + def table(self, datas: list, with_header: bool=True) -> str: """Transform list to a table in string format""" + if with_header: + headers = self.table_header([_("Variable"), _("Description")]) + else: + headers = () msg = ( tabulate( datas, - headers=self.table_header([_("Variable"), _("Description")]), + headers=headers, tablefmt=self._table_name, ) + "\n\n"