feature: added ability to render includes

This commit is contained in:
Prof. Dr. Matthias Jung DL9MJ
2025-06-24 22:04:14 +02:00
committed by Tim Grelka
parent 87113ddd46
commit e248d29a7e
4 changed files with 22 additions and 4 deletions
+8 -1
View File
@@ -69,12 +69,19 @@ def question_stub(input):
answer_pictures=answer_pictures,
)
def include_stub(include):
with open("data/includes.json") as file:
includes = json.load(file)
return includes.get(include)
def test_html(capsys):
with capsys.disabled():
with open("test/acceptanceTest.md") as file:
content = file.read()
with FiftyOhmHtmlRenderer(question_stub) as renderer:
with FiftyOhmHtmlRenderer(
question_renderer=question_stub,
include_handler=include_stub,
) as renderer:
output = renderer.render(Document(content))
with open("test/acceptanceTest.html", "w") as output_file:
pretty = BeautifulSoup(output, "html.parser").prettify()