reactor: don‘t include default alt text in render function
This commit is contained in:
@@ -199,9 +199,9 @@ class FiftyOhmHtmlRenderer(HtmlRenderer):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def render_picture(self, token):
|
def render_picture(self, token):
|
||||||
alt_text = "Alt-Text noch nicht verfügbar"
|
alt_text = ""
|
||||||
if self.picture_handler is not None:
|
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)
|
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):
|
def render_photo(self, token):
|
||||||
alt_text = "Alt-Text noch nicht verfügbar"
|
alt_text = ""
|
||||||
if self.photo_handler is not None:
|
if self.photo_handler is not None:
|
||||||
alt_text = self.photo_handler(token.id) or alt_text
|
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)
|
return self.render_photo_helper(token.id, token.ref, token.text, token.number, alt_text)
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ class Build:
|
|||||||
shutil.copyfile(self.config.p_data_pictures / file, self.config.p_build_pictures / file)
|
shutil.copyfile(self.config.p_data_pictures / file, self.config.p_build_pictures / file)
|
||||||
if (self.config.p_data_pictures / f"{id}.txt").exists():
|
if (self.config.p_data_pictures / f"{id}.txt").exists():
|
||||||
return (self.config.p_data_pictures / f"{id}.txt").read_text()
|
return (self.config.p_data_pictures / f"{id}.txt").read_text()
|
||||||
|
else:
|
||||||
|
return "Bildbeschreibung noch nicht verfügbar"
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
tqdm.write(f"\033[31mPicture #{id} not found\033[0m")
|
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)
|
shutil.copyfile(self.config.p_data_photos / file, self.config.p_build_photos / file)
|
||||||
if (self.config.p_data_photos / f"{id}.txt").exists():
|
if (self.config.p_data_photos / f"{id}.txt").exists():
|
||||||
return (self.config.p_data_photos / f"{id}.txt").read_text()
|
return (self.config.p_data_photos / f"{id}.txt").read_text()
|
||||||
|
else:
|
||||||
|
return "Bildbeschreibung noch nicht verfügbar"
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
tqdm.write(f"\033[31mPhoto #{id} not found\033[0m")
|
tqdm.write(f"\033[31mPhoto #{id} not found\033[0m")
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -9,9 +9,7 @@ from test.util import paragraph
|
|||||||
@pytest.mark.html
|
@pytest.mark.html
|
||||||
def test_photo_html():
|
def test_photo_html():
|
||||||
assertions = {
|
assertions = {
|
||||||
"[photo:123:abc:Text]": FiftyOhmHtmlRenderer.render_photo_helper(
|
"[photo:123:abc:Text]": FiftyOhmHtmlRenderer.render_photo_helper("123", "abc", "Text", "TODO", ""),
|
||||||
"123", "abc", "Text", "TODO", "Alt-Text noch nicht verfügbar"
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for assertion in assertions:
|
for assertion in assertions:
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ from test.util import paragraph
|
|||||||
@pytest.mark.html
|
@pytest.mark.html
|
||||||
def test_picture_html():
|
def test_picture_html():
|
||||||
assertions = {
|
assertions = {
|
||||||
"[picture:0:abc:Text]": FiftyOhmHtmlRenderer.render_picture_helper(
|
"[picture:0:abc:Text]": FiftyOhmHtmlRenderer.render_picture_helper("0", "abc", "Text", "TODO", ""),
|
||||||
"0", "abc", "Text", "TODO", "Alt-Text noch nicht verfügbar"
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for assertion in assertions:
|
for assertion in assertions:
|
||||||
|
|||||||
Reference in New Issue
Block a user