Journal Abbreviations
Went from Endnote to Zotero and is mainly satisfied.
My last (recognized) problem is the Journal Abbreviation field. When importing my Endnote file, they were shipped to blank. I may survive to give manually the journal abbrevition for each journal but not for >10.000 records. How can I apply the journal abbreviation from the journal name?
My last (recognized) problem is the Journal Abbreviation field. When importing my Endnote file, they were shipped to blank. I may survive to give manually the journal abbrevition for each journal but not for >10.000 records. How can I apply the journal abbreviation from the journal name?
Note that Zotero can automatically abbreviate using the MEDLINE abbreviation rules when you cite in Word/LibreOffice.
Now, it could be possible to apply the abbreviation rules to populate the Journal Abbr field using the Run Javascript window. @emilianoeheyns Do you happen to have some code written for generating journal abbreviations?
declare
, but it also uses some other sources not available outside the plugin. The stripped variant would be:const JournalAbbrev = new class {
async init() {
await Zotero.Styles.init(); // otherwise Juris-M throws 'Styles not yet loaded'
this.reset();
}
reset() {
this.abbrevs = {
default: {
'container-title': {},
'collection-title': {},
'institution-entire': {},
'institution-part': {},
nickname: {},
number: {},
title: {},
place: {},
hereinafter: {},
classic: {},
'container-phrase': {},
'title-phrase': {},
},
};
}
get(item) {
let abbrev, journal;
abbrev = item.getField('journalAbbreviation', false, true);
if (abbrev)
return abbrev;
if (!['conferencePaper', 'journalArticle', 'bill', 'case', 'statute'].includes(Zotero.ItemTypes.getName(item.itemTypeID)))
return null;
for (const field of ['publicationTitle', 'reporter', 'code']) {
try {
journal = item.getField(field, false, true);
if (!journal)
continue;
journal = journal.replace(/<\/?(sup|sub|i|b)>/g, '');
if (!journal)
continue;
break;
}
catch (err) {
}
}
if (!journal)
return null;
if (!this.abbrevs.default['container-title'][journal] && typeof Zotero.Cite.getAbbreviation === 'function') {
Zotero.Cite.getAbbreviation(this.style, this.abbrevs, 'default', 'container-title', journal);
}
const abbr = this.abbrevs.default['container-title'][journal];
if (abbr === journal)
return null;
return abbr || journal;
}
};
but that is still just the code to retrieve the abbreviations, it doesn't find items without abrevs, nor saves them with them filled out.