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

This commit is contained in:
Jan Černohorský 2024-02-20 01:00:36 +01:00
parent caef60d472
commit 5c066d46af
3 changed files with 5 additions and 0 deletions

View file

@ -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:]

View file

@ -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)

View file

@ -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:]