Experimental error handling with snippets of input for OutputGenerator. #54

Merged
jan merged 5 commits from error-handling into master 2024-02-17 18:21:41 +01:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 2e76687172 - Show all commits

View file

@ -16,9 +16,9 @@ def parse_command(code: str) -> CommandCallable:
for line in code_lines: for line in code_lines:
indented_code_lines.append(("\t" if tabs else " ")+line) indented_code_lines.append(("\t" if tabs else " ")+line)
code = "def command(element: Command, context: Context) -> list[Element]:\n"+"\n".join(indented_code_lines) code = "def command(element: Command, context: Context) -> list[Element]:\n"+"\n".join(indented_code_lines)
command_env = command_env.__dict__ env = {**command_env.__dict__}
exec(code, command_env) exec(code, env)
return command_env["command"] return env["command"]
# This function is called in trasform.py, defining a command which can be # This function is called in trasform.py, defining a command which can be
# called later # called later

View file

@ -247,7 +247,7 @@ class HTMLGenerator(OutputGenerator):
if (e.format == "InlineMath"): if (e.format == "InlineMath"):
self.write(rawhtml) self.write(rawhtml)
else: else:
self.writeraw() self.writeraw(rawhtml)
def generate_RawInline(self, e: RawInline): def generate_RawInline(self, e: RawInline):
if e.format == "html": if e.format == "html":