Comments (9)
建了一个zotero-wps插件开发项目,感兴趣的同学一起去那边交流吧,争取早日搞定zotero的wps插件。zotero-wps插件开发的交流QQ群:1029775161,https://github.com/l0o0/Zotero-WPS
from translators_cn.
造一个 Zotero WPS Integration,确实超纲。
Zotero Word for Windows Integration 是一个跟 JavaScript 几乎没有关系的古董。
Zotero.dotm
是用 VBA 写的 Word Template,仅实现 Ribbon 菜单以及从 Word 发消息到 Zotero。
而主体是一个用 Visual C++/MFC 写的库,调用 Word Interop API 来实现引文管理功能。
这导致它不能在 WPS 上正常工作。
如果要支持 WPS,则需调用 WPS 文字 API。文档在 WPS 开放平台 > 开发文档 > WPS 客户端开发 > WPS 基础接口 > 文字 API 参考。
简单翻了一下 Zotero Connector 以及其他 Zotero integration plugin,感觉 WPS 加载项确实可以实现相关功能。
从 Zotero 拉取数据是大头。
-
Zotero 桌面应用有 Zotero Connector Server。它自带一套 RPC 风格的 HTTP Citing Protocol。
-
Better BibTeX for Zotero (BBT) (GitHub) 示范了如何扩展 Connector Server。不过,不太清楚 Zotero 5.0.71 的更改
Additional protections to prevent visited webpages from triggering actions in Zotero plugins
会产生什么阻碍。
目前就找到这么多。
如果哪位有兴趣,可以试一下。
如果不行,那么只好也走 OLE Automation。搜到几篇古老的文章,或许可参考:
from translators_cn.
造一个 Zotero WPS Integration,确实超纲。
Zotero Word for Windows Integration 是一个跟 JavaScript 几乎没有关系的古董。
Zotero.dotm
是用 VBA 写的 Word Template,仅实现 Ribbon 菜单以及从 Word 发消息到 Zotero。而主体是一个用 Visual C++/MFC 写的库,调用 Word Interop API 来实现引文管理功能。
从 Zotero 拉取数据是大头。
从 Zotero 拉取数据是大头
, 这个大头
感觉不太准确, 从Zotero取数据毕竟VBA都已经实现了, 直接照着用JS重写即可, 真正的大头
应该是用JS解析数据并实现用 Visual C++/MFC 写的库
的功能
在WPS已经实现了JS宏和JS加载项的前提下, 上述功能的实现不能说是"轻而易举", 起码够得上"水到渠成"
需要的是 或者独立代发经验丰富的大佬动手 或者有项目开发经验的大佬规划和领导...
以上, 最后一段可能有点"想当然"的意味, 请多见谅!
from translators_cn.
@Lemmingh 是我理解的肤浅了, 刚刚用WPS打开Zotero.dotm查看源代码, 确实如你所言
但是用这种方案的话, 许多Zotero已经实现的工作必须都用JS加载项重做了, 比如: 丰富的引文格式, 工作量不是一般的大
from translators_cn.
丰富的引文格式
关键在 Custom endpoint handler 能做什么。
上面提到了 BBT,它在 Connector Server 上实现了许多 endpoint。按这个思路,利用 Zotero plugin,仍然可以让 Zotero 完成排版,最后 WPS 加载项这边拉取呈现和 metadata,再嵌入文档。(在 Word 上,是 Zotero 走 IA 把这些东西写进文档。)
但我不清楚 Zotero 5.0.71 增加的安全限制是怎么回事。如果是测 UA,可以想办法绕过。
-
Electron 似乎不受影响。因为一个基于 BBT 开发的产品 (https://github.com/mblode/vscode-zotero/blob/0a0298cf1b6c0f3685d74a67263d3dcbe69735b8/extension.js#L8) 仍能工作。
-
根据文档,WPS plugin host 是个 Chromium,那么,网络通信能用 XHR 或者 Fetch,我不知道它会被 Zotero 当成什么东西。Chrome 好像有个什么毛病,我想不起来。
from translators_cn.
这个目前超纲了,我也是刚学JS没多久的新人。
from translators_cn.
刚刚试着看看Zotero.dotm中的VBA代码, 用Word2016打开提示"功能锁定"-"工程不可查看", 换WPS2019打开, 直接随便看
注明了使用GNU共享协议, 有两个模块, Zotero和ZoteroRibbon, 代码超简单:
' Zotero功能的精华
Sub ZoteroCommand(cmd As String, bringToFront As Boolean)
Dim cds As COPYDATASTRUCT
#If VBA7 Then
Dim ThWnd As LongPtr
#Else
Dim ThWnd As Long
#End If
Dim a$, args$, name$
Dim i As Long
Dim ignore As Long
Dim sBuffer$
Dim lLength As Long
Dim buf() As Byte
' Try various names for Firefox
Dim appNames(5)
appNames(1) = "Zotero"
appNames(2) = "Firefox"
appNames(3) = "Browser"
appNames(4) = "firefox-dev"
For i = 1 To 4
ThWnd = FindWindow(appNames(i) & "MessageWindow", vbNullString)
If ThWnd <> 0 Then
Exit For
End If
Next
If ThWnd = 0 Then
MsgBox ("Word could not communicate with Zotero. Please ensure Zotero is running and try again. If this problem persists, see https://www.zotero.org/support/word_processor_plugin_troubleshooting")
Exit Sub
End If
' Allow Firefox to bring a window to the front
If bringToFront Then Call SetForegroundWindow(ThWnd)
' Get path to active document
If ActiveDocument.Path <> "" Then
name$ = ActiveDocument.Path & Application.PathSeparator & ActiveDocument.name
Else
name$ = ActiveDocument.name
End If
' Set up command line arguments
name$ = Replace(name$, """", """""")
args$ = "-silent -ZoteroIntegrationAgent WinWord -ZoteroIntegrationCommand " & cmd & " -ZoteroIntegrationDocument """ & name$ & """"
a$ = "firefox.exe " & args$ & Chr$(0) & "C:\"
' Do some UTF-8 magic
lLength = WideCharToMultiByte(CP_UTF8, 0, StrPtr(a$), -1, ByVal 0, 0, 0, 0)
ReDim buf(lLength) As Byte
Call WideCharToMultiByte(CP_UTF8, 0, StrPtr(a$), -1, buf(1), lLength, 0, 0)
' Send message to Firefox
cds.dwData = 1
cds.cbData = lLength
cds.lpData = VarPtr(buf(1))
i = SendMessage(ThWnd, WM_COPYDATA, 0, cds)
' Handle error
If Err.LastDllError = 5 Then
If Dir("C:\Program Files\Mozilla Firefox\firefox.exe") <> "" Then
Call Shell("""C:\Program Files\Mozilla Firefox\firefox.exe"" " & args$, vbNormalFocus)
ElseIf Dir("C:\Program Files (x86)\Mozilla Firefox\firefox.exe") <> "" Then
Call Shell("""C:\Program Files (x86)\Mozilla Firefox\firefox.exe"" " & args$, vbNormalFocus)
End If
End If
End Sub
用JS重写的话, 就卡在了FindWindow
这种系统API的操作函数, 需要用另外的工具实现
from translators_cn.
Zotero Word for Windows Integration 的那个 Zotero.dotm
仅仅是个 Ribbon,点一下就向 Zotero 发个指令,其他什么功能都没有。
所有逻辑都是在 Zotero 中实现的。
我理解的它的架构:
+------------------+ +------------------+
| Microsoft Word | | Zotero |
| | | |
| +-------------+ | | +-------------+ |
| | Zotero.dotm |-------->| Citation | |
| +-------------+ | | | handler | |
| | | +-------------+ |
| | | ↕ |
| +-------------+ | | +-------------+ |
| | Document | | | | Glue JS | |
| +-------------+ | | +-------------+ |
| ↕ | | ↕ |
| +-------------+ | | +-------------+ |
| | Interop API |<------->| Native | |
| +-------------+ | | +-------------+ |
| | | |
+------------------+ +------------------+
"Zotero" pulls from and pushes to "Microsoft Word".
而做 WPS Integration,我认为应当采取这种方案:
+------------------+ +------------------+
| WPS | | Zotero |
| | | |
| +-------------+ | | +-------------+ |
| | Ribbon | | | | Citation | |
| | / | | | | handler | |
| | TaskPane | | | +-------------+ |
| +-------------+ | | ↕ |
| ↑ | | +-------------+ |
| | | | | Custom | |
| ↓ | | | endpoint | |
| +-------------+ | | | handler | |
| | Plugin host |<---+ | +-------------+ |
| +-------------+ | | | ↕ |
| ↕ | | | +-------------+ |
| +-------------+ | +--->| Connector | |
| | Document | | | | server | |
| +-------------+ | | +-------------+ |
| | | |
+------------------+ +------------------+
"WPS" pulls from "Zotero".
from translators_cn.
目前有同学向wps发邮件,希望开发插件。wps也回应了,希望能早点出来。如果着急可以一起发邮件催一催
有同学收到WPS的消息是他们已经提供文档了,不负责开发🙃
from translators_cn.
Related Issues (20)
- 知网工具书总库
- 为「国家哲学社会科学文献中心」增加「.cn」域名支持。 HOT 1
- 豆瓣 translator 是否能把海报作为附件 HOT 4
- 北大法宝翻译器似乎存在部分问题。 HOT 3
- 请求保存微信公众号[内容保存为笔记形式(仅保留文本)]的功能
- NDLTD in Taiwan HOT 1
- 无法抓取知网学术论文条目信息 HOT 2
- **学术期刊开放取用平台(臺灣學術期刊開放取用平台/TOAJ)
- 豆瓣部分书籍「其他」字段内容出现错误 HOT 1
- patsnap专利库翻译器申请 HOT 1
- 豆瓣无法识别作者条目中[法]符号
- 豆瓣从豆列中批量导入电影时「其他」字段会将同时导入电影的信息保存
- TOAJ HOT 1
- 豆瓣书作者获取失败
- [Bug] PDC转换器的CreatorsExt未过滤无国籍无原名的作者、作者被默认设为译者
- 是否考虑将电影风格放入「流派」字段 HOT 3
- Mac系统,cnki抓取知网学位论文需手动添加.caj后缀才能打开 HOT 7
- 掌桥科研语种 HOT 4
- 豆瓣翻译器获取内容有误
- 请求增加法学研究官网翻译器🙏 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from translators_cn.