feat: Warnung chapter-large mit --chapter-level-Empfehlung für sehr große Kapitel
Kapiteldateien über 30 000 Wörtern mit mindestens zwei ##-Unterabschnitten erzeugen eine Warnung mit der passenden --chapter-level-Empfehlung (QA-Befund R2, z. B. Roman mit Teilen als h1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3b07fcf01a
commit
8afa1cc6d4
1 changed files with 31 additions and 2 deletions
|
|
@ -122,3 +122,14 @@ def test_glossary_anchor_is_placed_before_bold_term(convert):
|
|||
'<dl><dt id="g">API</dt><dd>Schnittstelle.</dd></dl></section>')
|
||||
text = convert(Book(docs=[Doc("c.xhtml", body)])).chapter("002")
|
||||
assert '<a id="g"></a>**API:** Schnittstelle.' in text
|
||||
|
||||
|
||||
def test_large_chapter_with_subheadings_suggests_deeper_chapter_level(convert):
|
||||
words = " ".join(["Wort"] * 11000)
|
||||
body = "<h1>Teil 1</h1>" + "".join(f"<h2>Kapitel {i}</h2><p>{words}</p>" for i in range(3))
|
||||
run = convert(Book(docs=[Doc("t.xhtml", body)]))
|
||||
hints = [w for w in run.report["warnings"] if w["code"] == "chapter-large"]
|
||||
assert len(hints) == 1
|
||||
assert "--chapter-level 2" in hints[0]["message"] and "3 Unterabschnitte" in hints[0]["message"]
|
||||
small = convert(Book(docs=[Doc("t.xhtml", "<h1>Teil</h1><h2>A</h2><p>x</p><h2>B</h2><p>y</p>")]))
|
||||
assert not any(w["code"] == "chapter-large" for w in small.report["warnings"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue