Merge branch 'main' into feature/slides

This commit is contained in:
Prof. Dr. Matthias Jung DL9MJ
2025-06-24 22:09:48 +02:00
committed by Tim Grelka
8 changed files with 89 additions and 33 deletions
+2
View File
@@ -1,5 +1,7 @@
% Kommentar: DARC-DOWN-TEST
[include:test]
Das ist eine Item-Liste:
* Erster Eintrag
+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_renderer=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()
+18
View File
@@ -0,0 +1,18 @@
import pytest
from mistletoe import Document
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
@pytest.mark.html
def test_include_html():
assertions = {
'[include:ident]': "ident\n",
}
def test_function(input):
return f"{input}"
with FiftyOhmHtmlRenderer(include_handler=test_function) as renderer:
for assertion in assertions:
assert renderer.render(Document(assertion)) == assertions[assertion]