diff --git a/src/rougail/output_doc/changelog.py b/src/rougail/output_doc/changelog.py index 56f26a92b..396557c61 100644 --- a/src/rougail/output_doc/changelog.py +++ b/src/rougail/output_doc/changelog.py @@ -29,7 +29,7 @@ class Changelog: # pylint: disable=no-member,too-few-public-methods """Return changelog""" with Path(self.previous_json_file).open() as outfh: previous_doc = loads(outfh.read()) - self._tiramisu_to_internal_object() + self.load() self._added_variables = [] self._modified_variables = [] self._removed_variables = [] diff --git a/src/rougail/output_doc/doc.py b/src/rougail/output_doc/doc.py index 88a379646..7225e1fae 100644 --- a/src/rougail/output_doc/doc.py +++ b/src/rougail/output_doc/doc.py @@ -104,7 +104,7 @@ class RougailOutputDoc(Examples, Changelog): def run(self) -> str: """Print documentation in stdout""" - self._tiramisu_to_internal_object() + self.load() return_string = '' if "variables" in self.contents: return_string += self.formater.run(self.informations, self.level) @@ -119,7 +119,7 @@ class RougailOutputDoc(Examples, Changelog): print(data) return ret - def _tiramisu_to_internal_object(self): + def load(self): self.dynamic_paths = {} config = self.conf.unrestraint self._populate_dynamics(config) diff --git a/src/rougail/output_doc/output/html.py b/src/rougail/output_doc/output/html.py new file mode 100644 index 000000000..6fddc1cce --- /dev/null +++ b/src/rougail/output_doc/output/html.py @@ -0,0 +1,131 @@ +""" +Silique (https://www.silique.fr) +Copyright (C) 2025 + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published by the +Free Software Foundation, either version 3 of the License, or (at your +option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see . +""" + +from typing import List +from html import escape +from ..utils import CommonFormater, dump + + +class Formater(CommonFormater): + """The asciidoc formater""" + + name = "html" + _table_name = "unsafehtml" + level = 45 + + def title( + self, + title: str, + level: int, + ) -> str: + """Display family name as a title""" + return f"{title}\n\n" + + def join( + self, + lst: List[str], + ) -> str: + """Display line in table from a list""" + string = "" + previous = "" + for line in lst: + if string: +# if self.is_list(previous.split("\n", 1)[-1]): +# string += "

" +# else: + string += "
" + string += line + + previous = line + return string + + def bold( + self, + msg: str, + ) -> str: + """Set a text to bold""" + return f"{msg}" + + def italic( + self, + msg: str, + ) -> str: + """Set a text to italic""" + return f"{msg}" + + def delete( + self, + msg: str, + ) -> str: + """Set a text to deleted""" + return f"{msg}" + + def underline( + self, + msg: str, + ) -> str: + """Set a text to underline""" + return f"{msg}" + + def stripped( + self, + text: str, + ) -> str: + """Return stripped text (as help)""" + return text.strip() + + def list( + self, + choices: list, + ) -> str: + """Display a liste of element""" + prefix = "