@ww_nero/skills 2.2.4 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/svg_to_pptx.py +0 -10
- package/index.js +3 -8
- package/package.json +1 -1
package/assets/svg_to_pptx.py
CHANGED
|
@@ -517,16 +517,6 @@ def add_image(slide, image_path, x, y, width, height):
|
|
|
517
517
|
def add_icon(slide, svg_content, x, y, width, height, scale=2):
|
|
518
518
|
"""
|
|
519
519
|
添加图标(先将SVG转为PNG再插入)
|
|
520
|
-
|
|
521
|
-
对于 icon 元素,会先将其独立保存为小的 PNG 图片,然后再插入到 PPTX 中。
|
|
522
|
-
这样可以保证矢量图标(如路径、复杂形状)在 PowerPoint 中正确显示。
|
|
523
|
-
|
|
524
|
-
参数:
|
|
525
|
-
slide: 幻灯片对象
|
|
526
|
-
svg_content: SVG 内容字符串(完整的 SVG 标签或 <g> 元素内容)
|
|
527
|
-
x, y: 图标在幻灯片上的位置
|
|
528
|
-
width, height: 图标的显示尺寸
|
|
529
|
-
scale: 渲染时的放大倍数(提高清晰度,默认2倍)
|
|
530
520
|
"""
|
|
531
521
|
try:
|
|
532
522
|
from playwright.sync_api import sync_playwright
|
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ const SNIPPETS = {
|
|
|
61
61
|
{ label: '示例 HTML(ppt_slide.html)', file: 'ppt_slide.html', language: 'html' }
|
|
62
62
|
],
|
|
63
63
|
notes: [
|
|
64
|
-
'【Icon 元素处理】对于复杂的 SVG 图标(如 <g id="icon-*"> 元素或包含 path 的小图标),应先将其独立保存为小的 PNG 图片,再插入到 PPTX
|
|
64
|
+
'【Icon 元素处理】对于复杂的 SVG 图标(如 <g id="icon-*"> 元素或包含 path 的小图标),应先将其独立保存为小的 PNG 图片,再插入到 PPTX 中。**不能遗漏任何图标**。',
|
|
65
65
|
'【文本颜色丢失】python-pptx 设置字体名称时会添加 a:latin/a:ea 等元素,如果颜色填充放在 rPr 末尾会被 PowerPoint 忽略。解决:用 rPr.insert(0, solidFill/gradFill) 将颜色填充插入到 rPr 开头,确保优先级最高。',
|
|
66
66
|
'【渐变文本失效】设置渐变前必须先清理 a:solidFill、a:gradFill、a:noFill 三种标签,否则会冲突。同时添加 rotWithShape="1" 和 scaled="1" 属性确保渐变方向正确。',
|
|
67
67
|
'【背景渐变被覆盖】直接操作 slide._element 时,若 p:bg 已存在需先 clear() 再重建,否则新旧元素混杂导致渲染异常。用 cSld.insert(0, bg) 确保背景节点在正确位置。',
|
|
@@ -102,12 +102,7 @@ const GUIDES = {
|
|
|
102
102
|
- **不要使用\`BeautifulSoup\`这种通用的解析元素的方式,而是逐个元素从svg代码转化为python创建元素的代码**
|
|
103
103
|
- 转换过程中,需要把图片占位元素替换成前面准备好的图片素材
|
|
104
104
|
|
|
105
|
-
4.
|
|
106
|
-
- 转换完成后,需要把svg和pptx转化为图片,然后**逐页**对图片进行对比分析
|
|
107
|
-
- 判断两者**背景、容器、线条、文字、装饰的颜色、透明度和渐变效果**是否基本一致
|
|
108
|
-
- 如果差异较大,则需要进一步调整转化脚本
|
|
109
|
-
|
|
110
|
-
5. **保留工作文件**:
|
|
105
|
+
4. **保留工作文件**:
|
|
111
106
|
- 完成后**需要保留**规划文档、html页面文件和python转化脚本,方便进一步根据反馈进行修改`
|
|
112
107
|
}
|
|
113
108
|
};
|
|
@@ -197,7 +192,7 @@ const listTools = () => ({
|
|
|
197
192
|
]
|
|
198
193
|
});
|
|
199
194
|
|
|
200
|
-
const server = new Server({ name: 'skills', version: '2.2.
|
|
195
|
+
const server = new Server({ name: 'skills', version: '2.2.5' }, { capabilities: { tools: {} } });
|
|
201
196
|
|
|
202
197
|
server.setRequestHandler(ListToolsRequestSchema, async () => listTools());
|
|
203
198
|
|