Browse Source

Fix handlování cest obrázků, když jsou namespacové.

separate-katex-repo
Jan Černohorský 10 months ago
parent
commit
5c066d46af
  1. 1
      src/formatitko/html_generator.py
  2. 3
      src/formatitko/images.py
  3. 1
      src/formatitko/tex_generator.py

1
src/formatitko/html_generator.py

@ -143,6 +143,7 @@ class HTMLGenerator(OutputGenerator):
rel_dir = self.context.rel_dir
searcher = self.imageProcessor.get_searcher_by_path(url, rel_dir, source_dir)
url = self.imageProcessor.get_path_without_namespace(url)
_, ext = os.path.splitext(url)
ext = ext[1:]

3
src/formatitko/images.py

@ -149,6 +149,9 @@ class ImageProcessor:
def get_namespace_by_path(self, path: str) -> ImageProcessorNamespace:
return self.namespaces[path.split(":")[0] if ":" in path else ""]
def get_path_without_namespace(self, path: str) -> str:
return ":".join(path.split(":")[1:])
def get_searcher_by_path(self, path: str, rel_dir: str, source_dir: str) -> ImageProcessorNamespaceSearcher:
return ImageProcessorNamespaceSearcher(self.get_namespace_by_path(path), rel_dir, source_dir)

1
src/formatitko/tex_generator.py

@ -117,6 +117,7 @@ class UCWTexGenerator(OutputGenerator):
rel_dir = self.context.rel_dir
searcher = self.imageProcessor.get_searcher_by_path(url, rel_dir, source_dir)
url = self.imageProcessor.get_path_without_namespace(url)
_, ext = os.path.splitext(url)
ext = ext[1:]

Loading…
Cancel
Save