refactor: adopts rendering process to new data source
This commit is contained in:
@@ -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>
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user