diff --git a/README.md b/README.md index 1526736..cdb3047 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Everything about note management. All in Zotero. -Better Notes Handbook: [EN](https://github.com/windingwind/zotero-better-notes/wiki) | [δΈζ (provide translation)](https://zotero.yuque.com/staff-gkhviy/better-notes/biigg4?) +Better Notes Handbook (out dated, for version<=0.8.9): [δΈζ (provide translation)](https://zotero.yuque.com/staff-gkhviy/better-notes/biigg4?) ## π§© Outline @@ -157,9 +157,13 @@ _Note Template_ is designed for tasks like: - Compare papers across sections - Generate content programmatically -> π‘ Want to write your own templates? [Learn more β](#note-link) +> π‘ Need help or looking for community templates?[See here β](https://github.com/windingwind/zotero-better-notes/discussions/categories/note-templates) > -> π‘ Need help or looking for community templates?[Learn more β](#note-link) +> π‘ Want to write/share your own templates? +> +> [How to write β](docs/about-note-template.md#write-note-template) +> +> [How to share β](docs/about-note-template.md#share-your-template)

Title: ${topItem.getField("title")}
+ // @default-end + // @afterloop-begin + > Done! But Markdown is not rendered correctly. Try to add + \`// @use-markdown\` pragma before this line. + // @afterloop-end +``` + +| + | Script | +Scope | + +
|---|---|---|
| Get array of tags from current item | ++ +```js +${topItem.getTags().map(tagObj=>tagObj.tag)}` +``` + + | +Item:default | +
| Get title of current item | ++ +```js +${topItem.getField("title")} +``` + + | +Item:default | +
| Get authors of current item | ++ +```js +${topItem.getCreators().map((au) => au.firstName + " " + au.lastName).join("; ")} +``` + + | +Item:default | +
| Get PDF link of current item | +
+
+
+
+
+Click to show+ +```js +${await new Promise(async (resolve) => { + async function getPDFLink(item) { + const att = await item.getBestAttachment(); + if (!att || !att.isPDFAttachment()) { + return ""; + } + key = att.key; + if (att.libraryID === 1) { + return `zotero://open-pdf/library/items/${key}`; + } else { + groupID = Zotero.Libraries.get(att.libraryID).id; + return `zotero://open-pdf/groups/${groupID}/items/${key}`; + } + } + resolve(await getPDFLink(topItem)); +})} +``` + + |
+Item:default | +
| Get (author, year) with PDF link of current item | +
+
+
+
+
+Click to show+ +```js +${await new Promise(async (resolve) => { + const creators = topItem.getCreators(); + let content = ""; + const year = topItem.getField("year"); + if (creators.length === 0) { + content = "no author"; + } else if (creators.length === 1) { + content = `${creators[0].lastName}, ${year}`; + } else { + content = `${creators[0].lastName} etal., ${year}`; + } + // The getPDFLink is from above + const link = await getPDFLink(topItem); + let str = `${content}`; + resolve(str); +})} +``` + + |
+Item:default | +
| Get pub date of current item | ++ +```js +${topItem.getField("date")} +``` + + | +Item:default | +
| Get DOI of current item | ++ +```js +[${topItem.getField("DOI")}]("https://doi.org/${topItem.getField('DOI')}") +``` + + | +Item:default | +
| Get other fields of current item | ++ +```js +${topItem.getField("FIELD_KEY")} +``` + +`FIELD_KEY` can be found here: https://aurimasv.github.io/z2csl/typeMap.xml + + | +Item:default | +
| Get CitationKey of current item | ++ +```js +${topItem.citationKey ? topItem.citationKey : ""} +``` + + | +Item:default | +