Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jlegewie/zotfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jlegewie committed Oct 8, 2022
2 parents a3dd842 + 1f52229 commit 387371e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
15 changes: 11 additions & 4 deletions chrome/content/zotfile/wildcards.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down Expand Up @@ -213,6 +219,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],
Expand Down
2 changes: 1 addition & 1 deletion defaults/preferences/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 387371e

Please sign in to comment.