@manuscripts/transform 3.0.69 → 3.1.0

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.
Files changed (35) hide show
  1. package/dist/cjs/index.js +2 -3
  2. package/dist/cjs/jats/exporter/citeproc.js +164 -0
  3. package/dist/cjs/jats/exporter/jats-exporter.js +70 -196
  4. package/dist/cjs/jats/importer/jats-dom-parser.js +48 -62
  5. package/dist/cjs/lib/citeproc.js +13 -0
  6. package/dist/cjs/schema/index.js +1 -0
  7. package/dist/cjs/schema/nodes/bibliography_element.js +3 -1
  8. package/dist/cjs/schema/nodes/bibliography_item.js +3 -7
  9. package/dist/cjs/schema/nodes/comment.js +3 -1
  10. package/dist/cjs/schema/nodes/list.js +3 -45
  11. package/dist/cjs/version.js +1 -1
  12. package/dist/es/index.js +1 -1
  13. package/dist/es/jats/exporter/citeproc.js +156 -0
  14. package/dist/es/jats/exporter/jats-exporter.js +48 -196
  15. package/dist/es/jats/importer/jats-dom-parser.js +49 -63
  16. package/dist/es/lib/citeproc.js +9 -0
  17. package/dist/es/schema/index.js +1 -0
  18. package/dist/es/schema/nodes/bibliography_element.js +1 -0
  19. package/dist/es/schema/nodes/bibliography_item.js +1 -6
  20. package/dist/es/schema/nodes/comment.js +1 -0
  21. package/dist/es/schema/nodes/list.js +2 -42
  22. package/dist/es/version.js +1 -1
  23. package/dist/types/index.d.ts +1 -1
  24. package/dist/types/jats/exporter/citeproc.d.ts +18 -0
  25. package/dist/types/jats/exporter/jats-exporter.d.ts +5 -29
  26. package/dist/types/jats/importer/jats-dom-parser.d.ts +2 -2
  27. package/dist/types/lib/citeproc.d.ts +3 -0
  28. package/dist/types/schema/index.d.ts +1 -0
  29. package/dist/types/schema/nodes/bibliography_element.d.ts +1 -0
  30. package/dist/types/schema/nodes/bibliography_item.d.ts +9 -9
  31. package/dist/types/schema/nodes/citation.d.ts +3 -4
  32. package/dist/types/schema/nodes/comment.d.ts +3 -3
  33. package/dist/types/schema/nodes/list.d.ts +5 -11
  34. package/dist/types/version.d.ts +1 -1
  35. package/package.json +4 -6
@@ -19,7 +19,6 @@ exports.JATSDOMParser = void 0;
19
19
  const json_schema_1 = require("@manuscripts/json-schema");
20
20
  const prosemirror_model_1 = require("prosemirror-model");
21
21
  const utils_1 = require("../../lib/utils");
22
- const schema_1 = require("../../schema");
23
22
  const jats_comments_1 = require("./jats-comments");
