fix(sheet): 머리 칸 / 로 층 나눔 · 줄 머리 칸 고정 · 줄 머리 칸 폭 자동 (M02 재검증)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tjoit7rxvpLMM7cafeVTo1
This commit is contained in:
2026-09-25 12:45:57 +09:00
co-authored by Claude Sonnet 5
parent 4679261634
commit acca7d1fb6
7 changed files with 98 additions and 10 deletions
+33
View File
@@ -79,3 +79,36 @@ def test_page_rows_from_doc_and_master_single_page():
def test_empty_doc_still_one_page_with_totals():
plan = _plan({"양식": "시험", "종류": "표", "판": 1, "열": [], "줄": []})["project"]
assert plan == [{"ids": [], "first": 1, "totals": True}]
HEAD_SCRIPT = """
const { setHeadLabel } = await import(process.argv[1]);
const out = JSON.parse(process.argv[2]).map(([head, level, text, depth]) => {
setHeadLabel(head, level, text, depth);
return head;
});
console.log(JSON.stringify(out));
"""
def test_head_label_slash_splits_layers():
cases = [
[["새 열", None, None], 0, "관공/Φ800/관매설", 3],
[["새 열", None, None], 0, "관공/Φ800", 3], # 적게 → 남은 층 합침
[["새 열", None, None], 0, "a/b/c/d", 3], # 많으면 끝 층에 이어 붙임
[["종류", "공법", "규격"], 1, "이름", 3], # / 없음 → 그 층만
[["새 열"], 0, "가/나", 3], # 모자란 층은 채움
]
result = subprocess.run(
["node", "--experimental-strip-types", "--no-warnings", "--input-type=module", "-e",
HEAD_SCRIPT, OPS.as_uri(), json.dumps(cases, ensure_ascii=False)],
capture_output=True, text=True, encoding="utf-8", timeout=60,
) # fmt: skip
assert result.returncode == 0, result.stderr
assert json.loads(result.stdout) == [
["관공", "Φ800", "관매설"],
["관공", "Φ800", None],
["a", "b", "c/d"],
["종류", "이름", "규격"],
["가", "나", None],
]