refactor: adopts rendering process to new data source

This commit is contained in:
Matthias Jung
2026-02-01 20:31:46 +01:00
parent d5399e30f9
commit 2139685192
5 changed files with 44 additions and 30 deletions
+1 -1
View File
@@ -277,7 +277,7 @@ class FiftyOhmHtmlRenderer(HtmlRenderer):
def render_photo_helper(id, ref, text, number, alt_text):
return f"""
<figure class="photo" id="ref_{ref}" name="{ref}">
<img src="photos/{id}.jpg" alt="{alt_text}">
<img src="photos/{id}.png" alt="{alt_text}">
<figcaption>Abbildung {number}: {text}</figcaption>
</figure>
"""
+2 -2
View File
@@ -8,12 +8,12 @@ class Question(BlockToken):
def start(line):
# Search for:
# [question:123]
return re.match(r"^\s*\[question:\d+\]", line)
return re.match(r"^\s*\[question:[\w\d]+\]", line)
@classmethod
def read(cls, lines):
first_line = next(lines)
question_number = re.match(r"^\s*\[question:(\d+)\]", first_line).group(1)
question_number = re.match(r"^\s*\[question:([\w\d]+)\]", first_line).group(1)
return question_number
@classmethod