Skip to content

Commit

Permalink
Bump version, update CHANGES, bundle as 1.2.18
Browse files Browse the repository at this point in the history
  • Loading branch information
fbennett committed Jul 20, 2019
1 parent 9f09ce2 commit e8f129e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 14 deletions.
11 changes: 11 additions & 0 deletions CHANGES.txt
@@ -1,5 +1,16 @@
Summary of changes to citeproc-js since version 1.2 release.

=========================
Changes in version 1.2.18
=========================

- On URL with form="short", truncate to host only, and include protocol
prefix only if no leading www

- Force alignment of title-short casing with main title

https://forums.zotero.org/discussion/comment/335938/

=========================
Changes in version 1.2.17
=========================
Expand Down
23 changes: 17 additions & 6 deletions citeproc.js
Expand Up @@ -743,18 +743,22 @@ var CSL = {
// If short title exists and matches exactly to a split-point, use that split-point only.
// Otherwise if there is just one split-point, use that as main/sub split.
// Otherwise use all split-points ... which is handled in titleCaseSentenceOrNormal, not here.
if (shortTitle && shortTitle === vals[title.title]) {
if (shortTitle && shortTitle.toLowerCase() === vals[title.title].toLowerCase()) {
vals[title.main] = vals[title.title];
vals[title.subjoin] = "";
vals[title.sub] = "";
} else if (shortTitle) {
// check for valid match to shortTitle
var checkAhead = vals[title.title].slice(shortTitle.replace(/[\?\!]+$/, "").length);
var m = CSL.TITLE_SPLIT_REGEXP.matchfirst.exec(checkAhead);
if (m) {
vals[title.main] = shortTitle;
var tail = vals[title.title].slice(shortTitle.replace(/[\?\!]+$/, "").length);
var top = vals[title.title].replace(tail.replace(/^[\?\!]+/, ""), "").trim();
var m = CSL.TITLE_SPLIT_REGEXP.matchfirst.exec(tail);
if (m && top.toLowerCase() === shortTitle.toLowerCase()) {
vals[title.main] = top;
vals[title.subjoin] = m[1].replace(/[\?\!]+(\s*)$/, "$1");
vals[title.sub] = checkAhead.replace(CSL.TITLE_SPLIT_REGEXP.matchfirst, "");
vals[title.sub] = tail.replace(CSL.TITLE_SPLIT_REGEXP.matchfirst, "");
if (this.opt.development_extensions.force_short_title_casing_alignment) {
vals[title["short"]] = vals[title.main];
}
} else {
var splitTitle = CSL.TITLE_SPLIT(vals[title.title]);
if (splitTitle.length == 3) {
Expand Down Expand Up @@ -6176,6 +6180,7 @@ CSL.Engine.Opt = function () {
this.development_extensions.throw_on_empty = false;
this.development_extensions.strict_inputs = true;
this.development_extensions.prioritize_disambiguate_condition = false;
this.development_extensions.force_short_title_casing_alignment = true;
};

CSL.Engine.Tmp = function () {
Expand Down Expand Up @@ -14983,6 +14988,12 @@ CSL.Node.text = {
if (this.variables[0]) {
value = state.getVariable(Item, this.variables[0], form);
if (value) {
if (this.variables[0] === "URL" && form === "short") {
value = value.replace(/(.*\.[^\/]+)\/.*/, "$1");
if (value.match(/\/\/www\./)) {
value = value.replace(/https?:\/\//, "");
}
}
// true is for non-suppression of periods
if (state.opt.development_extensions.wrap_url_and_doi) {
if (!this.decorations.length || this.decorations[0][0] !== "@" + this.variables[0]) {
Expand Down
23 changes: 17 additions & 6 deletions citeproc_commonjs.js
Expand Up @@ -743,18 +743,22 @@ var CSL = {
// If short title exists and matches exactly to a split-point, use that split-point only.
// Otherwise if there is just one split-point, use that as main/sub split.
// Otherwise use all split-points ... which is handled in titleCaseSentenceOrNormal, not here.
if (shortTitle && shortTitle === vals[title.title]) {
if (shortTitle && shortTitle.toLowerCase() === vals[title.title].toLowerCase()) {
vals[title.main] = vals[title.title];
vals[title.subjoin] = "";
vals[title.sub] = "";
} else if (shortTitle) {
// check for valid match to shortTitle
var checkAhead = vals[title.title].slice(shortTitle.replace(/[\?\!]+$/, "").length);
var m = CSL.TITLE_SPLIT_REGEXP.matchfirst.exec(checkAhead);
if (m) {
vals[title.main] = shortTitle;
var tail = vals[title.title].slice(shortTitle.replace(/[\?\!]+$/, "").length);
var top = vals[title.title].replace(tail.replace(/^[\?\!]+/, ""), "").trim();
var m = CSL.TITLE_SPLIT_REGEXP.matchfirst.exec(tail);
if (m && top.toLowerCase() === shortTitle.toLowerCase()) {
vals[title.main] = top;
vals[title.subjoin] = m[1].replace(/[\?\!]+(\s*)$/, "$1");
vals[title.sub] = checkAhead.replace(CSL.TITLE_SPLIT_REGEXP.matchfirst, "");
vals[title.sub] = tail.replace(CSL.TITLE_SPLIT_REGEXP.matchfirst, "");
if (this.opt.development_extensions.force_short_title_casing_alignment) {
vals[title["short"]] = vals[title.main];
}
} else {
var splitTitle = CSL.TITLE_SPLIT(vals[title.title]);
if (splitTitle.length == 3) {
Expand Down Expand Up @@ -6176,6 +6180,7 @@ CSL.Engine.Opt = function () {
this.development_extensions.throw_on_empty = false;
this.development_extensions.strict_inputs = true;
this.development_extensions.prioritize_disambiguate_condition = false;
this.development_extensions.force_short_title_casing_alignment = true;
};

CSL.Engine.Tmp = function () {
Expand Down Expand Up @@ -14983,6 +14988,12 @@ CSL.Node.text = {
if (this.variables[0]) {
value = state.getVariable(Item, this.variables[0], form);
if (value) {
if (this.variables[0] === "URL" && form === "short") {
value = value.replace(/(.*\.[^\/]+)\/.*/, "$1");
if (value.match(/\/\/www\./)) {
value = value.replace(/https?:\/\//, "");
}
}
// true is for non-suppression of periods
if (state.opt.development_extensions.wrap_url_and_doi) {
if (!this.decorations.length || this.decorations[0][0] !== "@" + this.variables[0]) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "citeproc",
"version": "2.2.17",
"description": "The citeproc-js citation formatting module, in CommonJS format. This version is based on citeproc-js 1.2.17",
"version": "2.2.18",
"description": "The citeproc-js citation formatting module, in CommonJS format. This version is based on citeproc-js 1.2.18",
"main": "citeproc_commonjs.js",
"repository": {
"type": "git",
Expand Down

0 comments on commit e8f129e

Please sign in to comment.