fix(writer): 防静默丢章告警 + 占位符正则宽容化(大小写/全角冒号)
This commit is contained in:
@@ -30,3 +30,15 @@ def test_map_template_falls_back_without_placeholder():
|
||||
specs = map_template(parsed)
|
||||
assert specs[0].chapter_id == "chapter_1"
|
||||
assert specs[0].section_placeholder is None
|
||||
|
||||
|
||||
def test_map_template_section_re_case_insensitive():
|
||||
# 宽容:占位符键名大小写不敏感(解析端已归一,防御性双保险)
|
||||
sections = [
|
||||
ChapterMarker(type="heading", name="画面一覧", level=1),
|
||||
ChapterMarker(type="placeholder", name="Section:2", level=0),
|
||||
]
|
||||
parsed = ParsedTemplate(file_name="t.docx", sections=sections, placeholders={}, styles={})
|
||||
specs = map_template(parsed)
|
||||
assert specs[0].chapter_id == "2"
|
||||
assert specs[0].section_placeholder == "Section:2"
|
||||
|
||||
Reference in New Issue
Block a user