diff --git a/src/formatitko/command_util.py b/src/formatitko/command_util.py index 8b01ca2..002aa8c 100644 --- a/src/formatitko/command_util.py +++ b/src/formatitko/command_util.py @@ -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 diff --git a/src/formatitko/context.py b/src/formatitko/context.py index ac13b7e..caa321c 100644 --- a/src/formatitko/context.py +++ b/src/formatitko/context.py @@ -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: diff --git a/src/formatitko/images.py b/src/formatitko/images.py index 09eb748..73220dc 100644 --- a/src/formatitko/images.py +++ b/src/formatitko/images.py @@ -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') diff --git a/src/formatitko/tex_generator.py b/src/formatitko/tex_generator.py index 59f1572..c97b90d 100644 --- a/src/formatitko/tex_generator.py +++ b/src/formatitko/tex_generator.py @@ -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)