feature: add metadata and translation

This commit is contained in:
Prof. Dr. Matthias Jung DL9MJ
2025-02-16 22:05:03 +01:00
parent 8781a9954a
commit 5dd27ad90c
3 changed files with 15777 additions and 1 deletions
+5 -1
View File
@@ -1,10 +1,14 @@
import json
from mistletoe import Document
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
def question_stub(input):
return f"<question>{input}</question>" # TODO implement this stub
with open('data/metadata.json') as file:
metadata = json.load(file)
return metadata[f"{input}"].get("number")
def test_html(capsys):
+20
View File
@@ -1,3 +1,5 @@
import json
import pytest
from mistletoe import Document
@@ -22,6 +24,24 @@ def test_comment_html():
for assertion in assertions:
assert renderer.render(Document(assertion)) == assertions[assertion]
@pytest.mark.html
def test_comment_translation_html():
assertions = {
"[question:123]": "ED111\n",
"\n[question:123]\n": "ED111\n",
"\n[question:123]\n[question:123]": "ED111\nED111\n",
"Foo\n[question:123]\nBar": paragraph("Foo") + "ED111\n" + paragraph("Bar"),
}
def test_function(input):
with open('data/metadata.json') as file:
metadata = json.load(file)
return metadata[f"{input}"].get("number")
with FiftyOhmHtmlRenderer(test_function) as renderer:
for assertion in assertions:
assert renderer.render(Document(assertion)) == assertions[assertion]
@pytest.mark.latex
def test_comment_latex():