Merge branch '4.0'

This commit is contained in:
Dan Stillman 2016-04-12 16:09:10 -04:00
commit ba1f69b4d5
9 changed files with 471 additions and 248 deletions

View File

@ -170,6 +170,10 @@ toolbar:not([id="nav-bar"]) #zotero-toolbar-buttons separator {
@media (min-resolution: 1.5dppx) {
#zotero-pane .toolbarbutton-icon {
width: 16px;
}
#zotero-tb-sync > .toolbarbutton-icon {
width: 20px;
}

View File

@ -1504,7 +1504,11 @@
params.creatorTypeID = creatorTypeID;
}
// Return
t.setAttribute('ontextentered',
'document.getBindingParent(this).handleCreatorAutoCompleteSelect(this, true)');
// Tab/Shift-Tab
t.setAttribute('onchange',
'document.getBindingParent(this).handleCreatorAutoCompleteSelect(this)');
};
t.setAttribute(
@ -1559,6 +1563,7 @@
-->
<method name="handleCreatorAutoCompleteSelect">
<parameter name="textbox"/>
<parameter name="stayFocused"/>
<body><![CDATA[
return Zotero.spawn(function* () {
var comment = false;
@ -1591,9 +1596,10 @@
var [field, creatorIndex, creatorField] =
textbox.getAttribute('fieldname').split('-');
// Stay focused
this._lastTabIndex = parseInt(textbox.getAttribute('ztabindex')) - 1;
this._tabDirection = 1;
if (stayFocused) {
this._lastTabIndex = parseInt(textbox.getAttribute('ztabindex')) - 1;
this._tabDirection = 1;
}
var creator = Zotero.Creators.get(creatorID);

View File

@ -49,57 +49,311 @@
this._iframe = document.getAnonymousElementByAttribute(this, "anonid", "rt-view");
this._rtfMap = {
"\\":"\\\\",
"<em>":"\\i ",
"</em>":"\\i0{}",
"<i>":"\\i ",
"</i>":"\\i0{}",
"<strong>":"\\b ",
"</strong>":"\\b0{}",
"<b>":"\\b ",
"</b>":"\\b0{}",
"<br />":"\x0B",
// there's no way to mimic a tab stop in CSS without
// tables, which wouldn't work here.
'<span class="tab">&nbsp;</span>':"\\tab{}"
};
this._rtfToHtmlMap = [
[/\\uc0\{?\\u([0-9]+)\}?(?:{}| )?/g, function(wholeStr, aCode) { return String.fromCharCode(aCode) }],
[/\\tab(?:\{\}| )/g, '<span class="tab">&nbsp;</span>'],
[/(?:\\par{}|\\\r?\n)/g, "</p><p>"],
[/\\super (.*?)\\nosupersub{}/g, "<sup>$1</sup>"],
[/\\sub (.*?)\\nosupersub{}/g, "<sub>$1</sub>"],
// for backwards compatibility with Zotero < 2.1
["\\i0 ", "</em>"],
["\\b0 ", "</strong>"]
];
this._htmlToRtfMap = [
[/"(\w)/, "“$1"],
[/([\w,.?!])"/, "$1”"],
["<p>", ""],
this._htmlRTFmap = [
// Atomic units, HTML -> RTF (cleanup)
[/<br \/>/g, "\x0B"],
[/"(\w)/g, "“$1"],
[/([\w,.?!])"/g, "$1”"],
[/<p>/g, ""],
//[/<\/p>(?!\s*$)/g, "\\par{}"],
[/<\/?div[^>]*>/g, ""],
["<sup>", "\\super "],
["</sup>", "\\nosupersub{}"],
["<sub>", "\\sub "],
["</sub>", "\\nosupersub{}"]
[/[\x7F-\uFFFF]/g, function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+"{}"}]
];
this._rtfRexMap = [
["<span style=\"font-variant:small-caps;\">",
/small-caps/,
"\\scaps ",
"\\scaps0{}"
],
["<span style=\"text-decoration:underline;\">",
/underline/,
"\\ul ",
"\\ul0{}"
]
]
this._rtfHTMLmap = [
// Atomic units, RTF -> HTML (cleanup)
[/\\uc0\{?\\u([0-9]+)\}?(?:{}| )?/g, function(wholeStr, aCode) { return String.fromCharCode(aCode) }],
[/\\tab(?:\{\}| )/g, '<span class="tab">&nbsp;</span>'],
[/(?:\\par{}|\\\r?\n)/g, "</p><p>"]
];
this.init = function() {
if (this.initialized) return;
// Tag data
var _rexData = [
[
[
["<span style=\"font-variant:small-caps;\">"],
["{\\scaps ", "{\\scaps{}"]
],
[
["<\/span>"],
["}"]
]
],
[
[
["<span style=\"text-decoration:underline;\">"],
["{\\ul{}", "{\\ul "]
],
[
["<\/span>"],
["}"]
]
],
[
[
["<sup>"],
["\\super ", "\\super{}"]
],
[
["</sup>"],
["\\nosupersub{}", "\\nosupersub "]
]
],
[
[
["<sub>"],
["\\sub ", "\\sub{}"]
],
[
["</sub>"],
["\\nosupersub{}", "\\nosupersub "]
]
],
[
[
["<em>"],
["{\\i{}", "{\\i "]
],
[
["</em>"],
["}"]
]
],
[
[
["<i>"],
["{\\i{}", "{\\i "]
],
[
["</i>"],
["}"]
]
],
[
[
["<b>"],
["{\\b{}", "{\\b "]
],
[
["</b>"],
["}"]
]
],
[
[
["<strong>"],
["{\\b{}", "{\\b "]
],
[
["</strong>"],
["}"]
]
],
[
[
["<span style=\"font-variant:normal;\">"],
["{\\scaps0{}", "{\\scaps0 "]
],
[
["</span>"],
["}"]
]
],
[
[
["<span style=\"font-style:normal;\">"],
["{\\i0{}", "{\\i0 "]
],
[
["</span>"],
["}"]
]
],
[
[
["<span style=\"font-weight:normal;\">"],
["{\\b0{}", "{\\b0 "]
],
[
["</span>"],
["}"]
]
]
];
function longestFirst(a, b) {
if (a.length < b.length) {
return 1;
} else if (a.length > b.length) {
return -1;
} else {
return 0;
}
}
function composeRex(rexes, noGlobal) {
var lst = [];
for (var rex in rexes) {
lst.push(rex);
}
lst.sort(longestFirst);
var rexStr = "(?:" + lst.join("|") + ")";
return new RegExp(rexStr, "g");
}
// Create splitting regexps
function splitRexMaker(segment) {
var rexes = {};
for (var i=0,ilen=_rexData.length; i < ilen; i++) {
for (var j=0,jlen=_rexData[i].length; j < jlen; j++) {
for (var k=0,klen=_rexData[i][j][segment].length; k < klen; k++) {
rexes[_rexData[i][j][segment][k].replace("\\", "\\\\")] = true;
}
}
}
var ret = composeRex(rexes, true);
return ret;
}
this.rtfHTMLsplitRex = splitRexMaker(1);
this.htmlRTFsplitRex = splitRexMaker(0);
// Create open-tag sniffing regexp
function openSniffRexMaker(segment) {
var rexes = {};
for (var i=0,ilen=_rexData.length; i < ilen; i++) {
for (var j=0,jlen=_rexData[i][0][segment].length; j < jlen; j++) {
rexes[_rexData[i][0][segment][j].replace("\\", "\\\\")] = true;
}
}
return composeRex(rexes);
}
this.rtfHTMLopenSniffRex = openSniffRexMaker(1);
this.htmlRTFopenSniffRex = openSniffRexMaker(0);
// Create open-tag remapper
function openTagRemapMaker(segment) {
var ret = {};
for (var i=0,ilen=_rexData.length; i < ilen; i++) {
var master = _rexData[i][0][segment][0];
for (var j=0,jlen=_rexData[i][0][segment].length; j < jlen; j++) {
ret[_rexData[i][0][segment][j]] = master;
}
}
return ret;
}
this.rtfHTMLopenTagRemap = openTagRemapMaker(1);
this.htmlRTFopenTagRemap = openTagRemapMaker(0);
// Create open-tag-keyed close-tag sniffing regexps
function closeTagRexMaker(segment) {
var ret = {};
var rexes = {};
for (var i=0,ilen=_rexData.length; i < ilen; i++) {
var master = _rexData[i][0][segment][0];
for (var j=0,jlen=_rexData[i][1][segment].length; j < jlen; j++) {
rexes[_rexData[i][1][segment][j]] = true;
}
ret[master] = composeRex(rexes);
}
return ret;
}
this.rtfHTMLcloseTagRex = closeTagRexMaker(1);
this.htmlRTFcloseTagRex = closeTagRexMaker(0);
// Create open-tag-keyed open/close tag registry
function tagRegistryMaker(segment) {
var antisegment = 1;
if (segment == 1) {
antisegment = 0;
}
var ret = {};
for (var i=0,ilen=_rexData.length; i < ilen; i++) {
var master = _rexData[i][0][segment][0];
ret[master] = {
open: _rexData[i][0][antisegment][0],
close: _rexData[i][1][antisegment][0]
}
}
return ret;
}
this.rtfHTMLtagRegistry = tagRegistryMaker(1);
this.htmlRTFtagRegistry = tagRegistryMaker(0);
this.initialized = true;
}
this.init();
this.getSplit = function(mode, txt) {
if (!txt) return [];
var splt = txt.split(this[mode + "splitRex"]);
var mtch = txt.match(this[mode + "splitRex"]);
var lst = [splt[0]];
for (var i=1,ilen=splt.length; i < ilen; i++) {
lst.push(mtch[i-1]);
lst.push(splt[i]);
}
return lst;
}
this.getOpenTag = function(mode, str) {
var m = str.match(this[mode + "openSniffRex"]);
if (m) {
m = this[mode + "openTagRemap"][m[0]];
}
return m;
}
this.convert = function(mode, txt) {
var lst = this.getSplit(mode, txt);
var sdepth = 0;
var depth = 0;
for (var i=1,ilen=lst.length; i < ilen; i += 2) {
var openTag = this.getOpenTag(mode, lst[i]);
if (openTag) {
sdepth++;
depth = sdepth;
for (var j=(i+2),jlen=lst.length; j < jlen; j += 2) {
var closeTag = !this.getOpenTag(mode, lst[j]);
if (closeTag) {
if (depth === sdepth && lst[j].match(this[mode + "closeTagRex"][openTag])) {
lst[i] = this[mode + "tagRegistry"][openTag].open;
lst[j] = this[mode + "tagRegistry"][openTag].close;
break;
}
depth--;
} else {
depth++;
}
}
} else {
sdepth--;
}
}
return lst.join("");
}
this.htmlToRTF = function(txt) {
// Catch this one before &nbsp; is clobbered by unescape
txt = txt.replace(/<span class=\"tab\">&nbsp;<\/span>/g, "\\tab{}");
txt = Zotero.Utilities.unescapeHTML(txt);
for (var i=0,ilen=this._htmlRTFmap.length; i < ilen; i++) {
var entry = this._htmlRTFmap[i];
txt = txt.replace(entry[0], entry[1]);
}
txt = this.convert("htmlRTF", txt);
return txt.trim();
}
this.rtfToHTML = function(txt) {
for (var i=0,ilen=this._rtfHTMLmap.length; i < ilen; i++) {
var entry = this._rtfHTMLmap[i];
txt = txt.replace(entry[0], entry[1]);
}
txt = this.convert("rtfHTML", txt);
return txt.trim();
}
this._constructed = true;
@ -213,52 +467,14 @@
<!-- Sets or returns contents of rich text box -->
<property name="value">
<getter><![CDATA[
const highcharRe = /[\x7F-\uFFFF]/g;
var output = this._editor.getContent();
var output = this._editor.getContent().trim();
if(this._format == "RTF") {
// strip divs
if(output.substr(0, 5) == "<div>" && output.substr(-6) == "</div>") {
output = output.substr(5, output.length-6);
output = output.slice(0, output.length-6).slice(5).trim();
}
// do appropriate replacement operations
for(var needle in this._rtfMap) {
output = output.replace(needle, this._rtfMap[needle], "g");
}
// Preserve small caps and underlining
for each (var tagspec in this._rtfRexMap){
var l = output.split(/(<\/?span[^>]*>)/);
var current_level = 0;
var tag_level = [];
for (var pos=1; pos<l.length; pos+=2) {
var tag = l[pos];
if (tag[1] == "/") {
current_level--;
if (current_level == tag_level[tag_level.length-1]) {
tag_level.pop();
l[pos] = tagspec[3];
}
} else {
if (l[pos].match(tagspec[1])) {
l[pos] = tagspec[2];
tag_level.push(current_level);
}
current_level++;
};
};
output = l.join("");
}
for each(var entry in this._htmlToRtfMap) {
output = output.replace(entry[0], entry[1], "g");
}
output = Zotero.Utilities.unescapeHTML(output.replace(" ", "&nbsp;", "g"))
.replace("\u00A0", " ", "g")
.replace(highcharRe, function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+"{}" });
output = Zotero.Utilities.trim(output);
output = this.htmlToRTF(output)
}
return output;
@ -313,19 +529,8 @@
bodyStyle = "margin-left:"+(li/20+6)+"pt;text-indent:"+(fi/20)+"pt;";
}
// do appropriate replacement operations
for(var needle in this._rtfMap) {
if(this._rtfMap[needle]) {
html = html.replace(this._rtfMap[needle], needle, "g");
}
}
for each (var tagspec in this._rtfRexMap){
html = html.replace(tagspec[2], tagspec[0], "g");
html = html.replace(tagspec[3], "</span>", "g");
}
for each(var entry in this._rtfToHtmlMap) {
html = html.replace(entry[0], entry[1], "g");
}
html = this.rtfToHTML(html);
html = '<div style="'+bodyStyle+'"><p>'+html+"</p></div>";
}

View File

@ -253,8 +253,8 @@ var Zotero_Bibliography_Dialog = new function () {
* Gets selected item IDs from list box on right
*/
function _getSelectedListItemIDs() {
return [bibEditInterface.bibliography[0].entry_ids[item.value][0]
for each(item in _itemList.selectedItems)];
return Array.from(_itemList.selectedItems)
.map(item => bibEditInterface.bibliography[0].entry_ids[item.value][0]);
}
/**
@ -305,7 +305,7 @@ var Zotero_Bibliography_Dialog = new function () {
*/
function _loadItems() {
var itemIDs = bibEditInterface.bibliography[0].entry_ids;
var items = [Zotero.Cite.getItem(itemID[0]) for each(itemID in itemIDs)];
var items = itemIDs.map(itemID => Zotero.Cite.getItem(itemID[0]));
// delete all existing items from list
var itemList = document.getElementById("item-list");

@ -1 +1 @@
Subproject commit 07284a9617dfd2d28a46987cbcadbae0b2d84db7
Subproject commit c34bdab69f5d9f552bf787e9bb1f4a8b0de0769d

View File

@ -34,7 +34,7 @@ if (!Array.indexOf) {
};
}
var CSL = {
PROCESSOR_VERSION: "1.1.81",
PROCESSOR_VERSION: "1.1.91",
CONDITION_LEVEL_TOP: 1,
CONDITION_LEVEL_BOTTOM: 2,
PLAIN_HYPHEN_REGEX: /(?:[^\\]-|\u2013)/,
@ -456,7 +456,7 @@ var CSL = {
],
LANGS: {
"af-ZA":"Afrikaans",
"ar-AR":"Arabic",
"ar":"Arabic",
"bg-BG":"Bulgarian",
"ca-AD":"Catalan",
"cs-CZ":"Czech",
@ -506,7 +506,7 @@ var CSL = {
},
LANG_BASES: {
af: "af_ZA",
ar: "ar_AR",
ar: "ar",
bg: "bg_BG",
ca: "ca_AD",
cs: "cs_CZ",
@ -655,14 +655,31 @@ var CSL = {
"\u06E6": "\u064A"
},
SUPERSCRIPTS_REGEXP: new RegExp("[\u00AA\u00B2\u00B3\u00B9\u00BA\u02B0\u02B1\u02B2\u02B3\u02B4\u02B5\u02B6\u02B7\u02B8\u02E0\u02E1\u02E2\u02E3\u02E4\u1D2C\u1D2D\u1D2E\u1D30\u1D31\u1D32\u1D33\u1D34\u1D35\u1D36\u1D37\u1D38\u1D39\u1D3A\u1D3C\u1D3D\u1D3E\u1D3F\u1D40\u1D41\u1D42\u1D43\u1D44\u1D45\u1D46\u1D47\u1D48\u1D49\u1D4A\u1D4B\u1D4C\u1D4D\u1D4F\u1D50\u1D51\u1D52\u1D53\u1D54\u1D55\u1D56\u1D57\u1D58\u1D59\u1D5A\u1D5B\u1D5C\u1D5D\u1D5E\u1D5F\u1D60\u1D61\u2070\u2071\u2074\u2075\u2076\u2077\u2078\u2079\u207A\u207B\u207C\u207D\u207E\u207F\u2120\u2122\u3192\u3193\u3194\u3195\u3196\u3197\u3198\u3199\u319A\u319B\u319C\u319D\u319E\u319F\u02C0\u02C1\u06E5\u06E6]", "g"),
UPDATE_GROUP_CONTEXT_CONDITION: function (state, termtxt) {
UPDATE_GROUP_CONTEXT_CONDITION: function (state, termtxt, valueTerm) {
if (state.tmp.group_context.tip.condition) {
if (state.tmp.group_context.tip.condition.test) {
var testres;
if (state.tmp.group_context.tip.condition.test === "label-empty-or-alpha") {
testres = !termtxt || termtxt.slice(0,1).match(CSL.ALL_ROMANESQUE_REGEXP);
} else if (state.tmp.group_context.tip.condition.test === "label-empty") {
if (state.tmp.group_context.tip.condition.test === "empty-label") {
testres = !termtxt;
} else if (state.tmp.group_context.tip.condition.test === "comma-safe") {
var empty = !termtxt;
var alpha = termtxt.slice(0,1).match(CSL.ALL_ROMANESQUE_REGEXP);
var num = state.tmp.just_did_number;
if (empty) {
testres = true;
} else if (num) {
if (alpha && !valueTerm) {
testres = true;
} else {
testres = false;
}
} else {
if (alpha && !valueTerm) {
testres = true;
} else {
testres = false;
}
}
}
if (testres) {
state.tmp.group_context.tip.force_suppress = false;
@ -673,6 +690,12 @@ var CSL = {
state.tmp.group_context.tip.force_suppress = !state.tmp.group_context.tip.force_suppress;
}
}
} else {
if (termtxt.slice(-1).match(/[0-9]/)) {
state.tmp.just_did_number = true;
} else {
state.tmp.just_did_number = false;
}
}
},
locale: {},
@ -1729,7 +1752,7 @@ CSL.getMinVal = function () {
};
CSL.tokenExec = function (token, Item, item) {
var next, maybenext, exec, debug;
debug = true;
debug = false;
next = token.next;
maybenext = false;
var record = function (result) {
@ -1756,7 +1779,6 @@ CSL.tokenExec = function (token, Item, item) {
CSL.expandMacro = function (macro_key_token, target) {
var mkey, start_token, key, end_token, navi, macro_nodes, newoutput, mergeoutput, end_of_macro, func;
mkey = macro_key_token.postponed_macro;
var alt_macro = macro_key_token.alt_macro;
macro_key_token = new CSL.Token("group", CSL.START);
var hasDate = false;
var macroid = false;
@ -1782,10 +1804,9 @@ CSL.expandMacro = function (macro_key_token, target) {
macro_key_token.cslid = macroid;
if (CSL.MODULE_MACROS[mkey]) {
macro_key_token.juris = mkey;
macro_key_token.alt_macro = alt_macro;
this.opt.update_mode = CSL.POSITION;
}
CSL.Node.group.build.call(macro_key_token, this, target);
CSL.Node.group.build.call(macro_key_token, this, target, true);
if (!this.cslXml.getNodeValue(macro_nodes)) {
throw "CSL style error: undefined macro \"" + mkey + "\"";
}
@ -1795,15 +1816,14 @@ CSL.expandMacro = function (macro_key_token, target) {
CSL.configureMacro.call(this, mytarget);
}
if (!this.build.extension) {
var func = function(macro_name, alt_macro) {
var func = function(macro_name) {
return function (state, Item, item) {
var next = 0;
while (next < state.macros[macro_name].length) {
next = CSL.tokenExec.call(state, state.macros[macro_name][next], Item, item);
}
CSL.runAltMacro(state, alt_macro, Item, item);
}
}(mkey, alt_macro);
}(mkey);
var text_node = new CSL.Token("text", CSL.SINGLETON);
text_node.execs.push(func);
target.push(text_node);
@ -1819,11 +1839,8 @@ CSL.expandMacro = function (macro_key_token, target) {
}
if (macro_key_token.juris) {
end_of_macro.juris = mkey;
if (alt_macro) {
end_of_macro.alt_macro = alt_macro;
}
}
CSL.Node.group.build.call(end_of_macro, this, target);
}
CSL.Node.group.build.call(end_of_macro, this, target, true);
this.build.macro_stack.pop();
};
CSL.getMacroTarget = function (mkey) {
@ -1836,22 +1853,6 @@ CSL.getMacroTarget = function (mkey) {
}
return mytarget;
}
CSL.runAltMacro = function (state, alt_macro, Item, item) {
var flags = state.tmp.group_context.tip;
if (((flags.variable_attempt && !flags.variable_success) || (!flags.term_intended && !flags.variable_attempt)) && alt_macro) {
flags.variable_attempt = false;
var mytarget = CSL.getMacroTarget.call(state, alt_macro);
if (mytarget) {
var macro_nodes = state.cslXml.getNodesByName(state.cslXml.dataObj, 'macro', alt_macro);
CSL.buildMacro.call(state, mytarget, macro_nodes);
CSL.configureMacro.call(state, mytarget);
}
var next = 0;
while (next < state.macros[alt_macro].length) {
next = CSL.tokenExec.call(state, state.macros[alt_macro][next], Item, item);
}
}
}
CSL.buildMacro = function (mytarget, macro_nodes) {
var builder = CSL.makeBuilder(this, mytarget);
var mynode;
@ -1916,7 +1917,7 @@ CSL.XmlToToken = function (state, tokentype, explicitTarget) {
} else {
target = state[state.build.area].tokens;
}
CSL.Node[name].build.call(token, state, target);
CSL.Node[name].build.call(token, state, target, true);
};
CSL.DateParser = new function () {
var epochPairs = [
@ -5736,7 +5737,7 @@ CSL.getBibliographyEntries = function (bibsection) {
this.output.adjust.downward(this.output.queue[j],true);
this.output.adjust.fix(this.output.queue[j]);
}
res = this.output.string(this, this.output.queue);
res = this.output.string(this, this.output.queue)[0];
if (!res) {
res = "\n[CSL STYLE ERROR: reference with no printed form.]\n";
}
@ -6677,8 +6678,9 @@ CSL.Node["et-al"] = {
}
};
CSL.Node.group = {
build: function (state, target) {
build: function (state, target, realGroup) {
var func, execs;
this.realGroup = realGroup;
if (this.tokentype === CSL.START) {
CSL.Util.substituteStart.call(this, state, target);
if (state.build.substitute_level.value()) {
@ -6689,43 +6691,51 @@ CSL.Node.group = {
}
func = function (state, Item) {
state.output.startTag("group", this);
if (state.tmp.group_context.mystack.length) {
state.output.current.value().parent = state.tmp.group_context.tip.output_tip;
}
var label_form = state.tmp.group_context.tip.label_form;
if (!label_form && this.strings.label_form_override) {
label_form = this.strings.label_form_override;
}
var condition = false;
var force_suppress = false;
if (state.tmp.group_context.tip.condition) {
condition = state.tmp.group_context.tip.condition;
force_suppress = false;
} else if (this.strings.reject) {
condition = {
test: this.strings.reject,
not: true
if (this.strings.label_form_override) {
if (!state.tmp.group_context.tip.label_form) {
state.tmp.group_context.tip.label_form = this.strings.label_form_override;
}
force_suppress = true;
done_vars = [];
} else if (this.strings.require) {
condition = {
test: this.strings.require,
not: false
}
done_vars = [];
}
state.tmp.group_context.push({
term_intended: false,
variable_attempt: false,
variable_success: false,
output_tip: state.output.current.tip,
label_form: label_form,
parallel_conditions: this.strings.set_parallel_condition,
condition: condition,
force_suppress: force_suppress,
done_vars: state.tmp.group_context.tip.done_vars.slice()
});
if (this.realGroup) {
var condition = false;
var force_suppress = false;
if (state.tmp.group_context.mystack.length) {
state.output.current.value().parent = state.tmp.group_context.tip.output_tip;
}
var label_form = state.tmp.group_context.tip.label_form;
if (!label_form) {
label_form = this.strings.label_form_override;
}
if (state.tmp.group_context.tip.condition) {
condition = state.tmp.group_context.tip.condition;
force_suppress = state.tmp.group_context.tip.force_suppress;
} else if (this.strings.reject) {
condition = {
test: this.strings.reject,
not: true
}
force_suppress = true;
done_vars = [];
} else if (this.strings.require) {
condition = {
test: this.strings.require,
not: false
}
done_vars = [];
}
state.tmp.group_context.push({
term_intended: false,
variable_attempt: false,
variable_success: false,
variable_success_parent: state.tmp.group_context.tip.variable_success,
output_tip: state.output.current.tip,
label_form: label_form,
parallel_conditions: this.strings.set_parallel_condition,
condition: condition,
force_suppress: force_suppress,
done_vars: state.tmp.group_context.tip.done_vars.slice()
});
}
};
execs = [];
execs.push(func);
@ -6815,11 +6825,9 @@ CSL.Node.group = {
while (next < state.juris[Item["best-jurisdiction"]][this.juris].length) {
next = CSL.tokenExec.call(state, state.juris[Item["best-jurisdiction"]][this.juris][next], Item, item);
}
CSL.runAltMacro(state, this.alt_macro, Item, item);
}
}
text_node.juris = this.juris;
text_node.alt_macro = this.alt_macro;
text_node.execs.push(func);
target.push(text_node);
var if_end = new CSL.Token("if", CSL.END);
@ -6842,39 +6850,41 @@ CSL.Node.group = {
}
}
func = function (state, Item) {
var flags = state.tmp.group_context.pop();
state.output.endTag();
if (flags.variable_attempt) {
state.tmp.group_context.tip.variable_attempt = true;
}
if (state.tmp.group_context.tip.condition) {
state.tmp.group_context.tip.force_suppress = flags.force_suppress;
}
if (!flags.force_suppress && (flags.variable_success || (flags.term_intended && !flags.variable_attempt))) {
if (!this.isJurisLocatorLabel) {
state.tmp.group_context.tip.variable_success = true;
if (this.realGroup) {
var flags = state.tmp.group_context.pop();
if (state.tmp.group_context.tip.condition) {
state.tmp.group_context.tip.force_suppress = flags.force_suppress;
}
var blobs = state.output.current.value().blobs;
var pos = state.output.current.value().blobs.length - 1;
if (!state.tmp.just_looking && "undefined" !== typeof flags.parallel_conditions) {
var parallel_condition_object = {
blobs: blobs,
conditions: flags.parallel_conditions,
id: Item.id,
pos: pos
};
state.parallel.parallel_conditional_blobs_list.push(parallel_condition_object);
}
} else {
if (flags.force_suppress) {
for (var i=0,ilen=flags.done_vars.length;i<ilen;i++) {
if (state.tmp.done_vars.indexOf(flags.done_vars[i]) > -1) {
state.tmp.done_vars = state.tmp.done_vars.slice(0, i).concat(state.tmp.done_vars.slice(i+1));
if (!flags.force_suppress && (flags.variable_success || (flags.term_intended && !flags.variable_attempt))) {
if (!this.isJurisLocatorLabel) {
state.tmp.group_context.tip.variable_success = true;
}
var blobs = state.output.current.value().blobs;
var pos = state.output.current.value().blobs.length - 1;
if (!state.tmp.just_looking && "undefined" !== typeof flags.parallel_conditions) {
var parallel_condition_object = {
blobs: blobs,
conditions: flags.parallel_conditions,
id: Item.id,
pos: pos
};
state.parallel.parallel_conditional_blobs_list.push(parallel_condition_object);
}
} else {
state.tmp.group_context.tip.variable_attempt = flags.variable_attempt;
if (flags.force_suppress && !state.tmp.group_context.tip.condition) {
state.tmp.group_context.tip.variable_attempt = true;
state.tmp.group_context.tip.variable_success = flags.variable_success_parent;
for (var i=0,ilen=flags.done_vars.length;i<ilen;i++) {
if (state.tmp.done_vars.indexOf(flags.done_vars[i]) > -1) {
state.tmp.done_vars = state.tmp.done_vars.slice(0, i).concat(state.tmp.done_vars.slice(i+1));
}
}
}
}
if (state.output.current.value().blobs) {
state.output.current.value().blobs.pop();
if (state.output.current.value().blobs) {
state.output.current.value().blobs.pop();
}
}
}
};
@ -7306,13 +7316,11 @@ CSL.Node.layout = {
} else {
suffix = state.bibliography.opt.layout_suffix;
}
var chr = suffix.slice(0, 1);
var topblobs = state.output.current.value().blobs;
if (topblobs.length) {
if (chr && topblobs[topblobs.length-1].strings.suffix.slice(-1) === chr) {
topblobs[topblobs.length-1].strings.suffix = topblobs[topblobs.length-1].strings.suffix.slice(0, -1);
}
topblobs[topblobs.length-1].strings.suffix += suffix;
var topblob = state.output.current.value();
if (state.opt.using_display) {
topblob.blobs[topblob.blobs.length-1].strings.suffix = suffix;
} else {
topblob.strings.suffix = suffix;
}
if (state.bibliography.opt["second-field-align"]) {
state.output.endTag("bib_other");
@ -7365,7 +7373,7 @@ CSL.Node.layout = {
};
this.execs.push(func);
func = function (state, Item) {
var tok = "empty";
var tok = new CSL.Token();
if (state.opt.development_extensions.rtl_support) {
if (["ar", "he", "fa", "ur", "yi", "ps", "syr"].indexOf(Item.language) > -1) {
tok = new CSL.Token();
@ -7501,7 +7509,7 @@ CSL.Node.layout = {
target.push(suffix_token);
}
func = function (state, Item) {
state.output.closeLevel("empty");
state.output.closeLevel();
};
this.execs.push(func);
func = function (state, Item) {
@ -8500,6 +8508,11 @@ CSL.NameOutput.prototype.renderAllNames = function () {
var pos;
for (var i = 0, ilen = this.variables.length; i < ilen; i += 1) {
var v = this.variables[i];
if (this.freeters[v].length || this.institutions[v].length) {
if (!this.state.tmp.group_context.tip.condition) {
this.state.tmp.just_did_number = false;
}
}
pos = this.nameset_base + i;
if (this.freeters[v].length) {
this.freeters[v] = this._renderNames(v, this.freeters[v], pos);
@ -9788,6 +9801,9 @@ CSL.Node.number = {
if (varname === "locator") {
state.processNumber(node, item, varname, Item.type);
} else {
if (!state.tmp.group_context.tip.condition && Item[varname]) {
state.tmp.just_did_number = true;
}
state.processNumber(node, Item, varname, Item.type);
}
CSL.Util.outputNumericField(state, varname, Item.id);
@ -10033,6 +10049,9 @@ CSL.Node.text = {
}
state.parallel.StartVariable(parallel_variable);
state.parallel.AppendToVariable(Item[parallel_variable],parallel_variable);
if (!state.tmp.group_context.tip.condition && Item[this.variables[0]]) {
state.tmp.just_did_number = false;
}
};
this.execs.push(func);
if (CSL.MULTI_FIELDS.indexOf(this.variables_real[0]) > -1
@ -10107,7 +10126,6 @@ CSL.Node.text = {
var value = state.transform.abbrevs["default"]["hereinafter"][Item.id];
if (value) {
state.output.append(value, this);
print(" -- node_text.js --> true");
state.tmp.group_context.tip.variable_success = true;
}
}
@ -10133,7 +10151,7 @@ CSL.Node.text = {
} else if (this.strings.value) {
func = function (state, Item) {
state.tmp.group_context.tip.term_intended = true;
CSL.UPDATE_GROUP_CONTEXT_CONDITION(state, this.strings.value);
CSL.UPDATE_GROUP_CONTEXT_CONDITION(state, this.strings.value, true);
state.output.append(this.strings.value, this);
};
this.execs.push(func);
@ -10849,9 +10867,6 @@ CSL.Attributes["@value"] = function (state, arg) {
CSL.Attributes["@name"] = function (state, arg) {
this.strings.name = arg;
};
CSL.Attributes["@alternative-macro"] = function (state, arg) {
this.alt_macro = arg;
};
CSL.Attributes["@form"] = function (state, arg) {
this.strings.form = arg;
};
@ -11172,6 +11187,7 @@ CSL.Attributes["@reverse-order"] = function (state, arg) {
}
};
CSL.Attributes["@display"] = function (state, arg) {
state.opt.using_display = true;
this.strings.cls = arg;
};
CSL.Stack = function (val, literal) {
@ -13923,16 +13939,12 @@ CSL.Util.FlipFlopper.prototype._normalizeString = function (str) {
}
}
if (str.indexOf(this.quotechars[1]) > -1) {
var oldStr = null;
while (str !== oldStr) {
oldStr = str;
for (i = 0, ilen = 2; i < ilen; i += 1) {
if (this.quotechars[i + 4]) {
if (i === 0) {
str = str.split(this.quotechars[i + 4]).join(" " + this.quotechars[1]);
} else {
str = str.split(this.quotechars[i + 4]).join(this.quotechars[1]);
}
for (i = 0, ilen = 2; i < ilen; i += 1) {
if (this.quotechars[i + 4]) {
if (i === 0 && this.quotechars[i + 4] !== this.quotechars[1]) {
str = str.split(this.quotechars[i + 4]).join(" " + this.quotechars[1]);
} else {
str = str.split(this.quotechars[i + 4]).join(this.quotechars[1]);
}
}
}

View File

@ -16,7 +16,7 @@
"american-journal-of-surgery": "the-american-journal-of-surgery",
"american-journal-of-tropical-medicine-and-hygiene": "the-american-journal-of-tropical-medicine-and-hygiene",
"american-medical-writers-association": "american-medical-writers-association-journal",
"american-surgeon": " the-american-surgeon",
"american-surgeon": "the-american-surgeon",
"amiens": "universite-de-picardie-jules-verne-ufr-de-medecine",
"analytical-abstracts": "royal-society-of-chemistry",
"annalen-des-naturhistorischen-museums-wien": "annalen-des-naturhistorischen-museums-in-wien",
@ -39,7 +39,6 @@
"bmc-pharmacology": "biomed-central",
"bmj-supportive-palliative-care": "bmj-supportive-and-palliative-care",
"brain-and-development-english-language": "brain-and-development",
"british-journal-of-medical-economics": "journal-of-medical-economics",
"british-volume-of-the-journal-of-bone-and-joint-surgery": "the-journal-of-bone-and-joint-surgery",
"bulletin-of-materials-science": "springer-humanities-author-date",
"bulletin-of-the-medical-library-association": "journal-of-the-medical-library-association",
@ -69,7 +68,7 @@
"current-opinion-cell-biology": "current-opinion-in-cell-biology",
"current-opinion-chemical-biology": "current-opinion-in-chemical-biology",
"current-opinion-environmental-sustainability": "current-opinion-in-environmental-sustainability",
"current-opinion-genetics-development": "current-opinion-in-genetics-development",
"current-opinion-genetics-development": "current-opinion-in-genetics-and-development",
"current-opinion-immunology": "current-opinion-in-immunology",
"current-opinion-microbiology": "current-opinion-in-microbiology",
"current-opinion-neurobiology": "current-opinion-in-neurobiology",
@ -88,7 +87,7 @@
"european-journal-of-population-revue-europeenne-de-demographie": "european-journal-of-population",
"f1000-research": "f1000research",
"febs-journal": "the-febs-journal",
"fems": "federation-of-european-microbiological-societies",
"fems": "oxford-university-press-scimed-author-date",
"federation-of-european-microbiological-societies": "oxford-university-press-scimed-author-date",
"firstmonday": "first-monday",
"frontiers-in-addictive-disorders": "frontiers",
@ -205,7 +204,6 @@
"frontiers-in-nk-cell-biology": "frontiers",
"frontiers-in-non-coding-rna": "frontiers",
"frontiers-in-nutrigenomics": "frontiers",
"frontiers-in-oncology": "frontiers",
"frontiers-in-oxidant-physiology": "frontiers",
"frontiers-in-pediatric-endocrinology": "frontiers",
"frontiers-in-pediatric-oncology": "frontiers",
@ -281,7 +279,6 @@
"harvard-university-west-london": "harvard-university-of-west-london",
"harvard1-unisa-gbfe": "harvard-gesellschaft-fur-bildung-und-forschung-in-europa",
"harvard3": "harvard-swinburne-university-of-technology",
"hbp": "hpb",
"head-and-neck-oncology": "biomed-central",
"healthcare-the-journal-of-delivery-science-and-innovation": "healthcare",
"heart-and-lung-the-journal-of-critical-care": "heart-and-lung-the-journal-of-acute-and-critical-care",
@ -381,7 +378,7 @@
"mhra-author-date": "modern-humanities-research-association-author-date",
"mhra_note_without_bibliography": "modern-humanities-research-association",
"mla": "modern-language-association",
"mla-notes": "modern-language-association-note",
"mla-notes": "modern-language-association-6th-edition-note",
"mla-underline": "modern-language-association-underline",
"mla-url": "modern-language-association-with-url",
"modern-language-association-note": "modern-language-association-6th-edition-note",
@ -441,8 +438,8 @@
"springer-protocols": "springerprotocols",
"sustainable-healthcare": "biomed-central",
"synergy-research": "synergy",
"tah-gkw": "geistes-und-kulturwissenschaften-teilmann",
"tah-soz": "sozialwissenschaften-teilmann",
"tah-gkw": "geistes-und-kulturwissenschaften-heilmann",
"tah-soz": "sozialwissenschaften-heilmann",
"taylor-and-francis-reference-style-f": "taylor-and-francis-chicago-f",
"technology-operation-management": "springer-humanities-author-date",
"the-academy-of-management-review": "academy-of-management-review",
@ -466,6 +463,5 @@
"water-quality-exposure-and-health": "exposure-and-health",
"wceam2010": "world-congress-on-engineering-asset-management",
"wirtschaftsinformatik": "springer-basic-author-date",
"world-health-organization-journals": "world-health-organization",
"world-journal-of-biological-psychiatry": "the-world-journal-of-biological-psychiatry"
}

View File

@ -1 +1 @@
2016-03-14 15:56:00
2016-04-12 04:26:00

@ -1 +1 @@
Subproject commit 0ef37cc957c3faf5ac6b4dd6c8f1b89e00b8402b
Subproject commit c834d847805f030afe3c38c4ad92f135faf01a4d