# Wps Poetry

> |

- **Type:** Skill
- **Install:** `agentstack add skill-bwkyd-wps-skills-wps-poetry`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Bwkyd](https://agentstack.voostack.com/s/bwkyd)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Bwkyd](https://github.com/Bwkyd)
- **Source:** https://github.com/Bwkyd/wps-skills/tree/main/skills/wps-poetry

## Install

```sh
agentstack add skill-bwkyd-wps-skills-wps-poetry
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 诗词排版工具

诗词 → 精美排版 → 可打印/装裱级别的文档。

> 小众但有趣：让诗词以最美的姿态呈现。

## When to Use

- 古诗词精美排版打印
- 对联排版
- 教学材料中的诗词展示
- 文化活动用诗词海报底稿
- 用户说"帮我排版这首诗""做个对联"

## When NOT to Use

- 普通文档排版 → 使用 `wps-docx-writer`
- 公文 → 使用 `wps-gongwen`

## 排版样式

```text
[1] 经典横排 → 居中、留白、印章装饰
[2] 竖排古风 → 从右到左、竖排文字
[3] 对联格式 → 上联+下联+横批
[4] 现代诗 → 左对齐、错落有致
[5] 书法练字 → 田字格/米字格
```

## 工作流程

### Step 1: 确认诗词内容和排版需求

- 诗词全文（含标题、作者）
- 排版样式
- 用途（打印/展示/教学）

### Step 2: 生成排版

```python
from docx import Document
from docx.shared import Pt, Cm, Inches, RGBColor, Emu
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
import os

def create_poetry_doc(title, author, lines, style='经典横排',
                      output_path=None):
    """生成诗词排版文档"""
    doc = Document()
    section = doc.sections[0]

    def set_font(run, name='华文行楷', size=18, bold=False, color=None):
        run.font.size = Pt(size)
        run.font.name = name
        run._element.rPr.rFonts.set(qn('w:eastAsia'), name)
        run.bold = bold
        if color:
            run.font.color.rgb = RGBColor(*color)

    if style == '经典横排':
        section.page_width = Cm(21)
        section.page_height = Cm(29.7)
        section.top_margin = Cm(5)
        section.bottom_margin = Cm(5)
        section.left_margin = Cm(5)
        section.right_margin = Cm(5)

        # 大量留白后开始
        for _ in range(4):
            doc.add_paragraph()

        # 标题
        p = doc.add_paragraph()
        p.alignment = WD_ALIGN_PARAGRAPH.CENTER
        p.paragraph_format.space_after = Pt(24)
        run = p.add_run(title)
        set_font(run, '华文行楷', 28, color=(0x8B, 0x45, 0x13))

        # 作者
        p = doc.add_paragraph()
        p.alignment = WD_ALIGN_PARAGRAPH.CENTER
        p.paragraph_format.space_after = Pt(36)
        run = p.add_run(f'【{author}】')
        set_font(run, '楷体', 14, color=(0x80, 0x80, 0x80))

        # 诗句
        for line in lines:
            p = doc.add_paragraph()
            p.alignment = WD_ALIGN_PARAGRAPH.CENTER
            p.paragraph_format.line_spacing = Pt(42)
            run = p.add_run(line)
            set_font(run, '华文行楷', 22, color=(0x33, 0x33, 0x33))

    elif style == '对联格式':
        section.page_width = Cm(29.7)  # 横向
        section.page_height = Cm(21)
        section.top_margin = Cm(3)
        section.left_margin = Cm(4)
        section.right_margin = Cm(4)

        # 横批
        if len(lines) >= 3:
            p = doc.add_paragraph()
            p.alignment = WD_ALIGN_PARAGRAPH.CENTER
            p.paragraph_format.space_after = Pt(48)
            run = p.add_run(lines[2])  # 横批
            set_font(run, '华文隶书', 36, True, color=(0xCC, 0x00, 0x00))

        doc.add_paragraph()

        # 上下联（使用表格模拟左右对称）
        table = doc.add_table(rows=1, cols=3)
        table.alignment = 1  # CENTER

        if len(lines) >= 2:
            # 上联（右）
            cell = table.cell(0, 2)
            p = cell.paragraphs[0]
            p.alignment = WD_ALIGN_PARAGRAPH.CENTER
            run = p.add_run(lines[0])
            set_font(run, '华文行楷', 28, color=(0x8B, 0x00, 0x00))

            # 下联（左）
            cell = table.cell(0, 0)
            p = cell.paragraphs[0]
            p.alignment = WD_ALIGN_PARAGRAPH.CENTER
            run = p.add_run(lines[1])
            set_font(run, '华文行楷', 28, color=(0x8B, 0x00, 0x00))

    elif style == '现代诗':
        section.top_margin = Cm(4)
        section.left_margin = Cm(6)
        section.right_margin = Cm(4)

        for _ in range(3):
            doc.add_paragraph()

        # 标题
        p = doc.add_paragraph()
        p.paragraph_format.space_after = Pt(18)
        run = p.add_run(title)
        set_font(run, '微软雅黑', 22, True, color=(0x2C, 0x3E, 0x50))

        # 作者
        p = doc.add_paragraph()
        p.paragraph_format.space_after = Pt(30)
        run = p.add_run(author)
        set_font(run, '微软雅黑', 11, color=(0x99, 0x99, 0x99))

        # 诗行
        for line in lines:
            if line.strip() == '':
                doc.add_paragraph()  # 空行
            else:
                p = doc.add_paragraph()
                p.paragraph_format.line_spacing = Pt(32)
                run = p.add_run(line)
                set_font(run, '华文楷体', 14, color=(0x33, 0x33, 0x33))

    if not output_path:
        output_path = f'{title}_排版.docx'
    doc.save(output_path)
    return os.path.abspath(output_path)
```

### Step 3: 交付

1. 生成精美排版的诗词文档
2. 建议用较好的纸张打印
3. 字体说明（如果用户电脑没有华文行楷等字体）

## 示例

```bash
# 古诗排版
/wps-poetry 帮我排版李白的《将进酒》，经典横排风格

# 对联
/wps-poetry 上联：春风得意马蹄疾 下联：一日看尽长安花 横批：金榜题名

# 现代诗
/wps-poetry 帮我排版海子的《面朝大海春暖花开》
```

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Bwkyd](https://github.com/Bwkyd)
- **Source:** [Bwkyd/wps-skills](https://github.com/Bwkyd/wps-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-bwkyd-wps-skills-wps-poetry
- Seller: https://agentstack.voostack.com/s/bwkyd
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
