|
|
@ -20,6 +20,7 @@ class OutputGenerator: |
|
|
|
self.indent_str = indent_str |
|
|
|
self.indent_level = initial_indent_level |
|
|
|
self._at_start_of_line = True |
|
|
|
self.current_context = None |
|
|
|
|
|
|
|
self.TYPE_DICT_MISC = { |
|
|
|
TableRow: self.generate_TableRow, |
|
|
@ -87,6 +88,9 @@ class OutputGenerator: |
|
|
|
} |
|
|
|
|
|
|
|
def generate(self, e: Union[Element, ListContainer, list[Union[Element, ListContainer]]]): |
|
|
|
if isinstance(e, Group): |
|
|
|
old_context = self.current_context |
|
|
|
self.current_context = e.context |
|
|
|
if isinstance(e, list): |
|
|
|
for el in e: |
|
|
|
self.generate(el) |
|
|
@ -101,6 +105,8 @@ class OutputGenerator: |
|
|
|
self.TYPE_DICT_MISC[type(e)](e) |
|
|
|
except KeyError: |
|
|
|
raise UnknownElementError(type(e)) |
|
|
|
if isinstance(e, Group): |
|
|
|
self.current_context = old_context |
|
|
|
|
|
|
|
def escape_special_chars(self, text: str) -> str: |
|
|
|
return text |
|
|
|