fix(writer): 防静默丢章告警 + 占位符正则宽容化(大小写/全角冒号)
This commit is contained in:
@@ -48,6 +48,28 @@ def test_section_placeholder_replaced(tmp_path):
|
||||
assert "以下がDB表定义です。" in full_text
|
||||
|
||||
|
||||
def test_section_placeholder_case_insensitive(tmp_path):
|
||||
# 宽容:docx 中锚点为 {{Section:id}}(大写键)也能注入
|
||||
tpl = _make_template(tmp_path, "{{Section:db_design}}")
|
||||
inj = DocxInjector(tpl)
|
||||
out = inj.inject({"db_design": _section_blocks()}, {"doc_title": "概要設計書"})
|
||||
|
||||
full_text = "\n".join(p.text for p in out.paragraphs)
|
||||
assert "{{Section:db_design}}" not in full_text
|
||||
assert "3.1 テーブル一覧" in full_text
|
||||
|
||||
|
||||
def test_section_placeholder_fullwidth_colon(tmp_path):
|
||||
# 宽容:docx 中锚点为 {{section:id}}(全角冒号)也能注入
|
||||
tpl = _make_template(tmp_path, "{{section:db_design}}")
|
||||
inj = DocxInjector(tpl)
|
||||
out = inj.inject({"db_design": _section_blocks()}, {"doc_title": "概要設計書"})
|
||||
|
||||
full_text = "\n".join(p.text for p in out.paragraphs)
|
||||
assert "{{section:db_design}}" not in full_text
|
||||
assert "3.1 テーブル一覧" in full_text
|
||||
|
||||
|
||||
# ---------- 行内占位符替换 ----------
|
||||
|
||||
def test_inline_meta_replaced(tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user