Menší změny po code review s @wipocket.
This commit is contained in:
parent
63cd7a212a
commit
0f7ed0ae32
4 changed files with 5 additions and 6 deletions
|
@ -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)
|
||||||
globals = command_env.__dict__
|
command_env = command_env.__dict__
|
||||||
exec(code, globals)
|
exec(code, command_env)
|
||||||
return globals["command"]
|
return command_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
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Context:
|
||||||
self.set_command(prefix+name, func)
|
self.set_command(prefix+name, func)
|
||||||
|
|
||||||
def is_flag_set(self, flag: str):
|
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):
|
if self.get_metadata("flags."+flag):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -125,7 +125,6 @@ class ImageProcessor:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def publish_image(self, target_name, relative: bool=True) -> str:
|
def publish_image(self, target_name, relative: bool=True) -> str:
|
||||||
import sys
|
|
||||||
cache_path = self.cache_dir + "/" + target_name
|
cache_path = self.cache_dir + "/" + target_name
|
||||||
if not os.path.isfile(cache_path):
|
if not os.path.isfile(cache_path):
|
||||||
raise FileNotFoundError(f'Image {target_name} not cached')
|
raise FileNotFoundError(f'Image {target_name} not cached')
|
||||||
|
|
|
@ -123,7 +123,7 @@ class UCWTexGenerator(OutputGenerator):
|
||||||
# processing contains finding and moving them to the cache
|
# processing contains finding and moving them to the cache
|
||||||
# directory.
|
# directory.
|
||||||
url = self.imageProcessor.process_image(url, ext, source_dir, **additional_args)
|
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)
|
url = self.imageProcessor.process_image(url, "pdf", source_dir, **additional_args)
|
||||||
elif ext in ["epdf"]:
|
elif ext in ["epdf"]:
|
||||||
url = self.imageProcessor.process_image(url, "pdf", source_dir, **additional_args)
|
url = self.imageProcessor.process_image(url, "pdf", source_dir, **additional_args)
|
||||||
|
|
Loading…
Reference in a new issue