【Zotero系列】文献阅读模板分享

内容摘要

本文主要介绍Zotero7自定义笔记模板如何创建,并分享一个好看且实用的笔记模板。

环境需求

模板编辑

打开模板编辑器

![[Pasted image 20240424131534.png]]

创建模板

![[Pasted image 20240424131916.png]]

自定义模板

%% 自定义模板主要关注两件事情,一个是内容样式,一个是数据字段 %%

内容样式

// 标题样式
<h1> </h1>
<h2> </h2>
<h3> </h3>

// 表格样式
<table>
	// 第一行
	<tr>
		<td>
		【内容】
		</td>
	</tr>
	// 第二行
	<tr>
		<td>
		【内容】
		</td>
	</tr>
</table>
// 内容加粗
<b> </b>
// 换行
<br/>

数据字段

常用字段如下
![[Pasted image 20240424134840.png]]

由于Zotero 6和Zotero 7中的数据字段有所区别,更多内容请参考:zotero-better-notes/docs/about-note-template.md at master · windingwind/zotero-better-notes (github.com)

模板分享

效果展示

![[Pasted image 20240424125941.png]]

模板代码

<html>
	
<table>
  <tr>
    <td>
      <b>
	  📌 Title: ${(() => {
		const titleTranslation = topItem.getField("titleTranslation");
		if (titleTranslation) {
			return `(${topItem.getField("date")}) ${topItem.getField("title")} (${titleTranslation})`;
		} else {
			return `(${topItem.getField("date")}) ${topItem.getField("title")}`;
		}
		})()}
	</b>
    </td>
  </tr>
  <tr>
    <td>
      <b>👨‍🎓 Author: </b>
	  ${topItem.getCreators().map((v) => v.firstName + " " + v.lastName).join("; ")}
    </td>
  </tr>
  <tr>
    <td>
      <b>🏛️ Publication: </b>
	  ${topItem.getField('publicationTitle')}
	  
    </td>
  </tr>
  <tr>
    <td>
      <b>📜 Journal Tags: </b> 
	  ${{
        let space = " ㅤㅤㅤㅤ";
        return Array.prototype.map.call(
          Zotero.ZoteroStyle.api.renderCell(topItem, "publicationTags").childNodes,
          e => {
            e.innerText =  space + e.innerText + space;
            return e.outerHTML
          }
          ).join(space)
        }}$
		
    </td>
  </tr>
  <tr>
    <td>
      <b>🎯 Tags: </b> ${topItem.getTags().map(tagObj=>{
		let tag = tagObj.tag;
		let match = tag.match(/\((.*?)\)/);
		if (match) {
			return "#" + match[1];
		} else {
			return "#" + tag.replace(/\s+/g, "-");
		}
	}).join("; ")}
    </td>
  </tr>
  <tr>
    <td>
      <b>🔗 DOI: </b>
	  ${(() => {
          const doi = topItem.getField("DOI");
          if (doi) {
            return `<a href="https://doi.org/${topItem.getField('DOI')}">${topItem.getField("title")}</a>`;
          } else {
            return `<a href="${topItem.getField('url')}">${topItem.getField("title")}</a>`;
          }
        })()}
    </td>
  </tr>
  <tr>
    <td>
      <b>📁 Local Link: </b>
	  <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>📅 Note Date: </b>${new Date().toLocaleString()}</td>
  </tr>
</table>

<br>
<span>
  <h2 style="color: #e0ffff; background-color: #66cdaa">
    📜 研究背景 现状 目标
  </h2>
  <hr />
</span>
<p></p>
<h3>⚙️ 背景</h3>
<p></p>
<h3>💡 现状</h3>
<p></p>
<h3>🚀 目标</h3>
<p></p>

<span>
  <h2 style="color: #20b2aa; background-color: #afeeee">🔁 研究内容</h2>
  <hr />
</span>
<p></p>
<h3>🧩 数据</h3>
<p></p>
<h3>🚊 研究基础</h3>
<p></p>
<h3>💻 技术路线</h3>
<p></p>
<h3>👩🏻‍💻 研究方法 方案</h3>
<p></p>
<h3>🔬 实验</h3>
<p></p>
<h3>📜 结论</h3>
<p></p>
<h3>📚 参考</h3>
<p></p>

<span>
  <h2 style="color: #004d99; background-color: #87cefa">🤔 个人总结</h2>
  <hr />
</span>
<p></p>
<h3>🙋‍♀️ 重点记录</h3>
<p></p>
<h3>📌 待解决</h3>
<p></p>
<h3>💭 思考启发</h3>
<p></p>

</html>

常见问题

函数未定义

报错原因:函数名称写错。
解决方法:编辑数据字段引用时,严格参考插件文档。

![[Pasted image 20240424133550.png]]

数据未定义

报错原因:由于当前选中的文件没有附件,无法获取附件字段信息,因此报错。
解决方法:选中一个字段不缺失的就好了,这个报错问题不是很大

![[Pasted image 20240424133843.png]]

有时候存在tags字段加载不出来的情况,注意检查一下文献是否包含tags,以及修改后调用的函数是否正确使用

在这里插入图片描述

参考资料

  1. [item] (已适配7) 自用读中文文献、读英文文献笔记模板两套,简约风格 · windingwind/zotero-better-notes · Discussion #729 (github.com)
  2. [Text] MainNote 主笔记模板 通用笔记模版 简约清晰风格 Main note template, common note template, simple and clear style · windingwind/zotero-better-notes · Discussion #772 (github.com)
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

可口的冰可乐

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值