""" 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 CommonFormatter, dump class Formatter(CommonFormatter): """The asciidoc formatter""" 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, inside_table: bool=True, ) -> str: """Display a liste of element""" prefix = "