Menší změny po code review s @wipocket.

This commit is contained in:
Jan Černohorský 2023-10-01 15:33:34 +02:00
parent 63cd7a212a
commit 0f7ed0ae32
4 changed files with 5 additions and 6 deletions

View file

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

View file

@ -63,7 +63,7 @@ class Context:
self.set_command(prefix+name, func)
def is_flag_set(self, flag: str):
if self.get_metadata("flags."+flag):
if self.get_metadata("flags."+flag) is not None:
if self.get_metadata("flags."+flag):
return True
else:

View file

@ -125,7 +125,6 @@ class ImageProcessor:
return False
def publish_image(self, target_name, relative: bool=True) -> str:
import sys
cache_path = self.cache_dir + "/" + target_name
if not os.path.isfile(cache_path):
raise FileNotFoundError(f'Image {target_name} not cached')

View file

@ -123,7 +123,7 @@ class UCWTexGenerator(OutputGenerator):
# processing contains finding and moving them to the cache
# directory.
url = self.imageProcessor.process_image(url, ext, source_dir, **additional_args)
elif ext in ["svg"]:
elif ext in ["svg"]: # FIXME
url = self.imageProcessor.process_image(url, "pdf", source_dir, **additional_args)
elif ext in ["epdf"]:
url = self.imageProcessor.process_image(url, "pdf", source_dir, **additional_args)