From 5c066d46afb04844531c384380f682247075ac39 Mon Sep 17 00:00:00 2001 From: Greenscreener Date: Tue, 20 Feb 2024 01:00:36 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20handlov=C3=A1n=C3=AD=20cest=20obr=C3=A1zk?= =?UTF-8?q?=C5=AF,=20kdy=C5=BE=20jsou=20namespacov=C3=A9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/formatitko/html_generator.py | 1 + src/formatitko/images.py | 3 +++ src/formatitko/tex_generator.py | 1 + 3 files changed, 5 insertions(+) diff --git a/src/formatitko/html_generator.py b/src/formatitko/html_generator.py index 54002ce..46e54a4 100644 --- a/src/formatitko/html_generator.py +++ b/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:] diff --git a/src/formatitko/images.py b/src/formatitko/images.py index 0f65b7b..93bc2bc 100644 --- a/src/formatitko/images.py +++ b/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) diff --git a/src/formatitko/tex_generator.py b/src/formatitko/tex_generator.py index 570478e..143e4a9 100644 --- a/src/formatitko/tex_generator.py +++ b/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:]