citation-js 0.7.8 → 0.7.9

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 CHANGED
@@ -1663,6 +1663,14 @@ var fieldTypes = {
1663
1663
  };
1664
1664
  function correctName(name, bestGuessConversions) {
1665
1665
  if (_typeof(name) === 'object' && name !== null && (name.literal || name.given || name.family)) {
1666
+ if (name.ORCID || name.orcid || name._ORCID) {
1667
+ name = _objectSpread({
1668
+ _orcid: name.ORCID || name.orcid || name._ORCID
1669
+ }, name);
1670
+ delete name.ORCID;
1671
+ delete name.orcid;
1672
+ delete name._ORCID;
1673
+ }
1666
1674
  return name;
1667
1675
  } else if (!bestGuessConversions) {
1668
1676
  return undefined;
@@ -3421,7 +3429,7 @@ Translator.CONVERT_TO_TARGET = Symbol('convert to target');
3421
3429
  },{}],43:[function(require,module,exports){
3422
3430
  module.exports={
3423
3431
  "name": "@citation-js/core",
3424
- "version": "0.7.6",
3432
+ "version": "0.7.9",
3425
3433
  "description": "Convert different bibliographic metadata sources",
3426
3434
  "keywords": [
3427
3435
  "citation-js",
@@ -3461,7 +3469,7 @@ module.exports={
3461
3469
  "fetch-ponyfill": "^7.1.0",
3462
3470
  "sync-fetch": "^0.4.1"
3463
3471
  },
3464
- "gitHead": "c88a4c1aacf82cfa8f1b55cc8673cb38e807c421"
3472
+ "gitHead": "8fa1b9d3d420f489f9a8a57f9759b50a6369182c"
3465
3473
  }
3466
3474
 
3467
3475
  },{}],44:[function(require,module,exports){
@@ -4265,6 +4273,10 @@ var _default = exports["default"] = {
4265
4273
  format: {
4266
4274
  useIdAsLabel: false,
4267
4275
  asciiOnly: true
4276
+ },
4277
+ biber: {
4278
+ annotationMarker: '+an',
4279
+ namedAnnotationMarker: ':'
4268
4280
  }
4269
4281
  };
4270
4282
 
@@ -4660,6 +4672,11 @@ function parseEntryValues(entry) {
4660
4672
  }
4661
4673
  output[property] = (0, _value.parse)(value + '', property, output.language);
4662
4674
  }
4675
+ for (var _property in entry.annotations) {
4676
+ for (var annotation in entry.annotations[_property]) {
4677
+ output[_property + '+an:' + annotation] = (0, _value.parseAnnotation)(entry.annotations[_property][annotation]);
4678
+ }
4679
+ }
4663
4680
  return _objectSpread(_objectSpread({}, entry), {}, {
4664
4681
  properties: output
4665
4682
  });
@@ -4847,6 +4864,7 @@ exports.bibtexGrammar = void 0;
4847
4864
  exports.parse = parse;
4848
4865
  var _core = require("@citation-js/core");
4849
4866
  var _moo = _interopRequireDefault(require("moo"));
4867
+ var _config = _interopRequireDefault(require("../config.js"));
4850
4868
  var _constants = require("./constants.js");
4851
4869
  function _interopRequireDefault(obj) {
4852
4870
  return obj && obj.__esModule ? obj : {
@@ -4902,7 +4920,7 @@ function _toPrimitive(t, r) {
4902
4920
  }
4903
4921
  return ("string" === r ? String : Number)(t);
4904
4922
  }
4905
- var identifier = /[a-zA-Z_][a-zA-Z0-9_:-]*/;
4923
+ var identifier = /[a-zA-Z_][a-zA-Z0-9_:+-]*/;
4906
4924
  var whitespace = {
4907
4925
  comment: /%.*/,
4908
4926
  whitespace: {
@@ -5043,12 +5061,11 @@ var bibtexGrammar = exports.bibtexGrammar = new _core.util.Grammar({
5043
5061
  this.consumeRule('_');
5044
5062
  this.consumeToken('comma');
5045
5063
  this.consumeRule('_');
5046
- var properties = this.consumeRule('EntryBody');
5047
- result = {
5064
+ var entryBody = this.consumeRule('EntryBody');
5065
+ result = _objectSpread({
5048
5066
  type: type,
5049
- label: label,
5050
- properties: properties
5051
- };
5067
+ label: label
5068
+ }, entryBody);
5052
5069
  }
5053
5070
  this.consumeRule('_');
5054
5071
  var closeBrace = this.consumeToken('rbrace').value;
@@ -5058,13 +5075,35 @@ var bibtexGrammar = exports.bibtexGrammar = new _core.util.Grammar({
5058
5075
  return result;
5059
5076
  },
5060
5077
  EntryBody: function EntryBody() {
5061
- var properties = {};
5078
+ var output = {
5079
+ properties: {}
5080
+ };
5062
5081
  while (this.matchToken('identifier')) {
5063
5082
  var _this$consumeRule3 = this.consumeRule('Field'),
5064
5083
  _this$consumeRule4 = _slicedToArray(_this$consumeRule3, 2),
5065
5084
  field = _this$consumeRule4[0],
5066
5085
  value = _this$consumeRule4[1];
5067
- properties[field] = value;
5086
+ var annotationField = void 0;
5087
+ var annotationName = 'default';
5088
+ if (field.endsWith(_config["default"].biber.annotationMarker)) {
5089
+ annotationField = field.slice(0, -_config["default"].biber.annotationMarker.length);
5090
+ } else if (field.includes(_config["default"].biber.annotationMarker + _config["default"].biber.namedAnnotationMarker)) {
5091
+ var _field$split = field.split(_config["default"].biber.annotationMarker + _config["default"].biber.namedAnnotationMarker);
5092
+ var _field$split2 = _slicedToArray(_field$split, 2);
5093
+ annotationField = _field$split2[0];
5094
+ annotationName = _field$split2[1];
5095
+ }
5096
+ if (annotationField) {
5097
+ if (!output.annotations) {
5098
+ output.annotations = {};
5099
+ }
5100
+ if (!output.annotations[annotationField]) {
5101
+ output.annotations[annotationField] = {};
5102
+ }
5103
+ output.annotations[annotationField][annotationName] = value;
5104
+ } else {
5105
+ output.properties[field] = value;
5106
+ }
5068
5107
  this.consumeRule('_');
5069
5108
  if (this.consumeToken('comma', true)) {
5070
5109
  this.consumeRule('_');
@@ -5072,7 +5111,7 @@ var bibtexGrammar = exports.bibtexGrammar = new _core.util.Grammar({
5072
5111
  break;
5073
5112
  }
5074
5113
  }
5075
- return properties;
5114
+ return output;
5076
5115
  },
5077
5116
  Field: function Field() {
5078
5117
  var field = this.consumeToken('identifier').value.toLowerCase();
@@ -5136,7 +5175,7 @@ function parse(text) {
5136
5175
  return bibtexGrammar.parse(lexer.reset(text));
5137
5176
  }
5138
5177
 
5139
- },{"./constants.js":55,"@citation-js/core":10,"moo":651}],59:[function(require,module,exports){
5178
+ },{"../config.js":52,"./constants.js":55,"@citation-js/core":10,"moo":651}],59:[function(require,module,exports){
5140
5179
  "use strict";
5141
5180
 
5142
5181
  Object.defineProperty(exports, "__esModule", {
@@ -5332,6 +5371,7 @@ Object.defineProperty(exports, "__esModule", {
5332
5371
  value: true
5333
5372
  });
5334
5373
  exports.parse = parse;
5374
+ exports.parseAnnotation = parseAnnotation;
5335
5375
  exports.valueGrammar = void 0;
5336
5376
  var _core = require("@citation-js/core");
5337
5377
  var _moo = _interopRequireDefault(require("moo"));
@@ -5418,12 +5458,12 @@ function _toPrimitive(t, r) {
5418
5458
  return ("string" === r ? String : Number)(t);
5419
5459
  }
5420
5460
  var text = {
5461
+ commandBegin: {
5462
+ match: '\\begin',
5463
+ push: 'environment'
5464
+ },
5421
5465
  command: {
5422
5466
  match: /\\(?:[a-zA-Z]+|.) */,
5423
- type: _moo["default"].keywords({
5424
- commandBegin: '\\begin',
5425
- commandEnd: '\\end'
5426
- }),
5427
5467
  value: function value(s) {
5428
5468
  return s.slice(1).trim();
5429
5469
  }
@@ -5466,6 +5506,15 @@ var lexer = _moo["default"].states({
5466
5506
  }, text), {}, {
5467
5507
  text: /[^{$}\s~\\,]+/
5468
5508
  }),
5509
+ annotation: _objectSpread(_objectSpread({}, text), {}, {
5510
+ colon: ':',
5511
+ equals: '=',
5512
+ comma: ',',
5513
+ semicolon: ';',
5514
+ quote: '"',
5515
+ itemCount: /\d+/,
5516
+ text: /[^{$}\s~\\":;,=]+/
5517
+ }),
5469
5518
  bracedLiteral: _objectSpread(_objectSpread({}, text), {}, {
5470
5519
  rbrace: {
5471
5520
  match: '}',
@@ -5480,6 +5529,14 @@ var lexer = _moo["default"].states({
5480
5529
  },
5481
5530
  script: /[\^_]/,
5482
5531
  text: /[^{$}\s~\\^_]+/
5532
+ }),
5533
+ environment: _objectSpread(_objectSpread({
5534
+ commandEnd: {
5535
+ match: '\\end',
5536
+ pop: true
5537
+ }
5538
+ }, text), {}, {
5539
+ text: /[^{$}\s~\\]+/
5483
5540
  })
5484
5541
  });
5485
5542
  function flattenConsString(string) {
@@ -5632,6 +5689,87 @@ var valueGrammar = exports.valueGrammar = new _core.util.Grammar({
5632
5689
  }
5633
5690
  return flattenConsString(output);
5634
5691
  },
5692
+ Annotations: function Annotations() {
5693
+ var annotations = {};
5694
+ while (true) {
5695
+ var _this$consumeRule = this.consumeRule('Annotation'),
5696
+ scope = _this$consumeRule.scope,
5697
+ item = _this$consumeRule.item,
5698
+ part = _this$consumeRule.part,
5699
+ value = _this$consumeRule.value;
5700
+ if (scope === 'part') {
5701
+ if (!annotations.part) {
5702
+ annotations.part = [];
5703
+ }
5704
+ if (!annotations.part[item]) {
5705
+ annotations.part[item] = {};
5706
+ }
5707
+ annotations.part[item][part] = value;
5708
+ } else if (scope === 'item') {
5709
+ if (!annotations.item) {
5710
+ annotations.item = [];
5711
+ }
5712
+ annotations.item[item] = value;
5713
+ } else {
5714
+ annotations.field = value;
5715
+ }
5716
+ if (this.matchEndOfFile()) {
5717
+ break;
5718
+ } else {
5719
+ this.consumeToken('semicolon');
5720
+ this.consumeRule('_');
5721
+ }
5722
+ }
5723
+ return annotations;
5724
+ },
5725
+ Annotation: function Annotation() {
5726
+ var annotation = {};
5727
+ if (this.matchToken('itemCount')) {
5728
+ annotation.item = parseInt(this.consumeToken('itemCount')) - 1;
5729
+ if (this.matchToken('colon')) {
5730
+ this.consumeToken('colon');
5731
+ annotation.part = this.consumeToken('text');
5732
+ annotation.scope = 'part';
5733
+ } else {
5734
+ annotation.scope = 'item';
5735
+ }
5736
+ } else {
5737
+ annotation.scope = 'field';
5738
+ }
5739
+ this.consumeToken('equals');
5740
+ this.consumeRule('_');
5741
+ if (this.matchToken('quote')) {
5742
+ this.consumeToken('quote');
5743
+ var literal = '';
5744
+ while (!this.matchToken('quote')) {
5745
+ if (this.matchToken('itemCount') || this.matchToken('colon') || this.matchToken('comma') || this.matchToken('semicolon') || this.matchToken('equals')) {
5746
+ literal += this.token.value;
5747
+ this.token = this.lexer.next();
5748
+ } else {
5749
+ literal += this.consumeRule('Text');
5750
+ }
5751
+ }
5752
+ this.consumeToken('quote');
5753
+ annotation.value = flattenConsString(literal);
5754
+ this.consumeRule('_');
5755
+ } else {
5756
+ annotation.value = [];
5757
+ var output = '';
5758
+ while (true) {
5759
+ output += this.consumeRule('Text');
5760
+ if (this.matchToken('comma')) {
5761
+ this.consumeToken('comma');
5762
+ this.consumeRule('_');
5763
+ annotation.value.push(flattenConsString(output));
5764
+ output = '';
5765
+ } else if (this.matchEndOfFile() || this.matchToken('semicolon')) {
5766
+ annotation.value.push(flattenConsString(output));
5767
+ break;
5768
+ }
5769
+ }
5770
+ }
5771
+ return annotation;
5772
+ },
5635
5773
  BracketString: function BracketString() {
5636
5774
  var _this$state;
5637
5775
  var output = '';
@@ -5776,6 +5914,11 @@ var valueGrammar = exports.valueGrammar = new _core.util.Grammar({
5776
5914
  throw new SyntaxError(this.lexer.formatError(end, "environment started with \"".concat(beginEnv, "\", ended with \"").concat(endEnv, "\"")));
5777
5915
  }
5778
5916
  return applyFormatting(output, constants.formattingEnvs[beginEnv]);
5917
+ },
5918
+ _: function _() {
5919
+ while (this.matchToken('whitespace')) {
5920
+ this.consumeToken('whitespace');
5921
+ }
5779
5922
  }
5780
5923
  }, {
5781
5924
  sentenceCase: false,
@@ -5841,6 +5984,13 @@ function parse(text, field) {
5841
5984
  col: 0
5842
5985
  }), getMainRule(fieldType, languages));
5843
5986
  }
5987
+ function parseAnnotation(text) {
5988
+ return valueGrammar.parse(lexer.reset(text, {
5989
+ state: 'annotation',
5990
+ line: 0,
5991
+ col: 0
5992
+ }), 'Annotations');
5993
+ }
5844
5994
 
5845
5995
  },{"../config.js":52,"./constants.js":55,"./name.js":60,"@citation-js/core":10,"moo":651}],64:[function(require,module,exports){
5846
5996
  "use strict";
@@ -5985,9 +6135,9 @@ var _default = exports["default"] = new _core.util.Translator([].concat(aliases,
5985
6135
  source: 'annotation',
5986
6136
  target: 'annote'
5987
6137
  }, {
5988
- source: 'author',
6138
+ source: ['author', 'author+an:orcid'],
5989
6139
  target: 'author',
5990
- convert: _shared.Converters.NAMES
6140
+ convert: _shared.Converters.NAMES_ORCID
5991
6141
  }, {
5992
6142
  source: 'library',
5993
6143
  target: 'call-number'
@@ -7377,6 +7527,31 @@ var Converters = exports.Converters = {
7377
7527
  return list.map(name.convertToSource);
7378
7528
  }
7379
7529
  },
7530
+ NAMES_ORCID: {
7531
+ toTarget: function toTarget(list, orcid) {
7532
+ return list.map(function (inputName, i) {
7533
+ var _orcid$item;
7534
+ var outputName = name.convertToTarget(inputName);
7535
+ if (typeof (orcid === null || orcid === void 0 || (_orcid$item = orcid.item) === null || _orcid$item === void 0 ? void 0 : _orcid$item[i]) === 'string') {
7536
+ outputName._orcid = orcid.item[i];
7537
+ }
7538
+ return outputName;
7539
+ });
7540
+ },
7541
+ toSource: function toSource(list) {
7542
+ var names = [];
7543
+ var orcid = [];
7544
+ for (var i = 0; i < list.length; i++) {
7545
+ names.push(name.convertToSource(list[i]));
7546
+ if (list[i]._orcid) {
7547
+ orcid[i] = list[i]._orcid;
7548
+ }
7549
+ }
7550
+ return [names, orcid.length ? {
7551
+ item: orcid
7552
+ } : undefined];
7553
+ }
7554
+ },
7380
7555
  PAGES: {
7381
7556
  toTarget: function toTarget(pages) {
7382
7557
  return pages.replace(/[–—]/, '-');
@@ -7420,27 +7595,34 @@ var Converters = exports.Converters = {
7420
7595
  },{"../config.js":52,"@citation-js/core":10}],71:[function(require,module,exports){
7421
7596
  "use strict";
7422
7597
 
7423
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7424
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7425
- 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); }
7426
- 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; }
7427
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7428
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7429
7598
  Object.defineProperty(exports, "__esModule", {
7430
7599
  value: true
7431
7600
  });
7432
7601
  exports.format = format;
7433
- function formatEntry(_ref, dict) {
7434
- var type = _ref.type,
7435
- label = _ref.label,
7436
- properties = _ref.properties;
7437
- var fields = Object.entries(properties).map(function (_ref2) {
7438
- var _ref3 = _slicedToArray(_ref2, 2),
7439
- field = _ref3[0],
7440
- value = _ref3[1];
7441
- return dict.listItem.join("".concat(field, " = {").concat(value, "},"));
7442
- });
7443
- return dict.entry.join("@".concat(type, "{").concat(label, ",").concat(dict.list.join(fields.join('')), "}"));
7602
+ var _config = _interopRequireDefault(require("../config.js"));
7603
+ function _interopRequireDefault(obj) {
7604
+ return obj && obj.__esModule ? obj : {
7605
+ "default": obj
7606
+ };
7607
+ }
7608
+ function formatField(field, value, dict) {
7609
+ return dict.listItem.join("".concat(field, " = {").concat(value, "},"));
7610
+ }
7611
+ function formatEntry(entry, dict) {
7612
+ var fields = [];
7613
+ for (var field in entry.properties) {
7614
+ fields.push(formatField(field, entry.properties[field], dict));
7615
+ if (entry.annotations && entry.annotations[field]) {
7616
+ for (var annotation in entry.annotations[field]) {
7617
+ var annotationField = field + _config["default"].biber.annotationMarker;
7618
+ if (annotation !== 'default') {
7619
+ annotationField += _config["default"].biber.namedAnnotationMarker + annotation;
7620
+ }
7621
+ fields.push(formatField(annotationField, entry.annotations[field][annotation], dict));
7622
+ }
7623
+ }
7624
+ }
7625
+ return dict.entry.join("@".concat(entry.type, "{").concat(entry.label, ",").concat(dict.list.join(fields.join('')), "}"));
7444
7626
  }
7445
7627
  function format(src, dict) {
7446
7628
  var entries = src.map(function (entry) {
@@ -7449,7 +7631,7 @@ function format(src, dict) {
7449
7631
  return dict.bibliographyContainer.join(entries);
7450
7632
  }
7451
7633
 
7452
- },{}],72:[function(require,module,exports){
7634
+ },{"../config.js":52}],72:[function(require,module,exports){
7453
7635
  "use strict";
7454
7636
 
7455
7637
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -7484,6 +7666,12 @@ function format(src, dict) {
7484
7666
  },{}],73:[function(require,module,exports){
7485
7667
  "use strict";
7486
7668
 
7669
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7670
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7671
+ 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); }
7672
+ 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; }
7673
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7674
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7487
7675
  Object.defineProperty(exports, "__esModule", {
7488
7676
  value: true
7489
7677
  });
@@ -7495,16 +7683,30 @@ function formatEntryValues(_ref) {
7495
7683
  var type = _ref.type,
7496
7684
  label = _ref.label,
7497
7685
  properties = _ref.properties;
7498
- var output = {};
7499
- for (var property in properties) {
7500
- var value = properties[property];
7501
- output[property] = (0, _value.format)(property, value);
7502
- }
7503
- return {
7686
+ var output = {
7504
7687
  type: type,
7505
7688
  label: label,
7506
- properties: output
7689
+ properties: {}
7507
7690
  };
7691
+ for (var property in properties) {
7692
+ var value = properties[property];
7693
+ var _property$split = property.split('+an:'),
7694
+ _property$split2 = _slicedToArray(_property$split, 2),
7695
+ field = _property$split2[0],
7696
+ annotation = _property$split2[1];
7697
+ if (annotation) {
7698
+ if (!output.annotations) {
7699
+ output.annotations = {};
7700
+ }
7701
+ if (!output.annotations[field]) {
7702
+ output.annotations[field] = {};
7703
+ }
7704
+ output.annotations[field][annotation] = (0, _value.formatAnnotation)(value);
7705
+ } else {
7706
+ output.properties[property] = (0, _value.format)(property, value);
7707
+ }
7708
+ }
7709
+ return output;
7508
7710
  }
7509
7711
  function format(entries) {
7510
7712
  return (0, _index.format)(entries).map(formatEntryValues);
@@ -7559,6 +7761,7 @@ Object.defineProperty(exports, "__esModule", {
7559
7761
  value: true
7560
7762
  });
7561
7763
  exports.format = format;
7764
+ exports.formatAnnotation = formatAnnotation;
7562
7765
  var _config = _interopRequireDefault(require("../config.js"));
7563
7766
  var _constants = require("../input/constants.js");
7564
7767
  function _interopRequireDefault(obj) {
@@ -7681,6 +7884,15 @@ function formatList(values, valueType, listType) {
7681
7884
  return formatted.includes(delimiter) ? "{".concat(formatted, "}") : formatted;
7682
7885
  }).join(delimiter);
7683
7886
  }
7887
+ function formatAnnotationValue(values) {
7888
+ if (Array.isArray(values)) {
7889
+ return values.map(function (value) {
7890
+ return escapeValue(value).replace(/([;,"])/g, '{$1}');
7891
+ }).join(', ');
7892
+ } else {
7893
+ return '"' + escapeValue(values).replace(/(["])/g, '{$1}') + '"';
7894
+ }
7895
+ }
7684
7896
  function format(field, value) {
7685
7897
  if (!(field in _constants.fieldTypes)) {
7686
7898
  return formatSingleValue(value, 'verbatim');
@@ -7694,6 +7906,42 @@ function format(field, value) {
7694
7906
  return formatSingleValue(value, valueType);
7695
7907
  }
7696
7908
  }
7909
+ function formatAnnotation(value) {
7910
+ var annotations = [];
7911
+ if (value.field) {
7912
+ annotations.push('=' + formatAnnotationValue(value.field));
7913
+ }
7914
+ if (value.item) {
7915
+ for (var _i = 0, _Object$entries = Object.entries(value.item); _i < _Object$entries.length; _i++) {
7916
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
7917
+ itemCount = _Object$entries$_i[0],
7918
+ itemValue = _Object$entries$_i[1];
7919
+ if (!itemValue) {
7920
+ continue;
7921
+ }
7922
+ var i = parseInt(itemCount) + 1;
7923
+ annotations.push(i + '=' + formatAnnotationValue(itemValue));
7924
+ }
7925
+ }
7926
+ if (value.part) {
7927
+ for (var _i2 = 0, _Object$entries2 = Object.entries(value.part); _i2 < _Object$entries2.length; _i2++) {
7928
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
7929
+ _itemCount = _Object$entries2$_i[0],
7930
+ _itemValue = _Object$entries2$_i[1];
7931
+ if (!_itemValue) {
7932
+ continue;
7933
+ }
7934
+ var _i3 = parseInt(_itemCount) + 1;
7935
+ for (var part in _itemValue) {
7936
+ if (!_itemValue[part]) {
7937
+ continue;
7938
+ }
7939
+ annotations.push(_i3 + ':' + part + '=' + formatAnnotationValue(_itemValue[part]));
7940
+ }
7941
+ }
7942
+ }
7943
+ return annotations.join('; ');
7944
+ }
7697
7945
 
7698
7946
  },{"../config.js":52,"../input/constants.js":55}],76:[function(require,module,exports){
7699
7947
  "use strict";