feature: finished slide building process

This commit is contained in:
Prof. Dr. Matthias Jung DL9MJ
2025-06-24 22:04:42 +02:00
committed by Tim Grelka
parent dcfeb78bfa
commit 8a5a55371d
5 changed files with 236 additions and 92 deletions
+7 -74
View File
@@ -39,13 +39,6 @@ def filter_shuffle_answers(seq):
except Exception:
return seq
env = Environment(loader=FileSystemLoader("templates/"))
env.filters["shuffle_answers"] = filter_shuffle_answers
question_template = env.get_template("slide/question.html")
questions = parse_katalog()
def question_stub(input):
"""Combines the original question dataset from BNetzA with our internal metadata"""
with open("data/metadata.json") as metadata_file:
@@ -84,77 +77,17 @@ def question_stub(input):
answer_pictures=answer_pictures,
)
def print_head():
return """<! DOCTYPE html>
<html lang="de"><head>
<meta charset="utf-8">
<title>DARC Ausbildungsplattform</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../assets/reveal.js/dist/reset.css">
<link rel="stylesheet" href="../assets/reveal.js/dist/reveal.css">
<link rel="stylesheet" href="../assets/style-slide.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="../assets/reveal.js/plugin/highlight/monokai.css">
</head>
<body>
<div class="reveal">
<div class="slides">
"""
#<!-- Chart plugin -->
#<script src="../assets/reveal.js-plugins/chart/plugin.js"></script>
#<script src="../assets/chartjs/4.4.1/chart.min.js"></script>
def print_tail():
return """</div>
</div>
<script src="../assets/reveal.js/dist/reveal.js"></script>
<script src="../assets/reveal.js/plugin/zoom/zoom.js"></script>
<script src="../assets/reveal.js/plugin/notes/notes.js"></script>
<script src="../assets/reveal.js/plugin/search/search.js"></script>
<script src="../assets/reveal.js/plugin/markdown/markdown.js"></script>
<script src="../assets/reveal.js/plugin/highlight/highlight.js"></script>
<script src="../assets/reveal.js/plugin/math/math.js"></script>
<script>
// Also available as an ES module, see:
// https://revealjs.com/initialization/
Reveal.initialize({
controls: true,
progress: true,
slideNumber: 'c/t',
showSlideNumber: 'speaker',
center: true,
hash: true,
transition: 'slide',
showNotes: false,
pdfSeparateFragments: false,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealZoom, RevealNotes, RevealSearch, RevealMarkdown, RevealHighlight, RevealMath.KaTeX] //, RevealChart ]
});
</script>
</body>"""
env = Environment(loader=FileSystemLoader("templates/"))
env.filters["shuffle_answers"] = filter_shuffle_answers
question_template = env.get_template("slide/question.html")
slide_template = env.get_template("slide/slide.html")
questions = parse_katalog()
def test_html_slides(capsys):
with capsys.disabled():
with open("test/acceptanceTestSlides.md") as file:
content = file.read()
with FiftyOhmHtmlSlideRenderer(question_stub) as renderer:
output = ""
output = print_head()
output += renderer.render_wrapper(content)
output += print_tail()
with FiftyOhmHtmlSlideRenderer(question_renderer=question_stub) as renderer:
output = renderer.render_wrapper(content)
with open("test/acceptanceTestSlides.html", "w") as output_file:
output_file.write(output)