agentsclimarketplace

Zh quotes

Skill MarecGents/marec-agent-skills/skills/zh-quotes

在 Word 文档(.docx)中将英文直引号替换为中文全角弯引号(""-"") -- 成对交替,保留原格式。当用户需要处理中文标点符号、整理中文排版、将英文直引号转为中文前后引号、修复 docx 文件中的引号格式时使用。适用于学术论文、报告、公文等中文文档的标点规范化。该技能是docx技能的子技能,专精于引号格式修复,不用于创建或编辑其他文档内容。From its SKILL.md

Install
npx -y skills add MarecGents/marec-agent-skills --skill zh-quotes

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
  • runs commandsInstructs the agent to run 1 command, including `python scripts/replace_quotes.py <输入文件.docx> [选项]`.

SKILL.md

3.2 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it

中文引号格式化(zh-quotes)

.docx 文件中的所有英文直引号(")替换为中文全角弯引号(左 \u201c、右 \u201d),成对交替替换,同时完整保留原文所有格式(字体、字号、加粗、斜体、颜色等)。

使用场景

  • 学术论文中英混排文档的中文引号规范化
  • 从英文模板创建的中文文档标点修复
  • 批量处理多个 docx 文件中的直引号问题
  • 引用中包含书名号、引号嵌套的中文排版

工作原理

docx 文件本质是 ZIP 压缩包,内部以 XML 存储文本内容和格式。脚本遍历文档的每一个 <w:r>(run)元素,在段落级别识别 " 字符并按段落内出现顺序成对交替替换:

  • 段落内第 1 个 " → 左引号 \u201c
  • 段落内第 2 个 " → 右引号 \u201d
  • 第 3 个 " → 左引号 \u201c
  • 第 4 个 " → 右引号 \u201d
  • …依次类推,每个段落独立计数

使用方法

python scripts/replace_quotes.py <输入文件.docx> [选项]

参数说明

参数说明
<输入文件>要处理的 .docx 文件路径(必需)
--output OUTPUT / -o输出路径(默认覆盖原文件)
--no-backup不创建备份(默认自动创建 .bak 备份)

示例

# 直接修改原文件(自动创建备份)
python scripts/replace_quotes.py 论文.docx

# 输出到新文件
python scripts/replace_quotes.py 论文.docx -o 论文_格式化.docx

# 批量处理当前目录下所有 docx
Get-ChildItem *.docx | ForEach-Object {
    python scripts/replace_quotes.py $_.Name --no-backup
}

处理范围

  • ✅ 文档正文段落
  • ✅ 页眉(header)和页脚(footer)
  • ✅ 表格内单元格文字
  • ✅ 脚注和尾注(通过 lxml 模式)
  • ✅ 文本框中的文字
  • ✅ 保留所有字体、字号、加粗、斜体、颜色等格式

注意事项

  1. 引号嵌套:如果同一段落内包含嵌套引号,此工具按平面配对处理,不会智能区分嵌套层级。如有嵌套引号需求,手动调整。
  2. 已存在的弯引号:如果文档中已存在中文弯引号(\u201c/\u201d),工具会跳过它们并保持其配对状态计数器同步,确保后续替换正确。
  3. 备份:默认创建 .bak 备份文件,使用 --no-backup 可禁用。
  4. 依赖:需要 python-docx(推荐)或 lxml。安装:pip install python-docx

与 docx 技能的关系

本技能是 docx 文编技能的子集,专门处理引号格式修复这一高频需求。如果你需要进行更复杂的 docx 操作(创建文档、插入图片、处理修订等),请使用 docx 技能。

What ships with it: 1 file

10.0 KB alongside SKILL.md, 1 of them executable

scripts/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.