Bericht: KI-Zellen in 'Je Tag als Tabelle' nicht doppelt maskieren; Spec gegen <span

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 15:45:09 +01:00
co-authored by Claude Opus 5.5
parent bc1943c8df
commit 2e5017129c
2 changed files with 14 additions and 3 deletions
+6 -3
View File
@@ -856,8 +856,10 @@ def tabelle(kopf, zeilen, klassen=None, roh=False):
return "".join(o)
def als_tabelle(titel, kopf, zeilen):
return f'<details class="tafel"><summary>{esc(titel)} als Tabelle</summary>{tabelle(kopf, zeilen)}</details>'
def als_tabelle(titel, kopf, zeilen, roh=False):
"""roh=True: Zellen sind fertiges HTML (Text darin selbst mit esc() behandeln), kein Markdown."""
kopf = [esc(k) for k in kopf] if roh else kopf
return f'<details class="tafel"><summary>{esc(titel)} als Tabelle</summary>{tabelle(kopf, zeilen, roh=roh)}</details>'
def fehlt(e):
@@ -931,7 +933,8 @@ def abschnitt_echtgeld(d, e, haende_pfad):
o.append(svg_tage(d["tage"], titel="bb/100 je Tag, roh und AIVAT"))
o.append(als_tabelle("Je Tag", ["Tag", "Hände", "roh bb/100", "AIVAT bb/100", "Splash echt (nicht enthalten)"],
[[_tag_de(t["tag"]), tausend(t["roh"]["n"]), ki_text(t["roh"]), ki_text(t["aivat"]),
f'{t["splash_n"]} Hände, {fz(t["splash_bb"], 0)} bb' if t["splash_n"] else "–"] for t in d["tage"]]))
f'{t["splash_n"]} Hände, {fz(t["splash_bb"], 0)} bb' if t["splash_n"] else "–"] for t in d["tage"]],
roh=True))
o.append("<h3>Verlauf, kumuliert</h3>")
o.append(legende(("s1", "roh"), ("s2", "AIVAT")))
o.append(svg_kumuliert(d["kum"], titel="kumulierte bb, roh und AIVAT"))
+8
View File
@@ -169,6 +169,14 @@ class GanzerBericht(unittest.TestCase):
self.assertIn("Echtgeld", text)
self.assertIn("hhDealer", text)
def test_kein_doppelt_maskiertes_html(self):
# 23.11.: "Je Tag als Tabelle" zeigte <span class="ki">±83,5</span> als Text (zweimal maskiert)
text, _ = B.bericht(self.haende, baum=self.b, jetzt="23.11.2026 12:00")
self.assertNotIn("&lt;span", text)
self.assertNotRegex(text, r"&lt;/?(span|code|b|i|div|a|strong|em|td|tr)\b")
tafel = text.split("<summary>Je Tag als Tabelle</summary>", 1)[1].split("</details>", 1)[0]
self.assertIn('<span class="ki">±', tafel)
def test_golive_aus_git(self):
gl = B.golive_daten(self.b)
self.assertEqual([e["betreff"] for e in gl], ["B live", "A live (Holdout +1,5)"])