feat(mytoolkit): add voice command and improve docx post-processing

- Add voice/TTS CLI command via Volcengine WebSocket API
- Inject suppressAutoHyphens into all docx paragraphs in post-process
- Apply post-process fixes to all templates (not just default)
- Update review template: Cambria+SimSun fonts, 11pt for headings
- Sync default/review docx template formatting
This commit is contained in:
Zhengshou Lai
2026-05-27 16:17:47 +08:00
parent 7600b558cd
commit ac605c2c17
14 changed files with 1135 additions and 6 deletions
+11 -3
View File
@@ -113,8 +113,7 @@ def convert_cmd(inputs, output, template, quality, density, reference_doc, bookm
if ref_doc:
cmd.extend(["--reference-doc", ref_doc])
run_command(cmd, check=True)
if template == "default":
_fix_docx_postprocess(out_path)
_fix_docx_postprocess(out_path)
click.secho(f"Word document generated: {output}", fg="green")
return
@@ -352,9 +351,18 @@ def _fix_docx_postprocess(docx_path: Path) -> None:
spacing.set(wtag("before"), "120")
break
# --- 5. Inject suppressAutoHyphens into all paragraphs ---
for p in body.findall(wtag("p")):
pPr = p.find(wtag("pPr"))
if pPr is None:
pPr = ET.SubElement(p, wtag("pPr"))
p.insert(0, pPr)
if pPr.find(wtag("suppressAutoHyphens")) is None:
ET.SubElement(pPr, wtag("suppressAutoHyphens"))
tree.write(doc_xml, xml_declaration=True, encoding="UTF-8", pretty_print=False)
# --- 5. Inject HorizontalRule style ---
# --- 6. Inject HorizontalRule style ---
styles_xml = os.path.join(workdir, "word", "styles.xml")
styles_tree = ET.parse(styles_xml)
styles_root = styles_tree.getroot()