citation-js 0.7.6 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/citation.js +105 -43
- package/build/citation.min.js +1 -1
- package/package.json +5 -5
package/build/citation.js
CHANGED
|
@@ -4263,7 +4263,8 @@ var _default = exports["default"] = {
|
|
|
4263
4263
|
sentenceCase: 'never'
|
|
4264
4264
|
},
|
|
4265
4265
|
format: {
|
|
4266
|
-
useIdAsLabel: false
|
|
4266
|
+
useIdAsLabel: false,
|
|
4267
|
+
asciiOnly: true
|
|
4267
4268
|
}
|
|
4268
4269
|
};
|
|
4269
4270
|
|
|
@@ -4349,7 +4350,7 @@ exports.text = exports.parse = parseBibTxt;
|
|
|
4349
4350
|
Object.defineProperty(exports, "__esModule", {
|
|
4350
4351
|
value: true
|
|
4351
4352
|
});
|
|
4352
|
-
exports.sentenceCaseLanguages = exports.required = exports.mathScripts = exports.mathScriptFormatting = exports.ligatures = exports.ligaturePattern = exports.formattingEnvs = exports.formattingCommands = exports.formatting = exports.fieldTypes = exports.diacritics = exports.defaultStrings = exports.commands = exports.argumentCommands = void 0;
|
|
4353
|
+
exports.sentenceCaseLanguages = exports.required = exports.mathScripts = exports.mathScriptFormatting = exports.mathCommands = exports.ligatures = exports.ligaturePattern = exports.formattingEnvs = exports.formattingCommands = exports.formatting = exports.fieldTypes = exports.diacritics = exports.defaultStrings = exports.commands = exports.argumentCommands = void 0;
|
|
4353
4354
|
var _required2 = _interopRequireDefault(require("./required.json"));
|
|
4354
4355
|
var _fieldTypes2 = _interopRequireDefault(require("./fieldTypes.json"));
|
|
4355
4356
|
var _unicode = _interopRequireDefault(require("./unicode.json"));
|
|
@@ -4362,6 +4363,7 @@ var required = exports.required = _required2["default"];
|
|
|
4362
4363
|
var fieldTypes = exports.fieldTypes = _fieldTypes2["default"];
|
|
4363
4364
|
var diacritics = exports.diacritics = _unicode["default"].diacritics;
|
|
4364
4365
|
var commands = exports.commands = _unicode["default"].commands;
|
|
4366
|
+
var mathCommands = exports.mathCommands = _unicode["default"].mathCommands;
|
|
4365
4367
|
var defaultStrings = exports.defaultStrings = {
|
|
4366
4368
|
jan: '01',
|
|
4367
4369
|
feb: '02',
|
|
@@ -5314,7 +5316,8 @@ function orderNamePieces(pieces) {
|
|
|
5314
5316
|
},{}],61:[function(require,module,exports){
|
|
5315
5317
|
module.exports={"biblatex":{"article":["author","title","journaltitle",["year","date"]],"book":["author","title",["year","date"]],"mvbook":["author","title",["year","date"]],"inbook":["author","title","booktitle",["year","date"]],"booklet":[["author","editor"],"title",["year","date"]],"collection":["editor","title",["year","date"]],"mvcollection":["editor","title",["year","date"]],"incollection":["author","title","booktitle",["year","date"]],"dataset":[["author","editor"],"title",["year","date"]],"online":[["author","editor"],"title",["year","date"],["doi","eprint","url"]],"patent":["author","title","number",["year","date"]],"periodical":["editor","title",["year","date"]],"proceedings":["title",["year","date"]],"mvproceedings":["title",["year","date"]],"inproceedings":["author","title","booktitle",["year","date"]],"report":["author","title","type","institution",["year","date"]],"thesis":["author","title","type","institution",["year","date"]],"unpublished":["author","title",["year","date"]],"conference":["author","title","booktitle",["year","date"]],"electronic":[["author","editor"],"title",["year","date"],["doi","eprint","url"]],"mastersthesis":["author","title","institution",["year","date"]],"phdthesis":["author","title","institution",["year","date"]],"techreport":["author","title","institution",["year","date"]],"www":[["author","editor"],"title",["year","date"],["doi","eprint","url"]]},"bibtex":{"article":["author","title","journal","year"],"book":[["author","editor"],"title","publisher","year"],"booklet":["title"],"inbook":[["author","editor"],"title",["chapter","pages"],"publisher","year"],"incollection":["author","title","booktitle","publisher","year"],"inproceedings":["author","title","booktitle","year"],"mastersthesis":["author","title","school","year"],"phdthesis":["author","title","school","year"],"proceedings":["title","year"],"techreport":["author","title","institution","year"],"unpublished":["author","title","note"]}}
|
|
5316
5318
|
},{}],62:[function(require,module,exports){
|
|
5317
|
-
module.exports={"diacritics":{"`":"̀","'":"́","^":"̂","~":"̃","=":"̄","u":"̆",".":"̇","\"":"̈","r":"̊","H":"̋","v":"̌","b":"̲","d":"̣","c":"̧","k":"̨","t":"͡","textcommabelow":"̦"},"commands":{"textquotesingle":"'","textasciigrave":"`","textquotedbl":"\"","textdollar":"$","textless":"<","textgreater":">","textbackslash":"\\","textasciicircum":"^","textunderscore":"_","textbraceleft":"{","textbar":"|","textbraceright":"}","textasciitilde":"~","textexclamdown":"¡","textcent":"¢","textsterling":"£","textcurrency":"¤","textyen":"¥","textbrokenbar":"¦","textsection":"§","textasciidieresis":"¨","textcopyright":"©","textordfeminine":"ª","guillemetleft":"«","guillemotleft":"«","textlnot":"¬","textregistered":"®","textasciimacron":"¯","textdegree":"°","textpm":"±","texttwosuperior":"²","textthreesuperior":"³","textasciiacute":"´","textmu":"µ","textparagraph":"¶","textperiodcentered":"·","textonesuperior":"¹","textordmasculine":"º","guillemetright":"»","guillemotright":"»","textonequarter":"¼","textonehalf":"½","textthreequarters":"¾","textquestiondown":"¿","AE":"Æ","DH":"Ð","texttimes":"×","O":"Ø","TH":"Þ","ss":"ß","ae":"æ","dh":"ð","textdiv":"÷","o":"ø","th":"þ","DJ":"Đ","dj":"đ","i":"ı","IJ":"IJ","ij":"ij","L":"Ł","l":"ł","NG":"Ŋ","ng":"ŋ","OE":"Œ","oe":"œ","textflorin":"ƒ","j":"ȷ","textasciicaron":"ˇ","textasciibreve":"˘","textacutedbl":"˝","textgravedbl":"˵","texttildelow":"˷","textbaht":"฿","SS":"ẞ","textcompwordmark":"","textendash":"–","textemdash":"—","textbardbl":"‖","textquoteleft":"‘","textquoteright":"’","quotesinglbase":"‚","textquotedblleft":"“","textquotedblright":"”","quotedblbase":"„","textdagger":"†","textdaggerdbl":"‡","textbullet":"•","textellipsis":"…","textperthousand":"‰","textpertenthousand":"‱","guilsinglleft":"‹","guilsinglright":"›","textreferencemark":"※","textinterrobang":"‽","textfractionsolidus":"⁄","textlquill":"⁅","textrquill":"⁆","textdiscount":"⁒","textcolonmonetary":"₡","textlira":"₤","textnaira":"₦","textwon":"₩","textdong":"₫","texteuro":"€","textpeso":"₱","textcelsius":"℃","textnumero":"№","textcircledP":"℗","textrecipe":"℞","textservicemark":"℠","texttrademark":"™","textohm":"Ω","textmho":"℧","textestimated":"℮","textleftarrow":"←","textuparrow":"↑","textrightarrow":"→","textdownarrow":"↓","textminus":"−","Hwithstroke":"Ħ","hwithstroke":"ħ","textasteriskcentered":"∗","textsurd":"√","textlangle":"〈","textrangle":"〉","textblank":"␢","textvisiblespace":"␣","textopenbullet":"◦","textbigcircle":"◯","textmusicalnote":"♪","textmarried":"⚭","textdivorced":"⚮","textinterrobangdown":"⸘","textcommabelow":null,"copyright":"©","Gamma":"Γ","Delta":"Δ","Theta":"Θ","Lambda":"Λ","Xi":"Ξ","Pi":"Π","Sigma":"Σ","Phi":"Φ","Psi":"Ψ","Omega":"Ω","alpha":"α","beta":"β","gamma":"γ","delta":"δ","varepsilon":"ε","zeta":"ζ","eta":"η","theta":"θ","iota":"ι","kappa":"κ","lambda":"λ","mu":"μ","nu":"ν","xi":"ξ","pi":"π","rho":"ρ","varsigma":"ς","sigma":"σ","tau":"τ","upsilon":"υ","varphi":"φ","chi":"χ","psi":"ψ","omega":"ω","vartheta":"ϑ","Upsilon":"ϒ","phi":"ϕ","varpi":"ϖ","varrho":"ϱ","epsilon":"ϵ"}}
|
|
5319
|
+
module.exports={"diacritics":{"`":"̀","'":"́","^":"̂","~":"̃","=":"̄","u":"̆",".":"̇","\"":"̈","r":"̊","H":"̋","v":"̌","b":"̲","d":"̣","c":"̧","k":"̨","t":"͡","textcommabelow":"̦"},"commands":{"textquotesingle":"'","textasciigrave":"`","textquotedbl":"\"","textdollar":"$","textless":"<","textgreater":">","textbackslash":"\\","textasciicircum":"^","textunderscore":"_","textbraceleft":"{","textbar":"|","textbraceright":"}","textasciitilde":"~","textexclamdown":"¡","textcent":"¢","textsterling":"£","textcurrency":"¤","textyen":"¥","textbrokenbar":"¦","textsection":"§","textasciidieresis":"¨","textcopyright":"©","textordfeminine":"ª","guillemetleft":"«","guillemotleft":"«","textlnot":"¬","textregistered":"®","textasciimacron":"¯","textdegree":"°","textpm":"±","texttwosuperior":"²","textthreesuperior":"³","textasciiacute":"´","textmu":"µ","textparagraph":"¶","textperiodcentered":"·","textonesuperior":"¹","textordmasculine":"º","guillemetright":"»","guillemotright":"»","textonequarter":"¼","textonehalf":"½","textthreequarters":"¾","textquestiondown":"¿","AE":"Æ","DH":"Ð","texttimes":"×","O":"Ø","TH":"Þ","ss":"ß","ae":"æ","dh":"ð","textdiv":"÷","o":"ø","th":"þ","DJ":"Đ","dj":"đ","i":"ı","IJ":"IJ","ij":"ij","L":"Ł","l":"ł","NG":"Ŋ","ng":"ŋ","OE":"Œ","oe":"œ","textflorin":"ƒ","j":"ȷ","textasciicaron":"ˇ","textasciibreve":"˘","textacutedbl":"˝","textgravedbl":"˵","texttildelow":"˷","textbaht":"฿","SS":"ẞ","textcompwordmark":"","textendash":"–","textemdash":"—","textbardbl":"‖","textquoteleft":"‘","textquoteright":"’","quotesinglbase":"‚","textquotedblleft":"“","textquotedblright":"”","quotedblbase":"„","textdagger":"†","textdaggerdbl":"‡","textbullet":"•","textellipsis":"…","textperthousand":"‰","textpertenthousand":"‱","guilsinglleft":"‹","guilsinglright":"›","textreferencemark":"※","textinterrobang":"‽","textfractionsolidus":"⁄","textlquill":"⁅","textrquill":"⁆","textdiscount":"⁒","textcolonmonetary":"₡","textlira":"₤","textnaira":"₦","textwon":"₩","textdong":"₫","texteuro":"€","textpeso":"₱","textcelsius":"℃","textnumero":"№","textcircledP":"℗","textrecipe":"℞","textservicemark":"℠","texttrademark":"™","textohm":"Ω","textmho":"℧","textestimated":"℮","textleftarrow":"←","textuparrow":"↑","textrightarrow":"→","textdownarrow":"↓","textminus":"−","Hwithstroke":"Ħ","hwithstroke":"ħ","textasteriskcentered":"∗","textsurd":"√","textlangle":"〈","textrangle":"〉","textblank":"␢","textvisiblespace":"␣","textopenbullet":"◦","textbigcircle":"◯","textmusicalnote":"♪","textmarried":"⚭","textdivorced":"⚮","textinterrobangdown":"⸘","textcommabelow":null,"copyright":"©"},"mathCommands":{"Gamma":"Γ","Delta":"Δ","Theta":"Θ","Lambda":"Λ","Xi":"Ξ","Pi":"Π","Sigma":"Σ","Phi":"Φ","Psi":"Ψ","Omega":"Ω","alpha":"α","beta":"β","gamma":"γ","delta":"δ","varepsilon":"ε","zeta":"ζ","eta":"η","theta":"θ","iota":"ι","kappa":"κ","lambda":"λ","mu":"μ","nu":"ν","xi":"ξ","pi":"π","rho":"ρ","varsigma":"ς","sigma":"σ","tau":"τ","upsilon":"υ","varphi":"φ","chi":"χ","psi":"ψ","omega":"ω","vartheta":"ϑ","Upsilon":"ϒ","phi":"ϕ","varpi":"ϖ","varrho":"ϱ","epsilon":"ϵ"}}
|
|
5320
|
+
|
|
5318
5321
|
},{}],63:[function(require,module,exports){
|
|
5319
5322
|
"use strict";
|
|
5320
5323
|
|
|
@@ -5732,6 +5735,8 @@ var valueGrammar = exports.valueGrammar = new _core.util.Grammar({
|
|
|
5732
5735
|
return applyFormatting(_text7, _format);
|
|
5733
5736
|
} else if (command in constants.commands) {
|
|
5734
5737
|
return constants.commands[command];
|
|
5738
|
+
} else if (command in constants.mathCommands) {
|
|
5739
|
+
return constants.mathCommands[command];
|
|
5735
5740
|
} else if (command in constants.diacritics && !this.matchEndOfFile()) {
|
|
5736
5741
|
var _text8 = this.consumeRule('Text');
|
|
5737
5742
|
var diacritic = _text8[0] + constants.diacritics[command];
|
|
@@ -7554,7 +7559,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7554
7559
|
value: true
|
|
7555
7560
|
});
|
|
7556
7561
|
exports.format = format;
|
|
7562
|
+
var _config = _interopRequireDefault(require("../config.js"));
|
|
7557
7563
|
var _constants = require("../input/constants.js");
|
|
7564
|
+
function _interopRequireDefault(obj) {
|
|
7565
|
+
return obj && obj.__esModule ? obj : {
|
|
7566
|
+
"default": obj
|
|
7567
|
+
};
|
|
7568
|
+
}
|
|
7558
7569
|
var unicode = {};
|
|
7559
7570
|
for (var command in _constants.commands) {
|
|
7560
7571
|
unicode[_constants.commands[command]] = command;
|
|
@@ -7565,8 +7576,13 @@ for (var diacritic in _constants.diacritics) {
|
|
|
7565
7576
|
for (var ligature in _constants.ligatures) {
|
|
7566
7577
|
unicode[_constants.ligatures[ligature]] = ligature;
|
|
7567
7578
|
}
|
|
7579
|
+
var mathUnicode = {};
|
|
7580
|
+
for (var _command in _constants.mathCommands) {
|
|
7581
|
+
mathUnicode[_constants.mathCommands[_command]] = _command;
|
|
7582
|
+
}
|
|
7568
7583
|
var UNSAFE_UNICODE = /[^a-zA-Z0-9\s!"#%&'()*+,\-./:;=?@[\]{}\u0300-\u0308\u030a-\u030c\u0332\u0323\u0327\u0328\u0361\u0326]/g;
|
|
7569
7584
|
var DIACRITIC_PATTERN = /.[\u0300-\u0308\u030a-\u030c\u0332\u0323\u0327\u0328\u0361\u0326]+/g;
|
|
7585
|
+
var LONE_DIACRITIC_PATTERN = /[\u0300-\u0308\u030a-\u030c\u0332\u0323\u0327\u0328\u0361\u0326]/g;
|
|
7570
7586
|
var listDelimiters = {
|
|
7571
7587
|
separated: ',',
|
|
7572
7588
|
list: ' and '
|
|
@@ -7580,14 +7596,26 @@ var richTextMappings = {
|
|
|
7580
7596
|
'span style="font-variant:small-caps;"': '\\textsc{',
|
|
7581
7597
|
'span class="nocase"': '{'
|
|
7582
7598
|
};
|
|
7599
|
+
function escapeCharacter(_char) {
|
|
7600
|
+
if (_char in unicode) {
|
|
7601
|
+
return unicode[_char] in _constants.ligatures ? unicode[_char] : "\\".concat(unicode[_char], "{}");
|
|
7602
|
+
} else if (_char in mathUnicode) {
|
|
7603
|
+
return "$\\".concat(mathUnicode[_char], "$");
|
|
7604
|
+
} else {
|
|
7605
|
+
return '';
|
|
7606
|
+
}
|
|
7607
|
+
}
|
|
7583
7608
|
function escapeValue(value) {
|
|
7584
|
-
|
|
7585
|
-
return
|
|
7609
|
+
if (!_config["default"].format.asciiOnly) {
|
|
7610
|
+
return value;
|
|
7611
|
+
}
|
|
7612
|
+
return value.normalize('NFKD').replace(UNSAFE_UNICODE, function (_char2) {
|
|
7613
|
+
return escapeCharacter(_char2);
|
|
7586
7614
|
}).replace(DIACRITIC_PATTERN, function (match) {
|
|
7587
7615
|
return Array.from(match).reduce(function (subject, diacritic) {
|
|
7588
7616
|
return "{\\".concat(unicode[diacritic], " ").concat(subject, "}");
|
|
7589
7617
|
});
|
|
7590
|
-
});
|
|
7618
|
+
}).replace(LONE_DIACRITIC_PATTERN, '');
|
|
7591
7619
|
}
|
|
7592
7620
|
function formatRichText(value) {
|
|
7593
7621
|
var closingTags = [];
|
|
@@ -7628,7 +7656,7 @@ function formatName(name) {
|
|
|
7628
7656
|
}
|
|
7629
7657
|
function formatTitle(title) {
|
|
7630
7658
|
return formatRichText(title).split(/(:\s*)/).map(function (part, i) {
|
|
7631
|
-
return i % 2 ? part : part.replace(/(
|
|
7659
|
+
return i % 2 ? part : part.replace(/([^\\])\b([a-z]*[A-Z].*?)\b/g, '$1{$2}');
|
|
7632
7660
|
}).join('');
|
|
7633
7661
|
}
|
|
7634
7662
|
function formatSingleValue(value, valueType) {
|
|
@@ -7667,7 +7695,7 @@ function format(field, value) {
|
|
|
7667
7695
|
}
|
|
7668
7696
|
}
|
|
7669
7697
|
|
|
7670
|
-
},{"../input/constants.js":55}],76:[function(require,module,exports){
|
|
7698
|
+
},{"../config.js":52,"../input/constants.js":55}],76:[function(require,module,exports){
|
|
7671
7699
|
"use strict";
|
|
7672
7700
|
|
|
7673
7701
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -8103,7 +8131,7 @@ var formats = exports.formats = {
|
|
|
8103
8131
|
parseAsync: api.parseAsync,
|
|
8104
8132
|
parseType: {
|
|
8105
8133
|
dataType: 'String',
|
|
8106
|
-
predicate: /^\s*(https?:\/\/(?:dx\.)?doi\.org\/(10.\d{4,9}\/[-._;()/:A-Z0-9]+))\s*$/i,
|
|
8134
|
+
predicate: /^\s*(https?:\/\/(?:dx\.)?doi\.org\/(10.\d{4,9}\/[-._;()/:A-Z0-9[\]<>]+))\s*$/i,
|
|
8107
8135
|
"extends": '@else/url'
|
|
8108
8136
|
}
|
|
8109
8137
|
},
|
|
@@ -8113,21 +8141,21 @@ var formats = exports.formats = {
|
|
|
8113
8141
|
},
|
|
8114
8142
|
parseType: {
|
|
8115
8143
|
dataType: 'String',
|
|
8116
|
-
predicate: /^\s*((?:dx\.)?doi\.org\/(10.\d{4,9}\/[-._;()/:A-Z0-9]+))\s*$/i
|
|
8144
|
+
predicate: /^\s*((?:dx\.)?doi\.org\/(10.\d{4,9}\/[-._;()/:A-Z0-9[\]<>]+))\s*$/i
|
|
8117
8145
|
}
|
|
8118
8146
|
},
|
|
8119
8147
|
'@doi/id': {
|
|
8120
8148
|
parse: id.parse,
|
|
8121
8149
|
parseType: {
|
|
8122
8150
|
dataType: 'String',
|
|
8123
|
-
predicate: /^\s*(10.\d{4,9}\/[-._;()/:A-Z0-9]+)\s*$/i
|
|
8151
|
+
predicate: /^\s*(10.\d{4,9}\/[-._;()/:A-Z0-9[\]<>]+)\s*$/i
|
|
8124
8152
|
}
|
|
8125
8153
|
},
|
|
8126
8154
|
'@doi/list+text': {
|
|
8127
8155
|
parse: id.parse,
|
|
8128
8156
|
parseType: {
|
|
8129
8157
|
dataType: 'String',
|
|
8130
|
-
tokenList: /^10.\d{4,9}\/[-._;()/:A-Z0-9]+$/i
|
|
8158
|
+
tokenList: /^10.\d{4,9}\/[-._;()/:A-Z0-9[\]<>]+$/i
|
|
8131
8159
|
}
|
|
8132
8160
|
},
|
|
8133
8161
|
'@doi/list+object': {
|
|
@@ -14526,6 +14554,9 @@ function parseEntities(_ref4) {
|
|
|
14526
14554
|
},{"./customProps.json":103,"./ignoredProps.json":106,"./prop.js":108,"./props.json":109,"./response.js":110,"@citation-js/core":10}],105:[function(require,module,exports){
|
|
14527
14555
|
"use strict";
|
|
14528
14556
|
|
|
14557
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
14558
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14559
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14529
14560
|
Object.defineProperty(exports, "__esModule", {
|
|
14530
14561
|
value: true
|
|
14531
14562
|
});
|
|
@@ -14538,8 +14569,23 @@ function _interopRequireDefault(obj) {
|
|
|
14538
14569
|
};
|
|
14539
14570
|
}
|
|
14540
14571
|
function parseWikidata(data, langs) {
|
|
14541
|
-
var
|
|
14542
|
-
|
|
14572
|
+
var ids = Array.isArray(data) ? data : [data];
|
|
14573
|
+
var _iterator = _createForOfIteratorHelper(ids),
|
|
14574
|
+
_step;
|
|
14575
|
+
try {
|
|
14576
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
14577
|
+
var id = _step.value;
|
|
14578
|
+
if (!/^Q[1-9][0-9]*$/.test(id)) {
|
|
14579
|
+
throw new Error("Entity \"".concat(id, "\" not found"));
|
|
14580
|
+
}
|
|
14581
|
+
}
|
|
14582
|
+
} catch (err) {
|
|
14583
|
+
_iterator.e(err);
|
|
14584
|
+
} finally {
|
|
14585
|
+
_iterator.f();
|
|
14586
|
+
}
|
|
14587
|
+
var urls = _wikidataSdk["default"].getManyEntities(ids, langs || _config["default"].langs);
|
|
14588
|
+
return Array.isArray(urls) ? urls : [urls];
|
|
14543
14589
|
}
|
|
14544
14590
|
|
|
14545
14591
|
},{"./config.json":102,"wikidata-sdk":684}],106:[function(require,module,exports){
|
|
@@ -15218,58 +15264,71 @@ var FETCH_ADDITIONAL = {
|
|
|
15218
15264
|
}
|
|
15219
15265
|
};
|
|
15220
15266
|
function collectAdditionalIds(entity, needed) {
|
|
15267
|
+
var additionalIds = [];
|
|
15221
15268
|
if (!needed) {
|
|
15222
|
-
return
|
|
15269
|
+
return additionalIds;
|
|
15223
15270
|
}
|
|
15224
15271
|
entity._needed = Object.assign(entity._needed || {}, needed);
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
|
|
15228
|
-
|
|
15229
|
-
|
|
15230
|
-
|
|
15231
|
-
|
|
15232
|
-
|
|
15272
|
+
for (var prop in entity.claims) {
|
|
15273
|
+
if (prop in needed) {
|
|
15274
|
+
var _iterator = _createForOfIteratorHelper(entity.claims[prop]),
|
|
15275
|
+
_step;
|
|
15276
|
+
try {
|
|
15277
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
15278
|
+
var claim = _step.value;
|
|
15279
|
+
if (claim.value) {
|
|
15280
|
+
var _claim$value$id;
|
|
15281
|
+
additionalIds.push((_claim$value$id = claim.value.id) !== null && _claim$value$id !== void 0 ? _claim$value$id : claim.value);
|
|
15282
|
+
}
|
|
15283
|
+
}
|
|
15284
|
+
} catch (err) {
|
|
15285
|
+
_iterator.e(err);
|
|
15286
|
+
} finally {
|
|
15287
|
+
_iterator.f();
|
|
15288
|
+
}
|
|
15289
|
+
}
|
|
15290
|
+
}
|
|
15291
|
+
return additionalIds;
|
|
15233
15292
|
}
|
|
15234
15293
|
function completeResponse(entities, old) {
|
|
15235
15294
|
if (!old) {
|
|
15236
15295
|
var allIds = [];
|
|
15237
15296
|
for (var id in entities) {
|
|
15238
15297
|
var _ids = collectAdditionalIds(entities[id], FETCH_ADDITIONAL);
|
|
15239
|
-
var
|
|
15240
|
-
|
|
15298
|
+
var _iterator2 = _createForOfIteratorHelper(_ids),
|
|
15299
|
+
_step2;
|
|
15241
15300
|
try {
|
|
15242
|
-
for (
|
|
15243
|
-
var _id2 =
|
|
15301
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
15302
|
+
var _id2 = _step2.value;
|
|
15244
15303
|
if (!allIds.includes(_id2)) {
|
|
15245
15304
|
allIds.push(_id2);
|
|
15246
15305
|
}
|
|
15247
15306
|
}
|
|
15248
15307
|
} catch (err) {
|
|
15249
|
-
|
|
15308
|
+
_iterator2.e(err);
|
|
15250
15309
|
} finally {
|
|
15251
|
-
|
|
15310
|
+
_iterator2.f();
|
|
15252
15311
|
}
|
|
15253
15312
|
}
|
|
15254
15313
|
return allIds;
|
|
15255
15314
|
}
|
|
15256
15315
|
var ids = [];
|
|
15257
|
-
var
|
|
15258
|
-
|
|
15316
|
+
var _iterator3 = _createForOfIteratorHelper(old),
|
|
15317
|
+
_step3;
|
|
15259
15318
|
try {
|
|
15260
|
-
for (
|
|
15261
|
-
var _id3 =
|
|
15319
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
15320
|
+
var _id3 = _step3.value;
|
|
15262
15321
|
var entity = entities[_id3];
|
|
15263
15322
|
if (!entity._needed) {
|
|
15264
15323
|
continue;
|
|
15265
15324
|
}
|
|
15266
15325
|
for (var prop in entity.claims) {
|
|
15267
15326
|
if (prop in entity._needed) {
|
|
15268
|
-
var
|
|
15269
|
-
|
|
15327
|
+
var _iterator4 = _createForOfIteratorHelper(entity.claims[prop]),
|
|
15328
|
+
_step4;
|
|
15270
15329
|
try {
|
|
15271
|
-
for (
|
|
15272
|
-
var claim =
|
|
15330
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
15331
|
+
var claim = _step4.value;
|
|
15273
15332
|
if (claim.value && claim.value.id) {
|
|
15274
15333
|
continue;
|
|
15275
15334
|
}
|
|
@@ -15277,24 +15336,27 @@ function completeResponse(entities, old) {
|
|
|
15277
15336
|
ids.push.apply(ids, _toConsumableArray(collectAdditionalIds(claim.value, entity._needed[prop])));
|
|
15278
15337
|
}
|
|
15279
15338
|
} catch (err) {
|
|
15280
|
-
|
|
15339
|
+
_iterator4.e(err);
|
|
15281
15340
|
} finally {
|
|
15282
|
-
|
|
15341
|
+
_iterator4.f();
|
|
15283
15342
|
}
|
|
15284
15343
|
}
|
|
15285
15344
|
}
|
|
15286
15345
|
delete entity._needed;
|
|
15287
15346
|
}
|
|
15288
15347
|
} catch (err) {
|
|
15289
|
-
|
|
15348
|
+
_iterator3.e(err);
|
|
15290
15349
|
} finally {
|
|
15291
|
-
|
|
15350
|
+
_iterator3.f();
|
|
15292
15351
|
}
|
|
15293
15352
|
return ids;
|
|
15294
15353
|
}
|
|
15295
15354
|
function simplifyEntities(entities) {
|
|
15296
15355
|
var simplified = _wikidataSdk.simplify.entities(entities, SIMPLIFY_OPTS);
|
|
15297
15356
|
for (var id in entities) {
|
|
15357
|
+
if (entities[id].missing === '') {
|
|
15358
|
+
throw new Error("Entity \"".concat(id, "\" not found"));
|
|
15359
|
+
}
|
|
15298
15360
|
var claims = entities[id].claims;
|
|
15299
15361
|
if (claims.P348) {
|
|
15300
15362
|
simplified[id].claims['P348:all'] = _wikidataSdk.simplify.propertyClaims(claims.P348, _objectSpread(_objectSpread({}, SIMPLIFY_OPTS), {}, {
|
|
@@ -15370,7 +15432,7 @@ function _fillCacheAsync() {
|
|
|
15370
15432
|
urls = filterIdsAndGetUrls(state.needed, cache);
|
|
15371
15433
|
_context2.next = 6;
|
|
15372
15434
|
return Promise.all(urls.map(function () {
|
|
15373
|
-
var
|
|
15435
|
+
var _ref = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(url) {
|
|
15374
15436
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15375
15437
|
while (1) switch (_context.prev = _context.next) {
|
|
15376
15438
|
case 0:
|
|
@@ -15388,7 +15450,7 @@ function _fillCacheAsync() {
|
|
|
15388
15450
|
}, _callee);
|
|
15389
15451
|
}));
|
|
15390
15452
|
return function (_x3) {
|
|
15391
|
-
return
|
|
15453
|
+
return _ref.apply(this, arguments);
|
|
15392
15454
|
};
|
|
15393
15455
|
}()));
|
|
15394
15456
|
case 6:
|