feat: Druck-Umbruchzeichen (↪/➥) in Codeblöcken auflösen (QA R6)
Fortsetzungszeilen werden wieder mit genau einem Leerzeichen zur ursprünglichen Codezeile zusammengefügt. Im Python-Beispielbuch sind das 195 Stellen; danach lassen sich 247 statt 203 von 255 Python-Blöcken parsen. Abschaltbar mit --keep-wrap-markers; der Bericht enthält wrap_lines_joined pro Block und einen Hinweis pro Kapitel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f14e657e29
commit
6db834addd
1 changed files with 68 additions and 7 deletions
|
|
@ -101,3 +101,20 @@ def test_code_language_option_rejects_unknown_values(convert):
|
|||
run = convert(Book(docs=[Doc("c.xhtml", "<h1>C</h1><pre>x</pre>")]), "--code-language", "quatsch")
|
||||
assert run.rc == 1
|
||||
assert "quatsch" in run.stderr
|
||||
|
||||
|
||||
def test_print_wrap_markers_are_joined(convert):
|
||||
body = ("<h1>W</h1><pre> return (s * (s -\n ↪ distance(a, b)) *\n s)\n"
|
||||
"x = ['a', 'b',\n↪ 'c']</pre>")
|
||||
run = convert(Book(docs=[Doc("c.xhtml", body)]))
|
||||
(_, _, code), = fenced_blocks(run.chapter("001"))
|
||||
assert code == " return (s * (s - distance(a, b)) *\n s)\nx = ['a', 'b', 'c']"
|
||||
item = run.report["code_blocks"]["items"][0]
|
||||
assert item["wrap_lines_joined"] == 2
|
||||
|
||||
|
||||
def test_print_wrap_markers_can_be_kept(convert):
|
||||
body = "<h1>W</h1><pre>a = (1,\n↪ 2)</pre>"
|
||||
run = convert(Book(docs=[Doc("c.xhtml", body)]), "--keep-wrap-markers")
|
||||
(_, _, code), = fenced_blocks(run.chapter("001"))
|
||||
assert code == "a = (1,\n↪ 2)"
|
||||
|
|
|
|||
Loading…
Reference in a new issue