diff --git a/renderer/fifty_ohm_html_renderer.py b/renderer/fifty_ohm_html_renderer.py index e50bcac..d83ebab 100644 --- a/renderer/fifty_ohm_html_renderer.py +++ b/renderer/fifty_ohm_html_renderer.py @@ -199,9 +199,9 @@ class FiftyOhmHtmlRenderer(HtmlRenderer): """ def render_picture(self, token): - alt_text = "Alt-Text noch nicht verfügbar" + alt_text = "" if self.picture_handler is not None: - alt_text = self.picture_handler(token.id) or alt_text + alt_text = self.picture_handler(token.id) return self.render_picture_helper(token.id, token.ref, token.text, token.number, alt_text) @@ -215,7 +215,7 @@ class FiftyOhmHtmlRenderer(HtmlRenderer): """ def render_photo(self, token): - alt_text = "Alt-Text noch nicht verfügbar" + alt_text = "" if self.photo_handler is not None: alt_text = self.photo_handler(token.id) or alt_text return self.render_photo_helper(token.id, token.ref, token.text, token.number, alt_text) diff --git a/src/build.py b/src/build.py index 0729531..26f9cdd 100644 --- a/src/build.py +++ b/src/build.py @@ -136,6 +136,8 @@ class Build: shutil.copyfile(self.config.p_data_pictures / file, self.config.p_build_pictures / file) if (self.config.p_data_pictures / f"{id}.txt").exists(): return (self.config.p_data_pictures / f"{id}.txt").read_text() + else: + return "Bildbeschreibung noch nicht verfügbar" except FileNotFoundError: tqdm.write(f"\033[31mPicture #{id} not found\033[0m") @@ -146,6 +148,8 @@ class Build: shutil.copyfile(self.config.p_data_photos / file, self.config.p_build_photos / file) if (self.config.p_data_photos / f"{id}.txt").exists(): return (self.config.p_data_photos / f"{id}.txt").read_text() + else: + return "Bildbeschreibung noch nicht verfügbar" except FileNotFoundError: tqdm.write(f"\033[31mPhoto #{id} not found\033[0m") diff --git a/test/test_photo.py b/test/test_photo.py index 60d243d..7e6d27b 100644 --- a/test/test_photo.py +++ b/test/test_photo.py @@ -9,9 +9,7 @@ from test.util import paragraph @pytest.mark.html def test_photo_html(): assertions = { - "[photo:123:abc:Text]": FiftyOhmHtmlRenderer.render_photo_helper( - "123", "abc", "Text", "TODO", "Alt-Text noch nicht verfügbar" - ), + "[photo:123:abc:Text]": FiftyOhmHtmlRenderer.render_photo_helper("123", "abc", "Text", "TODO", ""), } for assertion in assertions: diff --git a/test/test_picture.py b/test/test_picture.py index ea1eced..d9bb240 100644 --- a/test/test_picture.py +++ b/test/test_picture.py @@ -9,9 +9,7 @@ from test.util import paragraph @pytest.mark.html def test_picture_html(): assertions = { - "[picture:0:abc:Text]": FiftyOhmHtmlRenderer.render_picture_helper( - "0", "abc", "Text", "TODO", "Alt-Text noch nicht verfügbar" - ), + "[picture:0:abc:Text]": FiftyOhmHtmlRenderer.render_picture_helper("0", "abc", "Text", "TODO", ""), } for assertion in assertions: