From 1c727526fa1ac0917ca903136efadf1546f63f96 Mon Sep 17 00:00:00 2001 From: qqobb <52924060+qqobb@users.noreply.github.com> Date: Tue, 30 Aug 2022 01:26:00 +0200 Subject: [PATCH 1/4] fix "year" wildcard (#625) --- defaults/preferences/defaults.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/preferences/defaults.js b/defaults/preferences/defaults.js index 4c9dedb9..06282c5c 100644 --- a/defaults/preferences/defaults.js +++ b/defaults/preferences/defaults.js @@ -38,7 +38,7 @@ pref("extensions.zotfile.version",""); pref("extensions.zotfile.zotfile3update",false); pref("extensions.zotfile.info_window_duration_clickable",8000); pref("extensions.zotfile.info_window_duration",6000); -pref("extensions.zotfile.wildcards.default",'{"a": "author", "A": {"field": "author", "operations":[{"function":"exec","regex": "\\\\w{1}"},{"function":"toUpperCase"}]}, "F": "authorLastF", "I": "authorInitials", "d": "editor", "D": {"field": "editor", "operations":[{"function":"exec","regex": "\\\\w{1}"},{"function":"toUpperCase"}]}, "L": "editorLastF", "l": "editorInitials", "t": "titleFormated", "h": "shortTitle", "j": "publicationTitle", "s": "journalAbbreviation", "p": "publisher", "w": {"default": "publisher", "audioRecording": "label", "bill": "legislativeBody", "case": "court", "computerProgram": "company", "film": "distributor", "journalArticle": "publicationTitle", "magazineArticle": "publicationTitle", "newspaperArticle": "publicationTitle", "patent": "issuingAuthority", "presentation": "meetingName", "radioBroadcast": "network", "report": "institution", "thesis": "university", "tvBroadcast": "network"}, "n": "patentNumber", "i": "assignee", "y": {"field": {"default": "date", "patent": "issueDate"}, "operations":[{"function":"exec","regex": "\\\\d{4}"}]}, "v": "volume", "e": "issue", "T": "itemType", "f": "pages", "x": "extra", "c": "collectionPaths", "g": "authorLastG", "q":"lastAuthor", "Q":"lastAuthor_lastInitial", "u":"lastAuthor_lastf", "U":"lastAuthor_initials", "b":"citekey"}'); +pref("extensions.zotfile.wildcards.default",'{"a": "author", "A": {"field": "author", "operations":[{"function":"exec","regex": "\\\\w{1}"},{"function":"toUpperCase"}]}, "F": "authorLastF", "I": "authorInitials", "d": "editor", "D": {"field": "editor", "operations":[{"function":"exec","regex": "\\\\w{1}"},{"function":"toUpperCase"}]}, "L": "editorLastF", "l": "editorInitials", "t": "titleFormated", "h": "shortTitle", "j": "publicationTitle", "s": "journalAbbreviation", "p": "publisher", "w": {"default": "publisher", "audioRecording": "label", "bill": "legislativeBody", "case": "court", "computerProgram": "company", "film": "distributor", "journalArticle": "publicationTitle", "magazineArticle": "publicationTitle", "newspaperArticle": "publicationTitle", "patent": "issuingAuthority", "presentation": "meetingName", "radioBroadcast": "network", "report": "institution", "thesis": "university", "tvBroadcast": "network"}, "n": "patentNumber", "i": "assignee", "y": "year", "v": "volume", "e": "issue", "T": "itemType", "f": "pages", "x": "extra", "c": "collectionPaths", "g": "authorLastG", "q":"lastAuthor", "Q":"lastAuthor_lastInitial", "u":"lastAuthor_lastf", "U":"lastAuthor_initials", "b":"citekey"}'); pref("extensions.zotfile.wildcards.user",'{}'); pref("extensions.zotfile.tablet", false); From a9a7a364e63481e1eac6f7a1f463aa3aac917c0b Mon Sep 17 00:00:00 2001 From: Long Deng <37360259+ldeng-ustc@users.noreply.github.com> Date: Tue, 27 Sep 2022 09:10:53 +0800 Subject: [PATCH 2/4] add field 'itemTypeEN' to use English item type name in rename rule (#562) --- chrome/content/zotfile/wildcards.js | 1 + 1 file changed, 1 insertion(+) diff --git a/chrome/content/zotfile/wildcards.js b/chrome/content/zotfile/wildcards.js index 3ab1aa80..2815a44b 100644 --- a/chrome/content/zotfile/wildcards.js +++ b/chrome/content/zotfile/wildcards.js @@ -213,6 +213,7 @@ Zotero.ZotFile.Wildcards = new function() { var authors = formatAuthors(item); // define additional fields var addFields = { + 'itemTypeEN': Zotero.ItemTypes.getName(item_type), 'itemType': Zotero.ItemTypes.getLocalizedString(item_type), 'titleFormated': truncateTitle(item.getField("title", false, true)), 'author': authors[0], From a6070a003b4caacc4b53a29c091907d2c265f341 Mon Sep 17 00:00:00 2001 From: Nate Long Date: Fri, 7 Oct 2022 11:52:28 -0700 Subject: [PATCH 3/4] Add %b wildcard to docs (#564) Include the %b citation key in the list of accepted wildcards. This wildcard has been available for a while (at least as recently as 2019 https://github.com/jlegewie/zotfile/issues/386) but didn't make it into the docs --- docs/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.md b/docs/index.md index 73b421da..5d3e29a2 100755 --- a/docs/index.md +++ b/docs/index.md @@ -59,6 +59,7 @@ ZotFile renames files based on bibliographic information from the currently sele ##### Wildcards - `%a` last names of authors (not editors etc) or inventors. The maximum number of authors are changed under 'Additional Settings'. +- `%b` citation key - `%I` author initials. - `%F` author's last name with first letter of first name (e.g. EinsteinA). - `%A` first letter of author (useful for subfolders) From 1f5222964539a264dd373d41e95ae19bcd95d269 Mon Sep 17 00:00:00 2001 From: Jeremy Van Cleve <1442334+vancleve@users.noreply.github.com> Date: Fri, 7 Oct 2022 17:17:48 -0400 Subject: [PATCH 4/4] fixed abbreviateField for case when value is empty string (#613) --- chrome/content/zotfile/wildcards.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotfile/wildcards.js b/chrome/content/zotfile/wildcards.js index 2815a44b..b7c1921a 100644 --- a/chrome/content/zotfile/wildcards.js +++ b/chrome/content/zotfile/wildcards.js @@ -11,11 +11,17 @@ Zotero.ZotFile.Wildcards = new function() { /* * Abbreviation field using Zotero's getAbbreviation function */ - function abbreviateField(field) { - abbrv_obj = new Object(); - Zotero.Cite.getAbbreviation("N/A", abbrv_obj, "default", "container-title", field); + function abbreviateField(value) { + if (value != "") { + abbrv_obj = new Object(); + Zotero.Cite.getAbbreviation("N/A", abbrv_obj, "default", "container-title", value); + abbrv = abbrv_obj["default"]["container-title"][value]; + } + else { + abbrv = ""; + } - return abbrv_obj["default"]["container-title"][field] + return abbrv; } /*