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 ${{ 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}`; } } sharedObj.getPDFLink = getPDFLink; return await getPDFLink(topItem); }}$ ``` |
Item:default |
| Get (author, year) with PDF link of current item |
Click to show```js ${{ 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 sharedObj.getPDFLink(topItem); let str = `${content}`; return 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 |