修正联合行文布局并刷新审计证据
This commit is contained in:
+34
-2
@@ -130,10 +130,42 @@ unzip -p "$TMP_DIR/horizontal-table.docx" word/document.xml | grep -q 'w:tblW w:
|
||||
unzip -p "$TMP_DIR/joint.docx" word/document.xml | grep -q '主办机关'
|
||||
unzip -p "$TMP_DIR/joint.docx" word/document.xml | grep -q '协办机关'
|
||||
unzip -p "$TMP_DIR/joint.docx" word/document.xml | grep -q '文件'
|
||||
unzip -p "$TMP_DIR/joint.docx" word/document.xml | grep -q '主办机关 文件</w:t><w:br/>'
|
||||
unzip -p "$TMP_DIR/joint.docx" word/document.xml | grep -q '协办机关</w:t>'
|
||||
unzip -p "$TMP_DIR/joint.docx" word/document.xml | grep -q 'w:sz w:val="48"'
|
||||
|
||||
"$NODE" "$GEN" --input "$FIXTURE" --output "$TMP_DIR/joint-four-agencies.docx" --format formal --letterhead digital --org "主办机关文件" --joint-org "协办机关一" --joint-org "协办机关二" --joint-org "协办机关三" --doc-no "示例发〔2026〕4号" --title "四机关联合行文测试"
|
||||
"$NODE" "$VERIFY" --input "$TMP_DIR/joint-four-agencies.docx" --profile formal --letterhead digital
|
||||
"$NODE" "$GEN" --input "$FIXTURE" --output "$TMP_DIR/joint-without-file-suffix.docx" --format formal --letterhead digital --org "主办机关" --joint-org "协办机关" --doc-no "示例发〔2026〕5号" --title "无文件后缀联合行文测试"
|
||||
"$NODE" "$VERIFY" --input "$TMP_DIR/joint-without-file-suffix.docx" --profile formal --letterhead digital
|
||||
python3 - "$TMP_DIR/joint.docx" "$TMP_DIR/joint-four-agencies.docx" <<'PY'
|
||||
import re
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
for filename, expected_count in ((sys.argv[1], 2), (sys.argv[2], 4)):
|
||||
with zipfile.ZipFile(filename) as archive:
|
||||
xml = archive.read("word/document.xml").decode()
|
||||
tables = re.findall(r'<w:tbl>[\s\S]*?<w:tblpPr[^>]*w:tblpY="1984"[\s\S]*?</w:tbl>', xml)
|
||||
assert len(tables) == 1, filename
|
||||
table = tables[0]
|
||||
assert table.count('<w:vAlign w:val="center"/>') >= 2, filename
|
||||
assert table.count('<w:tc>') == 2, filename
|
||||
assert table.count('<w:p>') == expected_count + 1, filename
|
||||
assert '<w:t xml:space="preserve">文件</w:t>' in table, filename
|
||||
PY
|
||||
python3 - "$TMP_DIR/joint-without-file-suffix.docx" <<'PY'
|
||||
import re
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
with zipfile.ZipFile(sys.argv[1]) as archive:
|
||||
xml = archive.read("word/document.xml").decode()
|
||||
tables = re.findall(r'<w:tbl>[\s\S]*?<w:tblpPr[^>]*w:tblpY="1984"[\s\S]*?</w:tbl>', xml)
|
||||
assert len(tables) == 1
|
||||
table = tables[0]
|
||||
assert table.count('<w:vAlign w:val="center"/>') >= 1
|
||||
assert '<w:t xml:space="preserve">文件</w:t>' not in table
|
||||
PY
|
||||
|
||||
if "$NODE" "$GEN" --input "$FIXTURE" --output "$TMP_DIR/missing-joint-name.docx" --format formal --letterhead digital --org "主办机关文件" --joint-org --doc-no "示例发〔2026〕4号" --title "缺少联署机关名称" >"$TMP_DIR/missing-joint-name.out" 2>&1; then
|
||||
echo "missing joint agency name unexpectedly succeeded" >&2
|
||||
exit 1
|
||||
|
||||
@@ -27,7 +27,7 @@ node "$gen" --input "$all" --output "$out_dir/docx/formal-unsigned.docx" --forma
|
||||
node "$gen" --input "$all" --output "$out_dir/docx/formal-attachments.docx" --format formal --letterhead preprinted --letterhead-reserve-mm 72 --doc-no "示例发〔2026〕10号" --title "多附件实测" --attachment-note "1. 数据清单;2. 实施计划。" --attachment-file "$attach_a" --attachment-file "$attach_b" --page-number standard
|
||||
node "$gen" --input "$all" --output "$out_dir/docx/formal-attachments-detached.docx" --format formal --letterhead preprinted --letterhead-reserve-mm 72 --doc-no "示例发〔2026〕15号" --title "分离装订附件实测" --attachment-note "1. 数据清单;2. 实施计划。" --attachment-file "$attach_a" --attachment-file "$attach_b" --attachment-detached --page-number standard
|
||||
node "$gen" --input "$long" --output "$out_dir/docx/formal-long.docx" --format formal --letterhead preprinted --letterhead-reserve-mm 72 --doc-no "示例发〔2026〕11号" --title "长文版记与单双页实测" --cc "办公室、财务部、审计部、采购部、法务部、信息中心" --print-org "示例印发机关" --print-date "2026年9月10日" --page-number standard
|
||||
node "$gen" --input "$all" --output "$out_dir/docx/formal-joint.docx" --format formal --letterhead digital --org "主办机关文件" --joint-org "协办机关一" --joint-org "协办机关二" --doc-no "示例发〔2026〕16号" --title "联合行文实测" --page-number standard
|
||||
node "$gen" --input "$all" --output "$out_dir/docx/formal-joint.docx" --format formal --letterhead digital --org "主办机关文件" --joint-org "协办机关一" --joint-org "协办机关二" --joint-org "协办机关三" --doc-no "示例发〔2026〕16号" --title "联合行文实测" --page-number standard
|
||||
node "$gen" --input "$all" --output "$out_dir/docx/letter.docx" --format letter --org "示例机关" --doc-no "示例〔2026〕12号" --title "信函格式实测" --page-number none
|
||||
node "$gen" --input "$all" --output "$out_dir/docx/letter-fields.docx" --format letter --org "示例机关" --copy-no 7 --secret "机密★3年" --urgent "特急" --doc-no "示例〔2026〕14号" --title "信函版头字段实测" --page-number none
|
||||
node "$gen" --input "$all" --output "$out_dir/docx/command.docx" --format command --org "示例机关命令" --doc-no "第1号" --title "命令格式实测" --page-number standard
|
||||
|
||||
Reference in New Issue
Block a user