Automatically capitalize subtitle for APA styles
Applied to all styles with ids matching 'apa($|-)' Currently limited to colons, but Juris-M/citeproc-js#74 may extend this to other punctuation Closes #1681
This commit is contained in:
parent
7496faa8cf
commit
a0be2da42c
2 changed files with 16 additions and 4 deletions
|
@ -584,13 +584,20 @@ Zotero.Cite.getAbbreviation = new function() {
|
|||
|
||||
/**
|
||||
* citeproc-js system object
|
||||
*
|
||||
* @class
|
||||
* @param {Object} options
|
||||
* @param {Boolean} [options.automaticJournalAbbreviations]
|
||||
* @param {Boolean} [options.uppercaseSubtitles]
|
||||
*/
|
||||
Zotero.Cite.System = function(automaticJournalAbbreviations) {
|
||||
if(automaticJournalAbbreviations) {
|
||||
Zotero.Cite.System = function ({ automaticJournalAbbreviations, uppercaseSubtitles }) {
|
||||
if (automaticJournalAbbreviations) {
|
||||
this.getAbbreviation = Zotero.Cite.getAbbreviation;
|
||||
}
|
||||
}
|
||||
if (uppercaseSubtitles) {
|
||||
this.uppercase_subtitles = true; // eslint-disable-line camelcase
|
||||
}
|
||||
};
|
||||
|
||||
Zotero.Cite.System.prototype = {
|
||||
/**
|
||||
|
|
|
@ -648,6 +648,8 @@ Zotero.Style = function (style, path) {
|
|||
Zotero.Styles.ns).replace(/(.+)T([^\+]+)\+?.*/, "$1 $2");
|
||||
this.locale = Zotero.Utilities.xpathText(doc, '/csl:style/@default-locale',
|
||||
Zotero.Styles.ns) || null;
|
||||
var shortID = this.styleID.match(/\/?([^/]+)$/)[1];
|
||||
this._isAPA = /^apa($|-)/.test(shortID);
|
||||
this._class = doc.documentElement.getAttribute("class");
|
||||
this._usesAbbreviation = !!Zotero.Utilities.xpath(doc,
|
||||
'//csl:text[(@variable="container-title" and @form="short") or (@variable="container-title-short")][1]',
|
||||
|
@ -745,7 +747,10 @@ Zotero.Style.prototype.getCiteProc = function(locale, automaticJournalAbbreviati
|
|||
|
||||
try {
|
||||
var citeproc = new Zotero.CiteProc.CSL.Engine(
|
||||
new Zotero.Cite.System(automaticJournalAbbreviations),
|
||||
new Zotero.Cite.System({
|
||||
automaticJournalAbbreviations,
|
||||
uppercaseSubtitles: this._isAPA
|
||||
}),
|
||||
xml,
|
||||
locale,
|
||||
overrideLocale
|
||||
|
|
Loading…
Reference in a new issue