|
@ -157,9 +157,10 @@ class OutputGenerator: |
|
|
self.generate_MetaList(e) |
|
|
self.generate_MetaList(e) |
|
|
else: |
|
|
else: |
|
|
try: |
|
|
try: |
|
|
self.TYPE_DICT_MISC[type(e)](e) |
|
|
method = self.TYPE_DICT_MISC[type(e)] |
|
|
except KeyError as err: |
|
|
except KeyError as err: |
|
|
raise UnknownElementError(type(e)) from err |
|
|
raise UnknownElementError(type(e)) from err |
|
|
|
|
|
method(e) |
|
|
if isinstance(e, Group): |
|
|
if isinstance(e, Group): |
|
|
self.context = old_context |
|
|
self.context = old_context |
|
|
except FormatitkoRecursiveError as err: |
|
|
except FormatitkoRecursiveError as err: |
|
@ -292,9 +293,10 @@ class OutputGenerator: |
|
|
|
|
|
|
|
|
def generate_MetaValue(self, e: MetaValue): |
|
|
def generate_MetaValue(self, e: MetaValue): |
|
|
try: |
|
|
try: |
|
|
self.TYPE_DICT_META[type(e)](e) |
|
|
method = self.TYPE_DICT_META[type(e)] |
|
|
except KeyError: |
|
|
except KeyError: |
|
|
self.generate(e.content) |
|
|
self.generate(e.content) |
|
|
|
|
|
method(e) |
|
|
|
|
|
|
|
|
def generate_MetaBlocks(self, e: MetaBlocks): |
|
|
def generate_MetaBlocks(self, e: MetaBlocks): |
|
|
self.generate(e.content) |
|
|
self.generate(e.content) |
|
@ -303,16 +305,23 @@ class OutputGenerator: |
|
|
self.generate(e.content) |
|
|
self.generate(e.content) |
|
|
|
|
|
|
|
|
def generate_MetaBool(self, e: MetaBool): |
|
|
def generate_MetaBool(self, e: MetaBool): |
|
|
self.generate_simple_tag(e) |
|
|
if e.boolean: |
|
|
|
|
|
self.write("True") |
|
|
|
|
|
else: |
|
|
|
|
|
self.write("False") |
|
|
|
|
|
|
|
|
def generate_MetaMap(self, e: MetaMap): |
|
|
def generate_MetaMap(self, e: MetaMap): |
|
|
self.generate_simple_tag(e) |
|
|
self.generate_simple_tag(e) |
|
|
|
|
|
|
|
|
def generate_MetaString(self, e: MetaString): |
|
|
def generate_MetaString(self, e: MetaString): |
|
|
self.generate_simple_tag(e) |
|
|
self.write(e.text) |
|
|
|
|
|
|
|
|
def generate_Inline(self, e: Inline): |
|
|
def generate_Inline(self, e: Inline): |
|
|
self.TYPE_DICT_INLINE[type(e)](e) |
|
|
try: |
|
|
|
|
|
method = self.TYPE_DICT_INLINE[type(e)] |
|
|
|
|
|
except KeyError as err: |
|
|
|
|
|
raise UnknownElementError(type(e)) from err |
|
|
|
|
|
method(e) |
|
|
|
|
|
|
|
|
def generate_Str(self, e: Str): |
|
|
def generate_Str(self, e: Str): |
|
|
self.write(self.escape_special_chars(e.text)) |
|
|
self.write(self.escape_special_chars(e.text)) |
|
@ -413,7 +422,11 @@ class OutputGenerator: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_Block(self, e: Block): |
|
|
def generate_Block(self, e: Block): |
|
|
self.TYPE_DICT_BLOCK[type(e)](e) |
|
|
try: |
|
|
|
|
|
method = self.TYPE_DICT_BLOCK[type(e)] |
|
|
|
|
|
except KeyError as err: |
|
|
|
|
|
raise UnknownElementError(type(e)) from err |
|
|
|
|
|
method(e) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Block elements |
|
|
# Block elements |
|
|