笔记模板分享[Item] 创新卡 #1072
liuenqian
started this conversation in
Note Templates
Replies: 3 comments 3 replies
-
${await new Promise(async (r) => {
const getAnnotationsByTag = async (tagName) => {
const pdfItem = await topItem.getBestAttachment();
let result = ""
for (let annoItem of pdfItem.getAnnotations()) {
if (annoItem.getTags().find(i=>i.tag.includes(tagName))) {
const res = Zotero.EditorInstanceUtilities.serializeAnnotations(
[
{
...(await Zotero.Annotations.toJSON(annoItem)), ...{ attachmentItemID: annoItem.parentID }
}
]
)
result += res.html
}
}
return result
};
let res = `<h1>创新卡 - 🔤${topItem.getField("extra").match(/titleTranslation:(.+)/)[1]} (<span style="background-color: #B1A5E1">${topItem.getField("year")}</span>, <span style="background-color: #CBE1A5">${topItem.getCreators().map((v)=>v.lastName).slice(0,1)}</span>) ${topItem.getField("journalAbbreviation")} (${topItem.getField("libraryCatalog")}) </h1>
<p><strong><span style="color: #283593">原名:</span></strong>${topItem.getField('title')}</p >
<p><strong><span style="color: #283593">译名:</span></strong>${topItem.getField("extra").match(/titleTranslation:(.+)/)[1]} </p >
<p><strong><span style="color: #283593">作者:</span></strong>${topItem.getCreators().map((v)=>v.lastName).slice(0,1)} et al.</p >
<p><strong><span style="color: #283593">期刊:</span></strong>${topItem.getField('publicationTitle')}</p >
<p><strong><span style="color: #283593">IFQ:</span></strong>${{
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)
}}$</p >
<p><strong><span style="color: #283593">DOI:</span></strong>${topItem.getField('DOI')}</p >
<p><strong><span style="color: #283593">发表时间:</span></strong>${topItem.getField('date')}</p >
<h2>👉创新点</h2>
<h3><span style="color: #063C89">${topItem.getField('journalAbbreviation')} (IF = ${topItem.getField('libraryCatalog')}): ${topItem.getField("extra").match(/titleTranslation:(.+)/)[1]};${topItem.getField('date')}</span></h3>
<h4><span style="color: #A61B41">局限性:</span></h4>
<p> ${await getAnnotationsByTag('背景/局限性')} </p >
<h4><span style="color: #A61B41">创新点:</span></h4>
<p>${await getAnnotationsByTag('创新点')}</p >
<h4><span style="color: #A61B41">研究假设:</span></h4>
<p>${await getAnnotationsByTag('背景/研究假设')}</p >
<h4><span style="color: #A61B41">材料:</span></h4>
<p></p >
<h4><span style="color: #A61B41">方法:</span></h4>
<p>${await getAnnotationsByTag('指标/材料实验/材料合成')}</p >
<h4><span style="color: #A61B41">结果:</span></h4>
<p>${await getAnnotationsByTag('结果/材料合成')}</p >
<p> <span style="color: #063C89">原文链接:</span></p >
<a href="${topItem.getField('url')}" target="_blank"> ${topItem.getField('url')}</a>
`;
r(res);
})}
【黑色幽默】
***@***.***
…------------------ 原始邮件 ------------------
发件人: "windingwind/zotero-better-notes" ***@***.***>;
发送时间: 2024年10月3日(星期四) 晚上11:07
***@***.***>;
***@***.******@***.***>;
主题: Re: [windingwind/zotero-better-notes] 笔记模板分享[Item] 创新卡 (Discussion #1072)
19行 大括号后面加分号;
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
你好,请教下这个模板该如何使用,没搞明白。是能够将高亮文本自动添加到笔记中吗? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
可以对高亮笔记按照嵌套标签或者标签进行生成模板笔记。感谢MuiseDestiny帮忙修改的代码。
Screenshots
Test on Zotero version
7.0.0-beta.108+80cc97125
Test on Better Notes version
1.1.4-beta.111
Template Type
Item
Template Share Code
Anything else
No response
Beta Was this translation helpful? Give feedback.
All reactions