citation-js 0.7.2 → 0.7.3
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 +58 -29
- package/build/citation.min.js +1 -1
- package/package.json +3 -3
package/build/citation.js
CHANGED
|
@@ -8459,6 +8459,29 @@ var CONVERTERS = {
|
|
|
8459
8459
|
return parts.join('/');
|
|
8460
8460
|
}
|
|
8461
8461
|
},
|
|
8462
|
+
YEAR: {
|
|
8463
|
+
toTarget: function toTarget(year) {
|
|
8464
|
+
return {
|
|
8465
|
+
'date-parts': [[year]]
|
|
8466
|
+
};
|
|
8467
|
+
},
|
|
8468
|
+
toSource: function toSource(date) {
|
|
8469
|
+
var _date$dateParts;
|
|
8470
|
+
return (_date$dateParts = date['date-parts']) === null || _date$dateParts === void 0 || (_date$dateParts = _date$dateParts[0]) === null || _date$dateParts === void 0 || (_date$dateParts = _date$dateParts[0]) === null || _date$dateParts === void 0 ? void 0 : _date$dateParts.toString();
|
|
8471
|
+
}
|
|
8472
|
+
},
|
|
8473
|
+
DATE_YEAR: {
|
|
8474
|
+
keepAll: true,
|
|
8475
|
+
toTarget: function toTarget() {
|
|
8476
|
+
for (var _len3 = arguments.length, dates = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
8477
|
+
dates[_key3] = arguments[_key3];
|
|
8478
|
+
}
|
|
8479
|
+
return CONVERTERS.DATE.toTarget(dates.find(Boolean));
|
|
8480
|
+
},
|
|
8481
|
+
toSource: function toSource(date) {
|
|
8482
|
+
return [CONVERTERS.DATE.toSource(date), CONVERTERS.YEAR.toSource(date)];
|
|
8483
|
+
}
|
|
8484
|
+
},
|
|
8462
8485
|
NAME: {
|
|
8463
8486
|
toTarget: function toTarget(names) {
|
|
8464
8487
|
return names && [].concat(names).map(function (name) {
|
|
@@ -8556,7 +8579,7 @@ module.exports={
|
|
|
8556
8579
|
"accessed": "DATE",
|
|
8557
8580
|
"container": "DATE",
|
|
8558
8581
|
"event-date": "DATE",
|
|
8559
|
-
"issued": "
|
|
8582
|
+
"issued": "DATE_YEAR",
|
|
8560
8583
|
"original-date": "DATE",
|
|
8561
8584
|
"submitted": "DATE",
|
|
8562
8585
|
|
|
@@ -8673,34 +8696,40 @@ function prepareTranslator(spec) {
|
|
|
8673
8696
|
_step;
|
|
8674
8697
|
try {
|
|
8675
8698
|
var _loop = function _loop() {
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
if (mapping.convert && mapping.convert.keepAll === true) {
|
|
8681
|
-
return 1;
|
|
8682
|
-
}
|
|
8683
|
-
if (Array.isArray(mapping.source)) {
|
|
8684
|
-
if (mapping.convert) {
|
|
8685
|
-
var _mapping$convert = mapping.convert,
|
|
8686
|
-
_toSource = _mapping$convert.toSource,
|
|
8687
|
-
_toTarget = _mapping$convert.toTarget;
|
|
8688
|
-
mapping.convert = {
|
|
8689
|
-
toTarget: function toTarget() {
|
|
8690
|
-
var _converters$default$A;
|
|
8691
|
-
return _toTarget((_converters$default$A = _converters["default"].ANY).toTarget.apply(_converters$default$A, arguments));
|
|
8692
|
-
},
|
|
8693
|
-
toSource: function toSource() {
|
|
8694
|
-
return _converters["default"].ANY.toSource(_toSource.apply(void 0, arguments));
|
|
8695
|
-
}
|
|
8696
|
-
};
|
|
8697
|
-
} else {
|
|
8698
|
-
mapping.convert = _converters["default"].ANY;
|
|
8699
|
+
var mapping = _step.value;
|
|
8700
|
+
if (mapping.target === 'issued' && !Array.isArray(mapping.source)) {
|
|
8701
|
+
mapping.convert = _converters["default"].YEAR;
|
|
8702
|
+
return 0;
|
|
8699
8703
|
}
|
|
8700
|
-
|
|
8701
|
-
|
|
8704
|
+
if (mapping.target in _dataTypes["default"]) {
|
|
8705
|
+
mapping.convert = _converters["default"][_dataTypes["default"][mapping.target]];
|
|
8706
|
+
}
|
|
8707
|
+
if (mapping.convert && mapping.convert.keepAll === true) {
|
|
8708
|
+
return 0;
|
|
8709
|
+
}
|
|
8710
|
+
if (Array.isArray(mapping.source)) {
|
|
8711
|
+
if (mapping.convert) {
|
|
8712
|
+
var _mapping$convert = mapping.convert,
|
|
8713
|
+
_toSource = _mapping$convert.toSource,
|
|
8714
|
+
_toTarget = _mapping$convert.toTarget;
|
|
8715
|
+
mapping.convert = {
|
|
8716
|
+
toTarget: function toTarget() {
|
|
8717
|
+
var _converters$default$A;
|
|
8718
|
+
return _toTarget((_converters$default$A = _converters["default"].ANY).toTarget.apply(_converters$default$A, arguments));
|
|
8719
|
+
},
|
|
8720
|
+
toSource: function toSource() {
|
|
8721
|
+
return _converters["default"].ANY.toSource(_toSource.apply(void 0, arguments));
|
|
8722
|
+
}
|
|
8723
|
+
};
|
|
8724
|
+
} else {
|
|
8725
|
+
mapping.convert = _converters["default"].ANY;
|
|
8726
|
+
}
|
|
8727
|
+
}
|
|
8728
|
+
},
|
|
8729
|
+
_ret;
|
|
8702
8730
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
8703
|
-
|
|
8731
|
+
_ret = _loop();
|
|
8732
|
+
if (_ret === 0) continue;
|
|
8704
8733
|
}
|
|
8705
8734
|
} catch (err) {
|
|
8706
8735
|
_iterator.e(err);
|
|
@@ -10617,8 +10646,8 @@ module.exports=[
|
|
|
10617
10646
|
{
|
|
10618
10647
|
"source": [
|
|
10619
10648
|
"DA",
|
|
10620
|
-
"
|
|
10621
|
-
"
|
|
10649
|
+
"PY",
|
|
10650
|
+
"C2"
|
|
10622
10651
|
],
|
|
10623
10652
|
"target": "issued",
|
|
10624
10653
|
"when": {
|