Skip to content

Commit

Permalink
Add template keys for Zotero PDF opening URI and library location for…
Browse files Browse the repository at this point in the history
… custom Zotero URIs
  • Loading branch information
wbthomason committed May 16, 2023
1 parent 4a5f794 commit cb22bfa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Scaffolded with the wonderful
- Customizable project, section, and due date settings
- Customizable labels for tasks
- Generate Zotero select links
- Generate Zotero PDF opening links

## Installation
1. Download the [latest version](https://github.com/wbthomason/zotodo/releases/latest) of the `.xpi`.
Expand All @@ -32,4 +33,5 @@ Scaffolded with the wonderful
- [x] Create project/labels if nonexistent
- [ ] OAuth flow for getting authorization key
- [ ] Set project by Zotero collection
- [ ] Add more template tokens
- [x] Add more template tokens
- [ ] Switch to official Todoist API client
6 changes: 5 additions & 1 deletion content/zotodo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class TodoistAPI {

public async createTask(task_data: TaskData) {
const icon = `chrome://zotero/skin/spinner-16px${Zotero.hiDPI ? '@2x' : ''
}.png`
}.png`

Check failure on line 118 in content/zotodo.ts

View workflow job for this annotation

GitHub Actions / release

Expected indentation of 4 spaces but found 6
const progWin = show(icon, 'Creating task', 'Making Todoist task for item')
if (this.token == null || this.token === '') {
this.token = getPref('todoist_token')
Expand Down Expand Up @@ -622,6 +622,8 @@ class Zotodo { // tslint:disable-line:variable-name
}

const select_uri = `zotero://select/${library_path}/items/${item_id}`
let open_uri = ''
if (pdf_id != -1) { open_uri = `zotero://open-pdf/${library_path}/items/${item_id}` }

Check failure on line 626 in content/zotodo.ts

View workflow job for this annotation

GitHub Actions / release

Expected '!==' and instead saw '!='
let citekey = ''
if (
typeof Zotero.BetterBibTeX === 'object' &&
Expand All @@ -641,8 +643,10 @@ class Zotodo { // tslint:disable-line:variable-name
pdf_id,
et_al,
authors,
library_path,
item_id,
select_uri,
open_uri,
citekey,
}

Expand Down
2 changes: 1 addition & 1 deletion locale/en-US/zotodo.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!ENTITY priority "Priority for new tasks">
<!ENTITY zotero-settings "Zotero-related settings">
<!ENTITY task-format "Javascript template string for new tasks">
<!ENTITY list-of-wildcards "Acceptable tokens: ${authors}, ${title}, ${abstract}, ${url}, ${doi}, ${pdf_path} ${pdf_id}, ${item_id}, ${select_uri}, ${citekey}, ${et_al}. Use ?${token}:text? to only include 'text' if ${token} is defined for an item. Use !${token}:text! to only include 'text' if ${token} is not defined for an item.">
<!ENTITY list-of-wildcards "Acceptable tokens: ${authors}, ${title}, ${abstract}, ${url}, ${doi}, ${pdf_path} ${pdf_id}, ${item_id}, ${select_uri}, ${open_uri}, ${library_path}, ${citekey}, ${et_al}. Use ?${token}:text? to only include 'text' if ${token} is defined for an item. Use !${token}:text! to only include 'text' if ${token} is not defined for an item.">
<!ENTITY include-note "Should Zotodo add a comment to new tasks?">
<!ENTITY note-format "Javascript template string for comments">
<!ENTITY automatic-add "Should Zotodo add tasks for every newly added item?">
Expand Down

0 comments on commit cb22bfa

Please sign in to comment.