diff --git a/Changelog.md b/Changelog.md index e4aabf4..39308d4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,5 @@ +- 2022-06-07 release 9.5.5 +- 2022-06-07 addings now also works with URLs containing DOIs - 2022-06-03 release 9.5.4 - 2022-06-03 added logging + fix #9 - 2022-06-03 make last version indicator uploadable to github diff --git a/README.md b/README.md index bbab0f8..4802ca4 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ If there is a citation syntax that commonly using, feel free to make a PR to [th - `⌘fn + ↵`: Delete the entry from the BibTeX library. - ⚠️ This feature is untested with BiBTeX files created with apps other than BibDesk and Bookends (or have been formatted with `bibtex-tidy`). [Create an issue](https://github.com/chrisgrieser/alfred-bibtex-citation-picker/issues) for problems with other apps. - __Add entries to the BibTex library__: use the Alfred Keyword `+`, followed by a DOI or ISBN + - This also works with URLs that contain a DOI. - the respective entry will be added to your library, with a properly formatted citekey (avoiding duplicates with existing library, etc.) - Leave the input after the `+` empty to create a new, empty BibTeX entry. - Opens the entry afterwards in the app specified in `open_entries_in`. diff --git a/Supercharged-Citation-Picker.alfredworkflow b/Supercharged-Citation-Picker.alfredworkflow index 71a6ecf..62b3b07 100644 Binary files a/Supercharged-Citation-Picker.alfredworkflow and b/Supercharged-Citation-Picker.alfredworkflow differ diff --git a/info.plist b/info.plist index bfe008a..668ffc8 100644 --- a/info.plist +++ b/info.plist @@ -3196,7 +3196,7 @@ to set a hotkey for the citaiton picker. bibtex_library_path version - 9.5.4 + 9.5.5 webaddress https://github.com/chrisgrieser/alfred-bibtex-citation-picker diff --git a/scripts/add-to-bib.js b/scripts/add-to-bib.js index 585475f..f58ac81 100755 --- a/scripts/add-to-bib.js +++ b/scripts/add-to-bib.js @@ -2,8 +2,8 @@ function run (argv) { - const doiRegex = /\b10.\d{4,9}\/[-._;()/:A-Z0-9]+\b/i; // https://www.crossref.org/blog/dois-and-matching-regular-expressions/ - const isbnRegex = /^ *[\d-]{9,} *$/; + const doiRegex = /\b10.\d{4,9}\/[-._;()/:A-Z0-9]+(?=$|[?/ ])/i; // https://www.crossref.org/blog/dois-and-matching-regular-expressions/ + const isbnRegex = /^[\d-]{9,}$/; const isEmptyRegex = /^\s*$/; const bibtexEntryTemplate = "@misc{NEW_ENTRY,\n\tauthor = {Doe, Jane},\n\ttitle = {NEW_ENTRY},\n\tpages = {1--1},\n\tyear = 0000\n}\n"; @@ -128,7 +128,7 @@ function run (argv) { } if (isISBN) { - const isbn = input.trim(); + const isbn = input; bibtexEntry = app.doShellScript (`curl -sHL "https://www.ebook.de/de/tools/isbn2bibtex?isbn=${isbn}"`); if (bibtexEntry === "Not found" || !bibtexEntry.includes("@")) return "ERROR";