Nullbreiten-Zeichen (U+200B–U+200D, U+2060, U+FEFF) und weiche Trennstriche (U+00AD) werden aus Fließtext, Alternativtexten und Kapiteltiteln entfernt; Code bleibt unverändert. Im Mathebuch sind das 198 Zeichen (z. B. '1.1'). Abschaltbar mit --keep-invisible-chars; die Anzahl steht im Bericht unter text_cleanup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
869 B
Python
18 lines
869 B
Python
"""Typography and layout: invisible characters, CSS emphasis, scene breaks, boxes, styles, page markers."""
|
||
|
||
from conftest import Book, Doc
|
||
|
||
ZW, SHY = "", ""
|
||
|
||
|
||
def test_p6_invisible_characters_removed_outside_code(convert):
|
||
body = (f"<h1>Kapitel 1.{ZW}1</h1><p>Lese{SHY}rinnen und 1.{ZW}1 sowie{ZW}Wort.</p>"
|
||
f"<pre>a{ZW}b</pre><p><code>x{SHY}y</code></p>")
|
||
run = convert(Book(docs=[Doc("c.xhtml", body)]))
|
||
text = run.chapter("001")
|
||
assert "Leserinnen und 1.1 sowieWort." in text
|
||
assert "# Kapitel 1.1" in text and 'chapter_title: "Kapitel 1.1"' in text
|
||
assert f"a{ZW}b" in text and f"x{SHY}y" in text # code stays verbatim
|
||
assert run.report["text_cleanup"]["invisible_chars_removed"] == 4
|
||
kept = convert(Book(docs=[Doc("c.xhtml", body)]), "--keep-invisible-chars").chapter("001")
|
||
assert f"Lese{SHY}rinnen" in kept
|