小罗碎碎念
首先展示了官方提供的几个评论数最高的模板源代码,大家凭各自的喜好自取,同时也一步一步讲解了我是如何借鉴他们的模板,以及如何按照自己的想法去改造的。
友情提醒,想复现小罗的改造过程需要一丢丢代码基础,嫌麻烦的同学建议直接拿代码跑路。有问题欢迎和我交流!
一、SCI
示意图
源代码
<!-- author:xiehui--> <span style="color:#E91E63"><h1><font size="2">标题:${topItem.getField("title")}</font></h1></span> <span style="color:#F8BBDO"><strong><u>作者:</u></strong>${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")}</span><br/> 出版年份:${topItem.getField('date')}<br/><span style="background-color:#1976D2"></span> <span style="background-color:#00ACC1">影响因子:${topItem.getField("libraryCatalog")}<br/></span> <strong>标题及摘要翻译</strong>:${topItem.getField("extra")}<br/> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 前言</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#2E7D32; background-color: #F1F8E9;"> 方法</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#4A148C; background-color: #F5F5F5;"> 结果</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #006064; background-color: #E0F7FA;"> Discussin & Conclusion & Limitation</h2> <hr/> <p></p> <h3> <span style="color: #1565C0">创新:</span></h3> <p></p> <h3> <span style="color: #1565C0">疑问:</span></h3> <p></p> </span></h1>\n <h2 style="color:#1565C0; background-color: #E1F5FE;"> 我的评价</h2> <hr/>
二、含元数据
// @author Kingw413 // @link [PUBLISH PAGE URL](https://github.com/windingwind/zotero-better-notes/discussions/598) <h1 style="text-align: center">${topItem.getField('title')}</h1> <hr/> <h2 style="color: #1B5E20; background-color:#F1F8E9;"> Meta Data</h2> <table> <tr> <th style="background-color:#dbeedd;"> <p style="text-align: left;">Title </p> </th> <td style="background-color:#dbeedd;"> ${topItem.getField('title')} </td> </tr> <tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">Journal </p> </th> <td style="background-color:#f3faf4;"> ${topItem.getField('publicationTitle')} </td> </tr> <tr> <th style="background-color:#dbeedd;"> <p style="text-align: left">Authors </p> </th> <td style="background-color:#dbeedd;"> ${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")} </td> </tr> <tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">Pub. date </p> </th> <td style="background-color:#f3faf4;"> ${topItem.getField('date')} </td> </tr> <tr> <th style="background-color:#dbeedd;" <!-- 期刊标签 --> <p style="text-align: left">期刊标签</p> </th> <td style="background-color:#dbeedd;"> ${(() => {let space = " ㅤㅤ ㅤㅤ" return Array.prototype.map.call(Zotero.ZoteroStyle.data.ztoolkit.ItemTree.globalCache.renderCellHooks.PublicationTags( 0, Zotero.ZoteroStyle.data.ztoolkit.ItemTree.fieldHooks.globalCache.getFieldHooks.PublicationTags( "", true, true, topItem, undefined) ).childNodes, e => { e.innerText = space + space + e.innerText + space + space; return e.outerHTML }).join(space) })() } </td> </tr> <tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">DOI </p> </th> <td style="background-color:#f3faf4;"> <a href="https://doi.org/${topItem.getField('DOI')}">${topItem.getField('DOI')}</a> </td> </tr> <tr> <th style="background-color:#dbeedd;"> <p style="text-align: left">附件</p> </th> <td style="background-color:#dbeedd;"> <a href=zotero://open-pdf/0_${Zotero.Items.get(topItem.getAttachments()).filter((i) => i.isPDFAttachment())[0].key}> ${Zotero.Items.get(topItem.getAttachments()).filter((i)=> i.isPDFAttachment())[0].getFilename()} </a> </td> </tr> </table> </table> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 研究背景 & 基础 & 目的</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#2E7D32; background-color: #F1F8E9;">📊 研究内容</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#4A148C; background-color: #F5F5F5;"> 研究结论</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #006064; background-color: #E0F7FA;"> 感想 & 疑问</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#1565C0; background-color: #E1F5FE;"> 理论推导</h2> <hr/> <p></p>
示意图
三、英文文献
<html> <hr/> <table border="1"> <!-- 这里提取了翻译标题,也要安装Zotero PDF Translate插件,否则只会显示英文标题 --> <h2 style="color: #E65100; background-color: #FFF8E1;">(${topItem.getField("date")}) ${topItem.getField("title")}(${topItem.getField("titleTranslation")})</h2> <tr> <td><b>期刊: <b style="color:#FF0000">${topItem.getField('publicationTitle')}</b></b>(发表日期: <b>${topItem.getField("date")}</b>)<br><b>作者:</b> ${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")}</td> </tr> <tr> <td><b>摘要翻译: </b> <!-- 要提前安装Zotero PDF Translate插件,否则摘要翻译找不到 --> <i>${topItem.getField('abstractTranslation')}</i></td> </tr> <tr> <td><b>期刊分区: </b> <!-- 引用了zotero style插件的标签,需要安装此插件,否则分区找不到--> ${(() => {let space = " ㅤㅤ ㅤㅤ" return Array.prototype.map.call(Zotero.ZoteroStyle.data.ztoolkit.ItemTree.globalCache.renderCellHooks.PublicationTags( 0, Zotero.ZoteroStyle.data.ztoolkit.ItemTree.fieldHooks.globalCache.getFieldHooks.PublicationTags( "", true, true, topItem, undefined) ).childNodes, e => { e.innerText = space + space + e.innerText + space + space; return e.outerHTML }).join(space) })() } </td> </tr> <tr> <td><b>原文PDF链接: </b> <!-- 前提是有pdf附件,否则也找不到 --> <a href=zotero://open-pdf/0_${Zotero.Items.get(topItem.getAttachments()).filter((i) => i.isPDFAttachment())[0].key}>${Zotero.Items.get(topItem.getAttachments()).filter((i)=> i.isPDFAttachment())[0].getFilename()} </a> </td> </tr> <tr> <td><b>笔记创建日期: </b>${new Date().toLocaleString()}</td> </tr> </table> <!-- Tips不想要可以自行删掉 --> <h3> 创新点</h3> <blockquote>Tips: 本文提出了什么<u>新的科学问题</u>,提出了什么<u>新的研究思路</u>,或提出了什么<u>新的研究工具</u>?</blockquote> <h3> 前言及文献综述</h3> <blockquote>Tips: 本研究的<u>必要性、紧迫性、可行性</u>是什么?作者是如何论述的?<br>作者引用了哪些该领域的<u>开创性文献</u>?</blockquote> <h3> 数据</h3> <h3> 方法</h3> <h3> 结论</h3> <h3> 思考</h3> <blockquote>Tips: 本文有什么<u>优缺点</u>?你是否对某些内容产生了<u>疑问</u>?<br>你是否认为某些研究方式可以改进,<u>如何改进</u>?</blockquote> </html>
四、中文文献
源代码
<html> <hr/> <table border="1"> <h2 style="color: #E65100; background-color: #FFF8E1;">(${topItem.getField("date")}) ${topItem.getField("title")}</h2> <tr> <td><b>期刊: <b style="color:#FF0000">${topItem.getField('publicationTitle')}</b></b>(发表日期: <b>${topItem.getField("date")}</b>)<br><b>作者:</b> ${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")}</td> </tr> <tr> <td><b>摘要: </b><i>${topItem.getField('abstractNote')}</i></td> </tr> <tr> <td><b>期刊分区: </b> <!-- 引用了zotero style插件的标签,请提前安装,否则找不到分区 --> ${(() => {let space = " ㅤㅤ ㅤㅤ" return Array.prototype.map.call(Zotero.ZoteroStyle.data.ztoolkit.ItemTree.globalCache.renderCellHooks.PublicationTags( 0, Zotero.ZoteroStyle.data.ztoolkit.ItemTree.fieldHooks.globalCache.getFieldHooks.PublicationTags( "", true, true, topItem, undefined) ).childNodes, e => { e.innerText = space + space + e.innerText + space + space; return e.outerHTML }).join(space) })() } </td> </tr> <tr> <td><b>原文PDF链接: </b> <!-- 前提是有pdf附件,否则也找不到 --> <a href=zotero://open-pdf/0_${Zotero.Items.get(topItem.getAttachments()).filter((i) => i.isPDFAttachment())[0].key}>${Zotero.Items.get(topItem.getAttachments()).filter((i)=> i.isPDFAttachment())[0].getFilename()} </a> </td> </tr> <tr> <td><b>笔记创建日期: </b>${new Date().toLocaleString()}</td> </tr> </table> <!-- Tips不想要可以自行删掉 --> <h3> 创新点</h3> <blockquote>Tips: 本文提出了什么<u>新的科学问题</u>,提出了什么<u>新的研究思路</u>,或提出了什么<u>新的研究工具</u>?</blockquote> <h3> 前言及文献综述</h3> <blockquote>Tips: 本研究的<u>必要性、紧迫性、可行性</u>是什么?作者是如何论述的?<br>作者引用了哪些该领域的<u>开创性文献</u>?</blockquote> <h3> 数据</h3> <h3> 方法</h3> <h3> 结论</h3> <h3> 思考</h3> <blockquote>Tips: 本文有什么<u>优缺点</u>?你是否对某些内容产生了<u>疑问</u>?<br>你是否认为某些研究方式可以改进,<u>如何改进</u>?</blockquote> </html>
示意图
五、小罗定制
我比较喜欢第二个“含元数据”的模板,所以我决定在它的基础上进行修改。
首先解读一下源代码。
标题
<h1 style="text-align: center">${topItem.getField('title')}</h1> <hr/> <h2 style="color: #1B5E20; background-color:#F1F8E9;"> Meta Data</h2>
<h1>
标签用于显示标题,其中 ${topItem.getField('title')}
是一个占位符,它将被实际的标题值替换。
<hr/>
标签用于创建水平分隔线。<h2>
标签用于显示小标题,例如 " Meta Data"。
表格
<table> <tr> <th style="background-color:#dbeedd;"> <p style="text-align: left;">Title </p> </th> <td style="background-color:#dbeedd;"> ${topItem.getField('title')} </td> </tr>
这部分代码创建了一个表格,并包含一行,其中包含一个表头单元格和一个数据单元格。以下是对代码的解读:
<table>
标签用于创建一个表格。<tr>
标签用于创建表格的行。<th>
标签用于创建表头单元格。style="background-color:#dbeedd;"
是一个内联样式,用于设置表头单元格的背景颜色为#dbeedd
。<p>
标签用于创建段落。${topItem.getField('title')}
是一个占位符,它将被实际的标题值替换。这个值是通过调用topItem
对象的getField
方法并传递'title'
参数来获取的。<td>
标签用于创建数据单元格。style="background-color:#dbeedd;"
是一个内联样式,用于设置数据单元格的背景颜色为#dbeedd
。
总结起来,这段代码创建了一个带有标题的表格行,表头单元格的背景颜色为 #dbeedd
,数据单元格中显示的是通过 topItem
对象的 getField('title')
方法获取的标题值。
期刊
<tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">Journal </p> </th> <td style="background-color:#f3faf4;"> ${topItem.getField('publicationTitle')} </td> </tr>
这段代码负责获取期刊。
作者
<tr> <th style="background-color:#dbeedd;"> <p style="text-align: left">Authors </p> </th> <td style="background-color:#dbeedd;"> ${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")} </td> </tr>
这段代码用于获取作者。
出版日期
<tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">Pub. date </p> </th> <td style="background-color:#f3faf4;"> ${topItem.getField('date')} </td> </tr>
获取出版日期。
<tr> <th style="background-color:#dbeedd;" <!-- 期刊标签 --> <p style="text-align: left">期刊标签</p> </th> <td style="background-color:#dbeedd;"> ${(() => {let space = " ㅤㅤ ㅤㅤ" return Array.prototype.map.call(Zotero.ZoteroStyle.data.ztoolkit.ItemTree.globalCache.renderCellHooks.PublicationTags( 0, Zotero.ZoteroStyle.data.ztoolkit.ItemTree.fieldHooks.globalCache.getFieldHooks.PublicationTags( "", true, true, topItem, undefined) ).childNodes, e => { e.innerText = space + space + e.innerText + space + space; return e.outerHTML }).join(space) })() } </td> </tr>
这一段调用另一个插件Zotero Style,并且需要安装easy scholar插件,比较麻烦,所以我要把它替换掉,直接显示影响因子。
这里会借鉴一下第一个“SCI”的源代码。
<span style="background-color:#00ACC1">影响因子:${topItem.getField("libraryCatalog")}<br/></span>
这行代码获取的是文库编目,对标的就是IF。我们从上面的代码段随便选一个进行改造。
<tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">Pub. date </p> </th> <td style="background-color:#f3faf4;"> ${topItem.getField('date')} </td> </tr>
我们只需要把date替换成libraryCatalog即可,另外,配色也要记得修改,不然没区别了。最后,代码如下:
影响因子
<tr> <th style="background-color:#dbeedd;"> <p style="text-align: left">Pub. date </p> </th> <td style="background-color:#dbeedd;"> ${topItem.getField('libraryCatalog')} </td> </tr>
doi
<tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">DOI </p> </th> <td style="background-color:#f3faf4;"> <a href="https://doi.org/${topItem.getField('DOI')}">${topItem.getField('DOI')}</a> </td> </tr> </table>
获取文章的doi,我们按住Ctrl,点击这个链接,可以直接打开内置的PDF阅读器。这个功能不错,保留!
DIY
</table> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 研究背景 & 基础 & 目的</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#2E7D32; background-color: #F1F8E9;">📊 研究内容</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#4A148C; background-color: #F5F5F5;"> 研究结论</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #006064; background-color: #E0F7FA;"> 感想 & 疑问</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#1565C0; background-color: #E1F5FE;"> 理论推导</h2> <hr/> <p></p>
以上就是DIY的模块啦,可以按照自己领域论文的架构去灵活定义,直接复制粘贴即可!
我现在需要把摘要也放进来,此时需要参考第四个笔记模板。
<tr> <td><b>摘要: </b><i>${topItem.getField('abstractNote')}</i></td> </tr>
我们此处不需要把摘要放在表格里了,所以做一些改动。
</table> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 摘要</h2> <hr/> <p <td><b>摘要: </b><i>${topItem.getField('abstractNote')}</i></td>></p> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 研究背景 & 基础 & 目的</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#2E7D32; background-color: #F1F8E9;">📊 研究内容</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#4A148C; background-color: #F5F5F5;"> 研究结论</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #006064; background-color: #E0F7FA;"> 感想 & 疑问</h2> <hr/> <p></p> </span></h1>\n <h2 style="color:#1565C0; background-color: #E1F5FE;"> 理论推导</h2> <hr/> <p></p>
六、目前版本
<h1 style="text-align: center">${topItem.getField('title')}</h1> <hr/> <h2 style="color: #1B5E20; background-color:#F1F8E9;"> Meta Data</h2> <table> <tr> <th style="background-color:#dbeedd;"> <p style="text-align: left;">Title </p> </th> <td style="background-color:#dbeedd;"> ${topItem.getField('title')} </td> </tr> <tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">Journal </p> </th> <td style="background-color:#f3faf4;"> ${topItem.getField('publicationTitle')} </td> </tr> <tr> <th style="background-color:#dbeedd;"> <p style="text-align: left">Authors </p> </th> <td style="background-color:#dbeedd;"> ${topItem.getCreators().map((v)=>v.firstName+" "+v.lastName).join("; ")} </td> </tr> <tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">Pub. date </p> </th> <td style="background-color:#f3faf4;"> ${topItem.getField('date')} </td> </tr> <tr> <th style="background-color:#dbeedd;"> <p style="text-align: left">IF </p> </th> <td style="background-color:#dbeedd;"> ${topItem.getField('libraryCatalog')} </td> </tr> <tr> <th style="background-color:#f3faf4;"> <p style="text-align: left">DOI </p> </th> <td style="background-color:#f3faf4;"> <a href="https://doi.org/${topItem.getField('DOI')}">${topItem.getField('DOI')}</a> </td> </tr> <tr> <th style="background-color:#dbeedd;"> <p style="text-align: left">附件</p> </th> <td style="background-color:#dbeedd;"> <a href=zotero://open-pdf/0_${Zotero.Items.get(topItem.getAttachments()).filter((i) => i.isPDFAttachment())[0].key}> ${Zotero.Items.get(topItem.getAttachments()).filter((i)=> i.isPDFAttachment())[0].getFilename()} </a> </td> </tr> </table> </table> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 摘要</h2> <hr/> <p <td><b>Abstract: </b><i>${topItem.getField('abstractNote')}</i></td>></p> <p><b>摘要: </b></p> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 整体分析</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 数据集分析</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 模型分析</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 方法分析</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 代码分析</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 专有名词</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 结论分析</h2> <hr/> <p></p> </span></h1>\n <h2 style="color: #E65100; background-color: #FFF8E1;"> 感想&启发</h2> <hr/> <p></p>
好啦,小罗的私人定制模板至此就完成啦!欢迎大家提供更多更有趣的模板!