PKM-er / obsidian-zotlit

A third-party project that aims to facilitate the integration between Obsidian.md and Zotero, by providing a set of community plugins for both Obsidian and Zotero.
https://zotlit.aidenlx.top
MIT License
632 stars 28 forks source link

如何将extra中的内容提取为自定义的字段? #212

Closed CoLin00 closed 11 months ago

CoLin00 commented 11 months ago

您好,感谢大佬的插件,非常好用!

请问下大佬,我如何可以自定义提取extra的内容。

extra中我输入了"original-date: 1997",我在模版中设定了:

original-date: <%= /original-date:\s*(\d+)/.exec(it.extra)[1] %>

当我的文献中extra中没有输入original-date相关信息的时候,这个命令会出错,模版无法执行。在有这个数据的时候,输出是正常的。

另外,若是extra中我添加了多行的类似数据应该如何执行呢?例如,当extra中有:“Original Author: James C. Scott Original Title: Seeing Like a State: How Certain Schemes to Improve the Human Condition Have Failed”这样的内容的时候呢?

谢谢!