24
23
  class JATSDOMParser {
25
24
  constructor(sectionCategories, schema) {
@@ -131,11 +130,22 @@ class JATSDOMParser {
131
130
  this.getAddressLine = (element, index) => {
132
131
  return ((0, utils_1.getTrimmedTextContent)(element, `addr-line:nth-of-type(${index})`) || '');
133
132
  };
134
- this.choosePublicationType = (element) => {
135
- var _a;
136
- const citationElement = element.querySelector('element-citation, mixed-citation');
137
- const type = citationElement === null || citationElement === void 0 ? void 0 : citationElement.getAttribute('publication-type');
138
- return type ? (_a = schema_1.publicationTypeToPM[type]) !== null && _a !== void 0 ? _a : type : 'article-journal';
133
+ this.getRefType = (element) => {
134
+ const citation = element.querySelector('element-citation, mixed-citation');
135
+ const type = citation === null || citation === void 0 ? void 0 : citation.getAttribute('publication-type');
136
+ if (!type) {
137
+ return 'article-journal';
138
+ }
139
+ switch (type) {
140
+ case 'journal':
141
+ return 'article-journal';
142
+ case 'web':
143
+ return 'webpage';
144
+ case 'data':
145
+ return 'dataset';
146
+ default:
147
+ return type;
148
+ }
139
149
  };
140
150
  this.getFigContent = (node) => {
141
151
  const element = node;
@@ -154,18 +164,6 @@ class JATSDOMParser {
154
164
  }
155
165
  return prosemirror_model_1.Fragment.from(content);
156
166
  };
157
- this.parseRefLiteral = (element) => {
158
- var _a;
159
- const mixedCitation = element.querySelector('mixed-citation');
160
- const hasDirectTextNodeWithLetters = Array.from((_a = mixedCitation === null || mixedCitation === void 0 ? void 0 : mixedCitation.childNodes) !== null && _a !== void 0 ? _a : []).some((node) => {
161
- var _a;
162
- return node.nodeType === Node.TEXT_NODE &&
163
- ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.match(/[A-Za-z]+/g));
164
- });
165
- if (hasDirectTextNodeWithLetters) {
166
- return (0, utils_1.getTrimmedTextContent)(mixedCitation);
167
- }
168
- };
169
167
  this.parseRefPages = (element) => {
170
168
  const fpage = (0, utils_1.getTrimmedTextContent)(element, 'fpage');
171
169
  const lpage = (0, utils_1.getTrimmedTextContent)(element, 'lpage');
@@ -174,10 +172,9 @@ class JATSDOMParser {
174
172
  }
175
173
  };
176
174
  this.parseRef = (element) => {
177
- var _a, _b;
178
175
  return {
179
176
  id: element.id,
180
- type: this.choosePublicationType(element),
177
+ type: this.getRefType(element),
181
178
  comment: (0, utils_1.getTrimmedTextContent)(element, 'comment'),
182
179
  volume: (0, utils_1.getTrimmedTextContent)(element, 'volume'),
183
180
  issue: (0, utils_1.getTrimmedTextContent)(element, 'issue'),
@@ -195,23 +192,13 @@ class JATSDOMParser {
195
192
  institution: (0, utils_1.getTrimmedTextContent)(element, 'institution'),
196
193
  locator: (0, utils_1.getTrimmedTextContent)(element, 'elocation-id'),
197
194
  'container-title': (0, utils_1.getHTMLContent)(element, 'source'),
198
- title: (_b = (_a = (0, utils_1.getHTMLContent)(element, 'article-title')) !== null && _a !== void 0 ? _a : (0, utils_1.getHTMLContent)(element, 'data-title')) !== null && _b !== void 0 ? _b : (0, utils_1.getHTMLContent)(element, 'part-title'),
199
- author: this.getNameContent(element, 'person-group[person-group-type="author"] > *'),
200
- editor: this.getNameContent(element, 'person-group[person-group-type="editor"] > *'),
201
- literal: this.parseRefLiteral(element),
195
+ title: (0, utils_1.getHTMLContent)(element, 'article-title, data-title, part-title'),
196
+ author: this.getNameContent(element, 'author'),
197
+ editor: this.getNameContent(element, 'editor'),
198
+ literal: (0, utils_1.getTrimmedTextContent)(element, 'mixed-citation'),
202
199
  accessed: this.getDateContent(element, 'date-in-citation'),
203
200
  'event-date': this.getDateContent(element, 'conf-date'),
204
- issued: (0, utils_1.getTrimmedTextContent)(element.querySelector('element-citation, mixed-citation'), ':scope > year')
205
- ? (0, json_schema_1.buildBibliographicDate)({
206
- 'date-parts': [
207
- [
208
- (0, utils_1.getTrimmedTextContent)(element.querySelector('element-citation, mixed-citation'), ':scope > year') || '',
209
- (0, utils_1.getTrimmedTextContent)(element.querySelector('element-citation, mixed-citation'), ':scope > month') || '',
210
- (0, utils_1.getTrimmedTextContent)(element.querySelector('element-citation, mixed-citation'), ':scope > day') || '',
211
- ],
212
- ],
213
- })
214
- : undefined,
201
+ issued: this.getIssuedDateContent(element),
215
202
  page: this.parseRefPages(element),
216
203
  };
217
204
  };
@@ -1075,30 +1062,22 @@ class JATSDOMParser {
1075
1062
  }
1076
1063
  }
1077
1064
  }
1078
- getNameContent(element, query) {
1079
- const buildName = (node) => {
1080
- const name = (0, json_schema_1.buildBibliographicName)({});
1081
- const given = (0, utils_1.getTrimmedTextContent)(node, 'given-names');
1082
- const family = (0, utils_1.getTrimmedTextContent)(node, 'surname');
1083
- if (given) {
1084
- name.given = given;
1085
- }
1086
- if (family) {
1087
- name.family = family;
1088
- }
1089
- if (node.nodeName === 'collab') {
1090
- name.literal = (0, utils_1.getTrimmedTextContent)(node);
1091
- }
1092
- return name;
1093
- };
1094
- const personNodes = element.querySelectorAll(query);
1095
- if (personNodes.length) {
1096
- return Array.from(personNodes).map(buildName);
1065
+ getNameContent(element, type) {
1066
+ const query = `person-group[person-group-type="${type}"] > *`;
1067
+ const groups = [...element.querySelectorAll(query)];
1068
+ if (!groups.length) {
1069
+ return;
1097
1070
  }
1071
+ return groups.map((node) => ({
1072
+ given: (0, utils_1.getTrimmedTextContent)(node, 'given-names'),
1073
+ family: (0, utils_1.getTrimmedTextContent)(node, 'surname'),
1074
+ literal: node.nodeName === 'collab' ? (0, utils_1.getTrimmedTextContent)(node) : undefined,
1075
+ }));
1098
1076
  }
1099
1077
  getDateContent(element, query) {
1100
- const buildDate = (element) => {
1101
- const isoDate = element.getAttribute('iso-8601-date');
1078
+ const date = element.querySelector(query);
1079
+ if (date) {
1080
+ const isoDate = date.getAttribute('iso-8601-date');
1102
1081
  if (!isoDate) {
1103
1082
  return;
1104
1083
  }
@@ -1108,14 +1087,21 @@ class JATSDOMParser {
1108
1087
  parsedDate.getMonth() + 1,
1109
1088
  parsedDate.getDate(),
1110
1089
  ];
1111
- return (0, json_schema_1.buildBibliographicDate)({
1090
+ return {
1112
1091
  'date-parts': [parts],
1113
- });
1114
- };
1115
- const dateElement = element.querySelector(query);
1116
- if (dateElement) {
1117
- return buildDate(dateElement);
1092
+ };
1093
+ }
1094
+ }
1095
+ getIssuedDateContent(element) {
1096
+ const year = (0, utils_1.getTrimmedTextContent)(element, ':scope > * > year');
1097
+ if (!year) {
1098
+ return;
1118
1099
  }
1100
+ const month = (0, utils_1.getTrimmedTextContent)(element, ':scope > * > month');
1101
+ const day = (0, utils_1.getTrimmedTextContent)(element, ':scope > * > day');
1102
+ return {
1103
+ 'date-parts': [[year, month !== null && month !== void 0 ? month : '', day !== null && day !== void 0 ? day : '']],
1104
+ };
1119
1105
  }
1120
1106
  }
1121
1107
  exports.JATSDOMParser = JATSDOMParser;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildCiteprocCitation = void 0;
4
+ const buildCiteprocCitation = (citation) => ({
5
+ citationID: citation.id,
6
+ citationItems: citation.rids.map((rid) => ({
7
+ id: rid,
8
+ })),
9
+ properties: {
10
+ noteIndex: 0,
11
+ },
12
+ });
13
+ exports.buildCiteprocCitation = buildCiteprocCitation;
@@ -160,6 +160,7 @@ __exportStar(require("./nodes/placeholder_element"), exports);
160
160
  __exportStar(require("./nodes/pullquote_element"), exports);
161
161
  __exportStar(require("./nodes/section"), exports);
162
162
  __exportStar(require("./nodes/section_title"), exports);
163
+ __exportStar(require("./nodes/section_label"), exports);
163
164
  __exportStar(require("./nodes/supplement"), exports);
164
165
  __exportStar(require("./nodes/supplements"), exports);
165
166
  __exportStar(require("./nodes/table"), exports);
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.bibliographyElement = void 0;
18
+ exports.isBibliographyElementNode = exports.bibliographyElement = void 0;
19
19
  exports.bibliographyElement = {
20
20
  content: 'bibliography_item*',
21
21
  attrs: {
@@ -41,3 +41,5 @@ exports.bibliographyElement = {
41
41
  return dom;
42
42
  },
43
43
  };
44
+ const isBibliographyElementNode = (node) => node.type === node.type.schema.nodes.bibliography_element;
45
+ exports.isBibliographyElementNode = isBibliographyElementNode;
@@ -15,13 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.bibliographyItem = exports.publicationTypeToPM = void 0;
19
- exports.publicationTypeToPM = {
20
- journal: 'article-journal',
21
- web: 'webpage',
22
- data: 'dataset',
23
- preprint: 'article-journal',
24
- };
18
+ exports.isBibliographyItemNode = exports.bibliographyItem = void 0;
25
19
  exports.bibliographyItem = {
26
20
  content: 'inline{0}',
27
21
  attrs: {
@@ -58,3 +52,5 @@ exports.bibliographyItem = {
58
52
  selectable: false,
59
53
  group: 'block',
60
54
  };
55
+ const isBibliographyItemNode = (node) => node.type === node.type.schema.nodes.bibliography_item;
56
+ exports.isBibliographyItemNode = isBibliographyItemNode;
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.comment = void 0;
18
+ exports.isCommentNode = exports.comment = void 0;
19
19
  exports.comment = {
20
20
  attrs: {
21
21
  id: { default: '' },
@@ -27,3 +27,5 @@ exports.comment = {
27
27
  originalText: { default: '' },
28
28
  },
29
29
  };
30
+ const isCommentNode = (node) => node.type === node.type.schema.nodes.comment;
31
+ exports.isCommentNode = isCommentNode;
@@ -1,55 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isListNode = exports.listItem = exports.list = exports.getListType = exports.getJatsListType = void 0;
3
+ exports.isListNode = exports.listItem = exports.list = void 0;
4
4
  const json_schema_1 = require("@manuscripts/json-schema");
5
- const getJatsListType = (cssStyle) => {
6
- switch (cssStyle) {
7
- case 'disc':
8
- return 'bullet';
9
- case 'decimal':
10
- return 'order';
11
- case 'lower-alpha':
12
- return 'alpha-lower';
13
- case 'upper-alpha':
14
- return 'alpha-upper';
15
- case 'lower-roman':
16
- return 'roman-lower';
17
- case 'upper-roman':
18
- return 'roman-upper';
19
- case 'simple':
20
- return 'none';
21
- default:
22
- return 'none';
23
- }
24
- };
25
- exports.getJatsListType = getJatsListType;
26
- const getListType = (style) => {
27
- switch (style) {
28
- case 'bullet':
29
- return { type: 'ul', style: 'disc' };
30
- case 'order':
31
- return { type: 'ul', style: 'decimal' };
32
- case 'alpha-lower':
33
- return { type: 'ul', style: 'lower-alpha' };
34
- case 'alpha-upper':
35
- return { type: 'ul', style: 'upper-alpha' };
36
- case 'roman-lower':
37
- return { type: 'ul', style: 'lower-roman' };
38
- case 'roman-upper':
39
- return { type: 'ul', style: 'upper-roman' };
40
- case 'simple':
41
- default:
42
- return { type: 'ul', style: 'none' };
43
- }
44
- };
45
- exports.getListType = getListType;
46
5
  exports.list = {
47
6
  content: 'list_item+',
48
7
  group: 'block list element',
49
8
  attrs: {
50
9
  id: { default: '' },
51
- dataTracked: { default: null },
52
10
  listStyleType: { default: null },
11
+ dataTracked: { default: null },
53
12
  },
54
13
  parseDOM: [
55
14
  {
@@ -75,9 +34,8 @@ exports.list = {
75
34
  ],
76
35
  toDOM: (node) => {
77
36
  const list = node;
78
- const { type } = (0, exports.getListType)(list.attrs.listStyleType);
79
37
  return [
80
- type,
38
+ 'ul',
81
39
  {
82
40
  id: list.attrs.id,
83
41
  'list-type': list.attrs.listStyleType,
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "3.0.69";
4
+ exports.VERSION = "3.1.0";
package/dist/es/index.js CHANGED
@@ -5,8 +5,8 @@ export * from './jats/types';
5
5
  export * from './lib/footnotes';
6
6
  export * from './lib/utils';
7
7
  export * from './lib/section-categories';
8
+ export * from './lib/citeproc';
8
9
  export * from './schema';
9
10
  export { migrateFor } from './schema/migration/migrate';
10
- export { isSectionLabelNode } from './schema/nodes/section_label';
11
11
  export * from './transformer';
12
12
  export * from './types';
@@ -0,0 +1,156 @@
1
+ /*!
2
+ * © 2025 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import Citeproc from 'citeproc';
17
+ const normalizeID = (id) => id.replace(/:/g, '_');
18
+ const labelOnly = /^<label>.+<\/label>$/;
19
+ export const initJats = () => {
20
+ if (Citeproc.Output.Formats.jats) {
21
+ return;
22
+ }
23
+ Citeproc.Output.Formats.jats = Object.assign(Object.assign({}, Citeproc.Output.Formats.html), { text_escape: function (text) {
24
+ return text !== null && text !== void 0 ? text : '';
25
+ }, bibstart: '<ref-list>', bibend: '</ref-list>', '@font-style/italic': '<italic>%%STRING%%</italic>', '@font-style/oblique': '<italic>%%STRING%%</italic>', '@font-style/normal': false, '@font-variant/small-caps': '<smallcaps>%%STRING%%</smallcaps>', '@font-variant/normal': false, '@font-weight/bold': '<bold>%%STRING%%</bold>', '@font-weight/normal': false, '@font-weight/light': false, '@text-decoration/none': false, '@text-decoration/underline': '<underline>%%STRING%%</underline>', '@vertical-align/sup': '<sup>%%STRING%%</sup>', '@vertical-align/sub': '<sub>%%STRING%%</sub>', '@vertical-align/baseline': false, '@bibliography/entry': function (state, str) {
26
+ const id = this.system_id;
27
+ const item = state.registry.registry[id].ref;
28
+ const type = getPublicationType(item);
29
+ str = str.trim();
30
+ if (labelOnly.test(str)) {
31
+ return `<ref id="${normalizeID(id)}">${str}<mixed-citation publication-type="${type}">${item.literal}</mixed-citation></ref>`;
32
+ }
33
+ else if (str.includes('mixed-citation')) {
34
+ return `<ref id="${normalizeID(id)}">${str.replace('%%TYPE%%', type)}</ref>`;
35
+ }
36
+ else {
37
+ return `<ref id="${normalizeID(id)}"><mixed-citation publication-type="${type}">${str}</mixed-citation></ref>`;
38
+ }
39
+ }, '@display/block': false, '@display/left-margin': function (state, str) {
40
+ return `<label>${str}</label>`;
41
+ }, '@display/right-inline': function (state, str) {
42
+ return `<mixed-citation publication-type="%%TYPE%%">${str}</mixed-citation>`;
43
+ }, '@display/indent': false, '@URL/true': false, '@DOI/true': false });
44
+ const name = Citeproc.NameOutput.prototype._renderOnePersonalName;
45
+ Citeproc.NameOutput.prototype._renderOnePersonalName = function (...args) {
46
+ const area = this.state.tmp.area;
47
+ const blob = name.call(this, ...args);
48
+ if (blob && area === 'bibliography') {
49
+ blob.strings.prefix = '<string-name>';
50
+ blob.strings.suffix = '</string-name>';
51
+ }
52
+ return blob;
53
+ };
54
+ const given = Citeproc.NameOutput.prototype._givenName;
55
+ Citeproc.NameOutput.prototype._givenName = function (...args) {
56
+ const area = this.state.tmp.area;
57
+ const info = given.call(this, ...args);
58
+ if (info.blob && area === 'bibliography') {
59
+ info.blob.strings.prefix = '<given-names>';
60
+ info.blob.strings.suffix = '</given-names>';
61
+ }
62
+ return info;
63
+ };
64
+ const family = Citeproc.NameOutput.prototype._familyName;
65
+ Citeproc.NameOutput.prototype._familyName = function (...args) {
66
+ const area = this.state.tmp.area;
67
+ const blob = family.call(this, ...args);
68
+ if (blob && area === 'bibliography') {
69
+ blob.strings.prefix = '<surname>';
70
+ blob.strings.suffix = '</surname>';
71
+ }
72
+ return blob;
73
+ };
74
+ };
75
+ const namesWrapper = (type) => (str) => `<person-group person-group-type="${type}">${str}</person-group>`;
76
+ const formatDate = (date) => {
77
+ let output = date.year;
78
+ if (date.month) {
79
+ output += '-' + String(date.month).padStart(2, '0');
80
+ if (date.day) {
81
+ output += '-' + String(date.day).padStart(2, '0');
82
+ }
83
+ }
84
+ return output;
85
+ };
86
+ const getPublicationType = (item) => {
87
+ switch (item.type) {
88
+ case 'article-journal':
89
+ return 'journal';
90
+ case 'webpage':
91
+ return 'page';
92
+ case 'dataset':
93
+ return 'data';
94
+ default:
95
+ return item.type;
96
+ }
97
+ };
98
+ const wrappers = {
99
+ author: namesWrapper('author'),
100
+ issued: (str, item) => str.replace(item.issued.year, `<year>${item.issued.year}</year>`),
101
+ 'container-title': (str) => `<source>${str}</source>`,
102
+ volume: (str) => `<volume>${str}</volume>`,
103
+ issue: (str) => `<issue>${str}</issue>`,
104
+ supplement: (str) => `<supplement>${str}</supplement>`,
105
+ page: (str) => {
106
+ let fpage = str;
107
+ let lpage;
108
+ const parts = str.split('-');
109
+ if (parts.length === 2) {
110
+ fpage = parts[0];
111
+ lpage = parts[1];
112
+ }
113
+ str = str.replace(fpage, `<fpage>${fpage}</fpage>`);
114
+ if (lpage) {
115
+ str = str.replace(lpage, `<lpage>${lpage}</lpage>`);
116
+ }
117
+ return str;
118
+ },
119
+ title: (str, item) => {
120
+ const type = item.type;
121
+ switch (type) {
122
+ case 'dataset':
123
+ return `<data-title>${str}</data-title>`;
124
+ case 'article-journal':
125
+ case 'preprint':
126
+ return `<article-title>${str}</article-title>`;
127
+ default:
128
+ return `<part-title>${str}</part-title>`;
129
+ }
130
+ },
131
+ std: (str) => `<pub-id pub-id-type="std-designation">${str}</pub-id>`,
132
+ 'collection-title': (str) => `<series>${str}</series>`,
133
+ edition: (str) => `<edition>${str}</edition>`,
134
+ publisher: (str) => `<publisher-name>${str}</publisher-name>`,
135
+ 'publisher-place': (str) => `<publisher-loc>${str}</publisher-loc>`,
136
+ event: (str) => `<conf-name>${str}</conf-name>`,
137
+ 'event-place': (str) => `<conf-loc>${str}</conf-loc>`,
138
+ 'number-of-pages': (str) => `<size units="pages">${str}</size>`,
139
+ institution: (str) => `<institution>${str}</institution>`,
140
+ locator: (str) => `<elocation-id>${str}</elocation-id>`,
141
+ editor: namesWrapper('editor'),
142
+ accessed: (str, item) => `<date-in-citation content-type="access-date" iso-8601-date="${formatDate(item.accessed)}">${str}</date-in-citation>`,
143
+ 'event-date': (str, item) => `<conf-date iso-8601-date="${formatDate(item['event-date'])}">${str}</conf-date>`,
144
+ DOI: (str) => `<pub-id pub-id-type="doi">${str}</pub-id>`,
145
+ URL: (str) => `<ext-link ext-link-type="uri" xlink:href="${str}">${str}</ext-link>`,
146
+ };
147
+ export const jatsVariableWrapper = (params, pre, str, post) => {
148
+ if (str && params.context === 'bibliography') {
149
+ const name = params.variableNames[0];
150
+ const fn = wrappers[name];
151
+ if (fn) {
152
+ str = fn(str, params.itemData);
153
+ }
154
+ }
155
+ return `${pre}${str !== null && str !== void 0 ? str : ''}${post}`;
156
+ };