Skip to content

Commit

Permalink
Updated: 2019-11-21 20:41:32
Browse files Browse the repository at this point in the history
  • Loading branch information
DeppWang committed Nov 21, 2019
0 parents commit 06a3a6a
Show file tree
Hide file tree
Showing 9 changed files with 1,075 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## alfred-pangu-workflow

![盘古之白](https://tva1.sinaimg.cn/large/006y8mN6ly1g95xl43qg2j303l03lq2v.jpg)

[下载链接]()

**前言:**

在使用 [alfred-clipboard-ocr](https://github.com/oott123/alfred-clipboard-ocr) 的过程中,ocr 识别的文字排版不美观,每次都要手动添加空格,想着利用 Workflow 「一步到位」,所以写了这个简单的 Workflow

**简介:**

格式化剪贴板文字,为文字中的中文与英文、数字之间加上空格。

**使用方法**

复制到剪贴板后,打开 Alfred,输入 `pangu` 关键字,回车。格式后的文本会复制到剪贴板中,此时直接 Ctrl+V 粘贴即可

**示例:**

![image-20191121202655416](https://tva1.sinaimg.cn/large/006y8mN6ly1g95xmme437j30zy09stc3.jpg)

**提示:**

[中文文案排版指北](https://github.com/sparanoid/chinese-copywriting-guidelines)
[為什麼你們就是不能加個空格呢?](https://github.com/vinta/pangu.js)

**拓展:**

[alfred-clipboard-ocr](https://github.com/oott123/alfred-clipboard-ocr) 是一个对剪贴板中的图片内容调用百度云 API 做 OCR 识别的 Alfred 工作流。对于不能选择复制的文字,可利用截屏后 OCR 识别,大大提高生产力。可在 alfred-clipboard-ocr 工作流中,加入 alfred-pangu-workflow 的脚本。

![image-20191121203616998](https://tva1.sinaimg.cn/large/006y8mN6ly1g95xwd8pbsj313608y77v.jpg)
11 changes: 11 additions & 0 deletions format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/python3
# coding=utf-8
import pangu
import pyperclip

text = pyperclip.paste()
print(text)
new_text = pangu.spacing_text(text)
pyperclip.copy(new_text)
print(new_text)

Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 148 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.deppwang.alfred-format-workflow</string>
<key>category</key>
<string>Tools</string>
<key>connections</key>
<dict>
<key>7910EB1E-72C2-40CB-86D9-3C009AA296DA</key>
<array>
<dict>
<key>destinationuid</key>
<string>3549F4CA-4434-4EF7-9B68-B5988BF0027A</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>F81BE267-5FB9-45E5-89F9-0D0936A17AFC</key>
<array>
<dict>
<key>destinationuid</key>
<string>7910EB1E-72C2-40CB-86D9-3C009AA296DA</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>DeppWang</string>
<key>description</key>
<string>格式化剪贴板文字,为文字中的中文与英文、数字之间加上空格。</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>pangu</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>pangu</string>
<key>subtext</key>
<string></string>
<key>text</key>
<string>格式化剪贴板文字</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>F81BE267-5FB9-45E5-89F9-0D0936A17AFC</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>68</integer>
<key>script</key>
<string>python3 test.py</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string>./format.py</string>
<key>type</key>
<integer>8</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>7910EB1E-72C2-40CB-86D9-3C009AA296DA</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>lastpathcomponent</key>
<false/>
<key>onlyshowifquerypopulated</key>
<false/>
<key>removeextension</key>
<false/>
<key>text</key>
<string></string>
<key>title</key>
<string>已完成格式化,请查看剪贴板,或直接使用 Ctrl+V 复制</string>
</dict>
<key>type</key>
<string>alfred.workflow.output.notification</string>
<key>uid</key>
<string>3549F4CA-4434-4EF7-9B68-B5988BF0027A</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string>格式化剪贴板文字,为文字中的中文与英文、数字之间加上空格。
具体排版规范请参考:
「中文文案排版指北」(https://github.com/sparanoid/chinese-copywriting-guidelines)
「為什麼你們就是不能加個空格呢?」(https://github.com/vinta/pangu.js)</string>
<key>uidata</key>
<dict>
<key>3549F4CA-4434-4EF7-9B68-B5988BF0027A</key>
<dict>
<key>xpos</key>
<integer>470</integer>
<key>ypos</key>
<integer>140</integer>
</dict>
<key>7910EB1E-72C2-40CB-86D9-3C009AA296DA</key>
<dict>
<key>xpos</key>
<integer>310</integer>
<key>ypos</key>
<integer>140</integer>
</dict>
<key>F81BE267-5FB9-45E5-89F9-0D0936A17AFC</key>
<dict>
<key>xpos</key>
<integer>140</integer>
<key>ypos</key>
<integer>140</integer>
</dict>
</dict>
<key>version</key>
<string>1.0</string>
<key>webaddress</key>
<string>https://github.com/DeppWang/alfred-pangu-workflow</string>
</dict>
</plist>
11 changes: 11 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/python3
# coding=utf-8
import pangu
import pyperclip

text = pyperclip.paste()
print(text)
new_text = pangu.spacing_text(text)
pyperclip.copy(new_text)
print(new_text)

Loading

0 comments on commit 06a3a6a

Please sign in to comment.