fix: Kastentyp aus Verlagsklasse, kein Feld-Trenner vor ausgeblendeten Spans

- _box_type erkennt hinweis/note/notiz/anmerkung/info als NOTE; damit
  gewinnt die Klasse "box hinweis" gegen ein Typwort im Titel ("Wichtige …")
- _separate_field_spans setzt kein Leerzeichen, wenn einer der Spans per CSS
  display:none ist ("<u>x</u> ." → "<u>x</u>.")
- gefunden mit der neuen QA-Fixture 14-typography (QA-Matrix jetzt 85 Fälle,
  inkl. epub2md_merge.py und Pandoc-Filter)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-10-06 05:36:25 +02:00
commit e8fd6c2fb9

View file

@ -192,3 +192,12 @@ def test_book_readme_suggests_callout_filter(convert):
assert "--lua-filter" in readme and "pandoc/callouts.lua" in readme and "1 Infokasten " in readme
plain = convert(Book(docs=[Doc("c.xhtml", body)]), "--boxes", "plain").out / "README.md"
assert "--lua-filter" not in plain.read_text(encoding="utf-8")
def test_hidden_span_gets_no_field_separator_and_class_type_wins(convert):
css = b".u { text-decoration: underline; } .weg { display: none; }"
body = ('<h1>K</h1><p><span class="u">unterstrichen</span><span class="weg">VERSTECKT</span>.</p>'
'<div class="box hinweis"><h3 class="boxheading">Wichtige Regel</h3><p>Immer testen.</p></div>')
text = convert(Book(docs=[Doc("c.xhtml", body)], media={"s.css": css})).chapter("001")
assert "<u>unterstrichen</u>." in text and "VERSTECKT" not in text
assert "> [!NOTE]\n> **Wichtige Regel**" in text # class 'hinweis' beats the word in the title