@manuscripts/transform 2.1.5 → 2.1.6-hotfix.1

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 (30) hide show
  1. package/dist/cjs/jats/importer/jats-body-transformations.js +3 -1
  2. package/dist/cjs/jats/importer/jats-front-parser.js +39 -1
  3. package/dist/cjs/jats/importer/parse-jats-article.js +3 -6
  4. package/dist/cjs/jats/jats-exporter.js +61 -45
  5. package/dist/cjs/schema/index.js +3 -1
  6. package/dist/cjs/schema/nodes/author_notes.js +27 -0
  7. package/dist/cjs/schema/nodes/contributors.js +1 -1
  8. package/dist/cjs/schema/nodes/link.js +1 -2
  9. package/dist/cjs/transformer/builders.js +11 -7
  10. package/dist/cjs/transformer/decode.js +13 -1
  11. package/dist/cjs/transformer/encode.js +3 -0
  12. package/dist/cjs/transformer/node-types.js +1 -0
  13. package/dist/es/jats/importer/jats-body-transformations.js +3 -1
  14. package/dist/es/jats/importer/jats-front-parser.js +40 -2
  15. package/dist/es/jats/importer/parse-jats-article.js +3 -6
  16. package/dist/es/jats/jats-exporter.js +64 -48
  17. package/dist/es/schema/index.js +3 -1
  18. package/dist/es/schema/nodes/author_notes.js +24 -0
  19. package/dist/es/schema/nodes/contributors.js +1 -1
  20. package/dist/es/schema/nodes/link.js +1 -2
  21. package/dist/es/transformer/builders.js +9 -6
  22. package/dist/es/transformer/decode.js +13 -1
  23. package/dist/es/transformer/encode.js +3 -0
  24. package/dist/es/transformer/node-types.js +1 -0
  25. package/dist/types/jats/importer/jats-front-parser.d.ts +10 -1
  26. package/dist/types/jats/jats-exporter.d.ts +4 -0
  27. package/dist/types/schema/nodes/author_notes.d.ts +25 -0
  28. package/dist/types/schema/types.d.ts +1 -1
  29. package/dist/types/transformer/builders.d.ts +3 -2
  30. package/package.json +3 -3
@@ -202,7 +202,9 @@ exports.jatsBodyTransformations = {
202
202
  }
203
203
  },
204
204
  moveFootnotes(doc, group, createElement) {
205
- const footnotes = [...doc.querySelectorAll('fn:not(table-wrap-foot fn)')];
205
+ const footnotes = [
206
+ ...doc.querySelectorAll('fn:not(table-wrap-foot fn, author-notes fn)'),
207
+ ];
206
208
  const footnotesSection = doc.querySelector('sec[sec-type="endnotes"]');
207
209
  const footnotesSectionGroup = footnotesSection === null || footnotesSection === void 0 ? void 0 : footnotesSection.querySelector('fn-group');
208
210
  const containingGroup = footnotesSectionGroup || createElement('fn-group');
@@ -179,7 +179,45 @@ exports.jatsFrontParser = {
179
179
  affiliationIDs,
180
180
  };
181
181
  },
182
- parseAuthorNotes(elements) {
182
+ parseAuthorNotes(element) {
183
+ if (!element) {
184
+ return {
185
+ footnotes: [],
186
+ footnoteIDs: new Map(),
187
+ authorNotes: [],
188
+ authorNotesParagraphs: [],
189
+ correspondingIDs: new Map(),
190
+ correspondingList: [],
191
+ };
192
+ }
193
+ const { footnotes, footnoteIDs } = this.parseFootnotes([
194
+ ...element.querySelectorAll('fn:not([fn-type])'),
195
+ ]);
196
+ const authorNotesParagraphs = this.parseParagraphs([
197
+ ...element.querySelectorAll(':scope > p'),
198
+ ]);
199
+ const { correspondingList, correspondingIDs } = this.parseCorresp([
200
+ ...element.querySelectorAll('corresp'),
201
+ ]);
202
+ const authorNotes = [
203
+ (0, transformer_1.buildAuthorNotes)([
204
+ ...footnoteIDs.values(),
205
+ ...authorNotesParagraphs.map((p) => p._id),
206
+ ]),
207
+ ];
208
+ return {
209
+ footnotes,
210
+ footnoteIDs,
211
+ authorNotesParagraphs,
212
+ authorNotes,
213
+ correspondingIDs,
214
+ correspondingList,
215
+ };
216
+ },
217
+ parseParagraphs(elements) {
218
+ return elements.map((p) => (0, transformer_1.buildParagraph)(p.innerHTML));
219
+ },
220
+ parseFootnotes(elements) {
183
221
  const footnoteIDs = new Map();
184
222
  const footnotes = elements.map((element) => {
185
223
  const fn = (0, transformer_1.buildFootnote)('', element.innerHTML);
@@ -35,12 +35,7 @@ const parseJATSFront = (doc, front) => {
35
35
  const { affiliations, affiliationIDs } = jats_front_parser_1.jatsFrontParser.parseAffiliations([
36
36
  ...front.querySelectorAll('article-meta > contrib-group > aff'),
37
37
  ]);
38
- const { footnotes, footnoteIDs } = jats_front_parser_1.jatsFrontParser.parseAuthorNotes([
39
- ...front.querySelectorAll('article-meta > author-notes > fn:not([fn-type])'),
40
- ]);
41
- const { correspondingList, correspondingIDs } = jats_front_parser_1.jatsFrontParser.parseCorresp([
42
- ...front.querySelectorAll('article-meta > author-notes > corresp'),
43
- ]);
38
+ const { footnotes, footnoteIDs, authorNotes, authorNotesParagraphs, correspondingIDs, correspondingList, } = jats_front_parser_1.jatsFrontParser.parseAuthorNotes(front.querySelector('article-meta > author-notes'));
44
39
  const authors = jats_front_parser_1.jatsFrontParser.parseContributors([
45
40
  ...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
46
41
  ], affiliationIDs, footnoteIDs, correspondingIDs);
@@ -51,6 +46,8 @@ const parseJATSFront = (doc, front) => {
51
46
  manuscript,
52
47
  titles,
53
48
  journal,
49
+ ...authorNotesParagraphs,
50
+ ...authorNotes,
54
51
  ...footnotes,
55
52
  ...authors,
56
53
  ...affiliations,
@@ -615,6 +615,7 @@ class JATSExporter {
615
615
  this.createSerializer = () => {
616
616
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
617
617
  const nodes = {
618
+ author_notes: () => ['author-notes', 0],
618
619
  title: () => '',
619
620
  affiliations: () => '',
620
621
  contributors: () => '',
@@ -1035,6 +1036,7 @@ class JATSExporter {
1035
1036
  }
1036
1037
  };
1037
1038
  this.buildContributors = (articleMeta) => {
1039
+ var _a;
1038
1040
  const contributors = this.models.filter(isContributor);
1039
1041
  const authorContributors = contributors
1040
1042
  .filter((contributor) => contributor.role === 'author')
@@ -1253,56 +1255,61 @@ class JATSExporter {
1253
1255
  }
1254
1256
  });
1255
1257
  }
1256
- const noteIDs = [];
1257
- for (const contributor of [...authorContributors, ...otherContributors]) {
1258
- if (contributor.footnote) {
1259
- const ids = contributor.footnote.map((note) => {
1260
- return note.noteID;
1261
- });
1262
- noteIDs.push(...ids);
1263
- }
1264
- if (contributor.corresp) {
1265
- const ids = contributor.corresp.map((corresp) => {
1266
- return corresp.correspID;
1267
- });
1268
- noteIDs.push(...ids);
1269
- }
1270
- }
1271
- const footnotes = [];
1272
- footnotes.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Footnote)));
1273
- const correspodings = [];
1274
- correspodings.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Corresponding)));
1275
- if (footnotes || correspodings) {
1276
- const authorNotesEl = this.document.createElement('author-notes');
1277
- const usedFootnotes = footnotes.filter((footnote) => {
1278
- return noteIDs.includes(footnote._id);
1279
- });
1280
- const usedCorrespodings = correspodings.filter((corresp) => {
1281
- return noteIDs.includes(corresp._id);
1282
- });
1283
- usedFootnotes.forEach((footnote) => {
1284
- const authorFootNote = this.document.createElement('fn');
1285
- authorFootNote.setAttribute('id', normalizeID(footnote._id));
1286
- authorFootNote.innerHTML = footnote.contents;
1287
- authorNotesEl.appendChild(authorFootNote);
1288
- });
1289
- usedCorrespodings.forEach((corresponding) => {
1290
- const correspondingEl = this.document.createElement('corresp');
1291
- correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1292
- if (corresponding.label) {
1293
- const labelEl = this.document.createElement('label');
1294
- labelEl.textContent = corresponding.label;
1295
- correspondingEl.appendChild(labelEl);
1258
+ const authorNotesEl = this.document.createElement('author-notes');
1259
+ const usedCorrespodings = this.getUsedCorrespondings([
1260
+ ...authorContributors,
1261
+ ...otherContributors,
1262
+ ]);
1263
+ usedCorrespodings.forEach((corresp) => {
1264
+ this.appendCorrespondingToElement(corresp, authorNotesEl);
1265
+ });
1266
+ const authorNotes = (_a = (0, json_schema_1.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
1267
+ if (authorNotes) {
1268
+ authorNotes.containedObjectIDs.forEach((id) => {
1269
+ const model = this.modelMap.get(id);
1270
+ if (!model) {
1271
+ return;
1272
+ }
1273
+ if (id.startsWith('MPParagraphElement')) {
1274
+ this.appendParagraphToElement(model, authorNotesEl);
1275
+ }
1276
+ else if (id.startsWith('MPFootnote')) {
1277
+ this.appendFootnoteToElement(model, authorNotesEl);
1296
1278
  }
1297
- correspondingEl.append(corresponding.contents);
1298
- authorNotesEl.appendChild(correspondingEl);
1299
1279
  });
1300
- if (authorNotesEl.childNodes.length > 0) {
1301
- articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1302
- }
1280
+ }
1281
+ if (authorNotesEl.childNodes.length > 0) {
1282
+ articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1303
1283
  }
1304
1284
  }
1305
1285
  };
1286
+ this.appendCorrespondingToElement = (corresponding, element) => {
1287
+ const correspondingEl = this.document.createElement('corresp');
1288
+ correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1289
+ if (corresponding.label) {
1290
+ const labelEl = this.document.createElement('label');
1291
+ labelEl.textContent = corresponding.label;
1292
+ correspondingEl.appendChild(labelEl);
1293
+ }
1294
+ correspondingEl.append(corresponding.contents);
1295
+ element.appendChild(correspondingEl);
1296
+ };
1297
+ this.appendParagraphToElement = (paragraph, element) => {
1298
+ const parsedDoc = new DOMParser().parseFromString(paragraph.contents, 'text/html');
1299
+ const parsedParagraph = parsedDoc.body.querySelector('p');
1300
+ if (parsedParagraph) {
1301
+ const paragraphEl = this.document.createElement('p');
1302
+ paragraphEl.innerHTML = parsedParagraph.innerHTML;
1303
+ paragraphEl.setAttribute('id', normalizeID(paragraph._id));
1304
+ element.appendChild(paragraphEl);
1305
+ }
1306
+ };
1307
+ this.appendFootnoteToElement = (footnote, element) => {
1308
+ const footnoteEl = this.document.createElement('fn');
1309
+ footnoteEl.setAttribute('id', normalizeID(footnote._id));
1310
+ footnoteEl.innerHTML = footnote.contents;
1311
+ element.appendChild(footnoteEl);
1312
+ };
1306
1313
  this.fixBody = (body, fragment) => {
1307
1314
  fragment.descendants((node) => {
1308
1315
  if (node.attrs.id) {
@@ -1605,6 +1612,12 @@ class JATSExporter {
1605
1612
  return mathml;
1606
1613
  }
1607
1614
  }
1615
+ getUsedCorrespondings(contributors) {
1616
+ return contributors
1617
+ .flatMap((c) => { var _a; return (_a = c.corresp) !== null && _a !== void 0 ? _a : []; })
1618
+ .map((corresp) => this.modelMap.get(corresp.correspID))
1619
+ .filter((corresp) => !!corresp);
1620
+ }
1608
1621
  buildKeywords(articleMeta) {
1609
1622
  const keywords = [...this.modelMap.values()].filter((model) => model.objectType === json_schema_1.ObjectTypes.Keyword);
1610
1623
  const keywordGroups = new Map();
@@ -1676,6 +1689,9 @@ class JATSExporter {
1676
1689
  }
1677
1690
  }
1678
1691
  }
1692
+ if (!fnGroup.hasChildNodes()) {
1693
+ fnGroup.remove();
1694
+ }
1679
1695
  }
1680
1696
  }
1681
1697
  });
@@ -36,6 +36,7 @@ const abstracts_1 = require("./nodes/abstracts");
36
36
  const affiliation_1 = require("./nodes/affiliation");
37
37
  const affiliations_1 = require("./nodes/affiliations");
38
38
  const attribution_1 = require("./nodes/attribution");
39
+ const author_notes_1 = require("./nodes/author_notes");
39
40
  const backmatter_1 = require("./nodes/backmatter");
40
41
  const bibliography_element_1 = require("./nodes/bibliography_element");
41
42
  const bibliography_item_1 = require("./nodes/bibliography_item");
@@ -215,6 +216,7 @@ exports.schema = new prosemirror_model_1.Schema({
215
216
  table_row: table_1.tableRow,
216
217
  table_col: table_col_1.tableCol,
217
218
  table_colgroup: table_col_1.tableColGroup,
219
+ table_header: table_1.tableHeader,
218
220
  text: text_1.text,
219
221
  toc_element: toc_element_1.tocElement,
220
222
  toc_section: toc_section_1.tocSection,
@@ -226,6 +228,6 @@ exports.schema = new prosemirror_model_1.Schema({
226
228
  contributors: contributors_1.contributors,
227
229
  supplements: supplements_1.supplements,
228
230
  supplement: supplement_1.supplement,
229
- table_header: table_1.tableHeader,
231
+ author_notes: author_notes_1.authorNotes,
230
232
  },
231
233
  });
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.authorNotes = void 0;
19
+ exports.authorNotes = {
20
+ attrs: {
21
+ id: { default: '' },
22
+ dataTracked: { default: null },
23
+ },
24
+ content: '(footnote | paragraph)+',
25
+ group: 'block element',
26
+ toDOM: () => ['author-notes', 0],
27
+ };
@@ -17,7 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.contributors = void 0;
19
19
  exports.contributors = {
20
- content: 'contributor*',
20
+ content: 'contributor* author_notes?',
21
21
  attrs: {
22
22
  id: { default: '' },
23
23
  },
@@ -17,8 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.link = void 0;
19
19
  exports.link = {
20
- content: 'text*',
21
- marks: '',
20
+ content: 'inline*',
22
21
  attrs: {
23
22
  href: { default: '' },
24
23
  title: { default: '' },
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.buildTitles = exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildJournal = exports.buildAttribution = exports.buildContributorRole = exports.buildContribution = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildFootnote = exports.buildNote = exports.buildComment = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildKeywordGroup = exports.buildKeyword = exports.buildBibliographyElement = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = void 0;
21
+ exports.buildTitles = exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildJournal = exports.buildAttribution = exports.buildContributorRole = exports.buildContribution = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildAuthorNotes = exports.buildFootnote = exports.buildNote = exports.buildComment = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildKeywordGroup = exports.buildKeyword = exports.buildBibliographyElement = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = void 0;
22
22
  const json_schema_1 = require("@manuscripts/json-schema");
23
23
  const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
24
24
  const schema_1 = require("../schema");
@@ -123,6 +123,12 @@ const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
123
123
  kind,
124
124
  });
125
125
  exports.buildFootnote = buildFootnote;
126
+ const buildAuthorNotes = (containedObjectIDs) => ({
127
+ _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.AuthorNotes),
128
+ objectType: json_schema_1.ObjectTypes.AuthorNotes,
129
+ containedObjectIDs: containedObjectIDs,
130
+ });
131
+ exports.buildAuthorNotes = buildAuthorNotes;
126
132
  const buildFootnotesOrder = (footnotesList, containedObjectID) => ({
127
133
  _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.FootnotesOrder),
128
134
  objectType: json_schema_1.ObjectTypes.FootnotesOrder,
@@ -146,13 +152,12 @@ const buildSection = (priority = 0, path = []) => {
146
152
  };
147
153
  };
148
154
  exports.buildSection = buildSection;
149
- const buildParagraph = (placeholderInnerHTML) => {
155
+ const buildParagraph = (innerHTML = '') => {
150
156
  const _id = (0, id_1.generateID)(json_schema_1.ObjectTypes.ParagraphElement);
151
- const element = document.createElementNS('http://www.w3.org/1999/xhtml', 'p');
157
+ const element = document.createElementNS(null, 'p');
152
158
  element.setAttribute('id', _id);
153
- element.setAttribute('class', 'MPElement');
154
- if (placeholderInnerHTML) {
155
- element.setAttribute('data-placeholder-text', placeholderInnerHTML);
159
+ if (innerHTML) {
160
+ element.innerHTML = innerHTML;
156
161
  }
157
162
  const contents = (0, w3c_xmlserializer_1.default)(element);
158
163
  return {
@@ -160,7 +165,6 @@ const buildParagraph = (placeholderInnerHTML) => {
160
165
  objectType: json_schema_1.ObjectTypes.ParagraphElement,
161
166
  elementType: 'p',
162
167
  contents,
163
- placeholderInnerHTML,
164
168
  };
165
169
  };
166
170
  exports.buildParagraph = buildParagraph;
@@ -62,6 +62,7 @@ const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(
62
62
  exports.sortSectionsByPriority = sortSectionsByPriority;
63
63
  const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Section).sort(exports.sortSectionsByPriority);
64
64
  const getAffiliations = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Affiliation);
65
+ const getAuthorNotes = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.AuthorNotes);
65
66
  const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
66
67
  const getKeywordElements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordsElement);
67
68
  const getSupplements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Supplement);
@@ -91,7 +92,11 @@ class Decoder {
91
92
  const contributors = getContributors(this.modelMap)
92
93
  .map((c) => this.decode(c))
93
94
  .filter(Boolean);
94
- return schema_1.schema.nodes.contributors.createAndFill({}, contributors);
95
+ const authorNotes = getAuthorNotes(this.modelMap)
96
+ .map((authorNote) => this.decode(authorNote))
97
+ .filter(Boolean);
98
+ const content = [...contributors, ...authorNotes];
99
+ return schema_1.schema.nodes.contributors.createAndFill({}, content);
95
100
  }
96
101
  createKeywordsNode() {
97
102
  const elements = getKeywordElements(this.modelMap)
@@ -489,6 +494,13 @@ class Decoder {
489
494
  id: model._id,
490
495
  }, content);
491
496
  },
497
+ [json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
498
+ const model = data;
499
+ const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
500
+ return schema_1.schema.nodes.author_notes.create({
501
+ id: model._id,
502
+ }, content);
503
+ },
492
504
  [json_schema_1.ObjectTypes.Section]: (data) => {
493
505
  const model = data;
494
506
  const elements = [];
@@ -383,6 +383,9 @@ const encoders = {
383
383
  table_element_footer: (node) => ({
384
384
  containedObjectIDs: containedObjectIDs(node),
385
385
  }),
386
+ author_notes: (node) => ({
387
+ containedObjectIDs: containedObjectIDs(node),
388
+ }),
386
389
  footnotes_section: (node, parent, path, priority) => ({
387
390
  category: (0, section_category_1.buildSectionCategory)(node),
388
391
  priority: priority.value++,
@@ -61,6 +61,7 @@ exports.nodeTypesMap = new Map([
61
61
  [schema_1.schema.nodes.affiliations, json_schema_1.ObjectTypes.Section],
62
62
  [schema_1.schema.nodes.title, json_schema_1.ObjectTypes.Titles],
63
63
  [schema_1.schema.nodes.supplement, json_schema_1.ObjectTypes.Supplement],
64
+ [schema_1.schema.nodes.author_notes, json_schema_1.ObjectTypes.AuthorNotes],
64
65
  ]);
65
66
  const isExecutableNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_EXECUTABLE);
66
67
  exports.isExecutableNodeType = isExecutableNodeType;
@@ -199,7 +199,9 @@ export const jatsBodyTransformations = {
199
199
  }
200
200
  },
201
201
  moveFootnotes(doc, group, createElement) {
202
- const footnotes = [...doc.querySelectorAll('fn:not(table-wrap-foot fn)')];
202
+ const footnotes = [
203
+ ...doc.querySelectorAll('fn:not(table-wrap-foot fn, author-notes fn)'),
204
+ ];
203
205
  const footnotesSection = doc.querySelector('sec[sec-type="endnotes"]');
204
206
  const footnotesSectionGroup = footnotesSection === null || footnotesSection === void 0 ? void 0 : footnotesSection.querySelector('fn-group');
205
207
  const containingGroup = footnotesSectionGroup || createElement('fn-group');
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import debug from 'debug';
17
17
  import { getTrimmedTextContent } from '../../lib/utils';
18
- import { buildAffiliation, buildBibliographicName, buildContributor, buildCorresp, buildFootnote, buildJournal, buildTitles, } from '../../transformer';
18
+ import { buildAffiliation, buildAuthorNotes, buildBibliographicName, buildContributor, buildCorresp, buildFootnote, buildJournal, buildParagraph, buildTitles, } from '../../transformer';
19
19
  import { parseJournalMeta } from './jats-journal-meta-parser';
20
20
  import { htmlFromJatsNode } from './jats-parser-utils';
21
21
  const warn = debug('manuscripts-transform');
@@ -173,7 +173,45 @@ export const jatsFrontParser = {
173
173
  affiliationIDs,
174
174
  };
175
175
  },
176
- parseAuthorNotes(elements) {
176
+ parseAuthorNotes(element) {
177
+ if (!element) {
178
+ return {
179
+ footnotes: [],
180
+ footnoteIDs: new Map(),
181
+ authorNotes: [],
182
+ authorNotesParagraphs: [],
183
+ correspondingIDs: new Map(),
184
+ correspondingList: [],
185
+ };
186
+ }
187
+ const { footnotes, footnoteIDs } = this.parseFootnotes([
188
+ ...element.querySelectorAll('fn:not([fn-type])'),
189
+ ]);
190
+ const authorNotesParagraphs = this.parseParagraphs([
191
+ ...element.querySelectorAll(':scope > p'),
192
+ ]);
193
+ const { correspondingList, correspondingIDs } = this.parseCorresp([
194
+ ...element.querySelectorAll('corresp'),
195
+ ]);
196
+ const authorNotes = [
197
+ buildAuthorNotes([
198
+ ...footnoteIDs.values(),
199
+ ...authorNotesParagraphs.map((p) => p._id),
200
+ ]),
201
+ ];
202
+ return {
203
+ footnotes,
204
+ footnoteIDs,
205
+ authorNotesParagraphs,
206
+ authorNotes,
207
+ correspondingIDs,
208
+ correspondingList,
209
+ };
210
+ },
211
+ parseParagraphs(elements) {
212
+ return elements.map((p) => buildParagraph(p.innerHTML));
213
+ },
214
+ parseFootnotes(elements) {
177
215
  const footnoteIDs = new Map();
178
216
  const footnotes = elements.map((element) => {
179
217
  const fn = buildFootnote('', element.innerHTML);
@@ -32,12 +32,7 @@ export const parseJATSFront = (doc, front) => {
32
32
  const { affiliations, affiliationIDs } = jatsFrontParser.parseAffiliations([
33
33
  ...front.querySelectorAll('article-meta > contrib-group > aff'),
34
34
  ]);
35
- const { footnotes, footnoteIDs } = jatsFrontParser.parseAuthorNotes([
36
- ...front.querySelectorAll('article-meta > author-notes > fn:not([fn-type])'),
37
- ]);
38
- const { correspondingList, correspondingIDs } = jatsFrontParser.parseCorresp([
39
- ...front.querySelectorAll('article-meta > author-notes > corresp'),
40
- ]);
35
+ const { footnotes, footnoteIDs, authorNotes, authorNotesParagraphs, correspondingIDs, correspondingList, } = jatsFrontParser.parseAuthorNotes(front.querySelector('article-meta > author-notes'));
41
36
  const authors = jatsFrontParser.parseContributors([
42
37
  ...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
43
38
  ], affiliationIDs, footnoteIDs, correspondingIDs);
@@ -48,6 +43,8 @@ export const parseJATSFront = (doc, front) => {
48
43
  manuscript,
49
44
  titles,
50
45
  journal,
46
+ ...authorNotesParagraphs,
47
+ ...authorNotes,
51
48
  ...footnotes,
52
49
  ...authors,
53
50
  ...affiliations,
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ObjectTypes, } from '@manuscripts/json-schema';
16
+ import { getModelsByType, ObjectTypes, } from '@manuscripts/json-schema';
17
17
  import { CitationProvider } from '@manuscripts/library';
18
18
  import debug from 'debug';
19
- import { DOMParser, DOMSerializer } from 'prosemirror-model';
19
+ import { DOMParser as ProseMirrorDOMParser, DOMSerializer, } from 'prosemirror-model';
20
20
  import serializeToXML from 'w3c-xmlserializer';
21
21
  import { nodeFromHTML, textFromHTML } from '../lib/html';
22
22
  import { normalizeStyleName } from '../lib/styled-content';
@@ -32,7 +32,7 @@ import { selectVersionIds } from './jats-versions';
32
32
  const warn = debug('manuscripts-transform');
33
33
  const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
34
34
  const normalizeID = (id) => id.replace(/:/g, '_');
35
- const parser = DOMParser.fromSchema(schema);
35
+ const parser = ProseMirrorDOMParser.fromSchema(schema);
36
36
  const findChildNodeOfType = (node, nodeType) => {
37
37
  for (const child of iterateChildren(node)) {
38
38
  if (child.type === nodeType) {
@@ -607,6 +607,7 @@ export class JATSExporter {
607
607
  this.createSerializer = () => {
608
608
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
609
609
  const nodes = {
610
+ author_notes: () => ['author-notes', 0],
610
611
  title: () => '',
611
612
  affiliations: () => '',
612
613
  contributors: () => '',
@@ -1027,6 +1028,7 @@ export class JATSExporter {
1027
1028
  }
1028
1029
  };
1029
1030
  this.buildContributors = (articleMeta) => {
1031
+ var _a;
1030
1032
  const contributors = this.models.filter(isContributor);
1031
1033
  const authorContributors = contributors
1032
1034
  .filter((contributor) => contributor.role === 'author')
@@ -1245,56 +1247,61 @@ export class JATSExporter {
1245
1247
  }
1246
1248
  });
1247
1249
  }
1248
- const noteIDs = [];
1249
- for (const contributor of [...authorContributors, ...otherContributors]) {
1250
- if (contributor.footnote) {
1251
- const ids = contributor.footnote.map((note) => {
1252
- return note.noteID;
1253
- });
1254
- noteIDs.push(...ids);
1255
- }
1256
- if (contributor.corresp) {
1257
- const ids = contributor.corresp.map((corresp) => {
1258
- return corresp.correspID;
1259
- });
1260
- noteIDs.push(...ids);
1261
- }
1262
- }
1263
- const footnotes = [];
1264
- footnotes.push(...this.models.filter(hasObjectType(ObjectTypes.Footnote)));
1265
- const correspodings = [];
1266
- correspodings.push(...this.models.filter(hasObjectType(ObjectTypes.Corresponding)));
1267
- if (footnotes || correspodings) {
1268
- const authorNotesEl = this.document.createElement('author-notes');
1269
- const usedFootnotes = footnotes.filter((footnote) => {
1270
- return noteIDs.includes(footnote._id);
1271
- });
1272
- const usedCorrespodings = correspodings.filter((corresp) => {
1273
- return noteIDs.includes(corresp._id);
1274
- });
1275
- usedFootnotes.forEach((footnote) => {
1276
- const authorFootNote = this.document.createElement('fn');
1277
- authorFootNote.setAttribute('id', normalizeID(footnote._id));
1278
- authorFootNote.innerHTML = footnote.contents;
1279
- authorNotesEl.appendChild(authorFootNote);
1280
- });
1281
- usedCorrespodings.forEach((corresponding) => {
1282
- const correspondingEl = this.document.createElement('corresp');
1283
- correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1284
- if (corresponding.label) {
1285
- const labelEl = this.document.createElement('label');
1286
- labelEl.textContent = corresponding.label;
1287
- correspondingEl.appendChild(labelEl);
1250
+ const authorNotesEl = this.document.createElement('author-notes');
1251
+ const usedCorrespodings = this.getUsedCorrespondings([
1252
+ ...authorContributors,
1253
+ ...otherContributors,
1254
+ ]);
1255
+ usedCorrespodings.forEach((corresp) => {
1256
+ this.appendCorrespondingToElement(corresp, authorNotesEl);
1257
+ });
1258
+ const authorNotes = (_a = getModelsByType(this.modelMap, ObjectTypes.AuthorNotes)) === null || _a === void 0 ? void 0 : _a[0];
1259
+ if (authorNotes) {
1260
+ authorNotes.containedObjectIDs.forEach((id) => {
1261
+ const model = this.modelMap.get(id);
1262
+ if (!model) {
1263
+ return;
1264
+ }
1265
+ if (id.startsWith('MPParagraphElement')) {
1266
+ this.appendParagraphToElement(model, authorNotesEl);
1267
+ }
1268
+ else if (id.startsWith('MPFootnote')) {
1269
+ this.appendFootnoteToElement(model, authorNotesEl);
1288
1270
  }
1289
- correspondingEl.append(corresponding.contents);
1290
- authorNotesEl.appendChild(correspondingEl);
1291
1271
  });
1292
- if (authorNotesEl.childNodes.length > 0) {
1293
- articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1294
- }
1272
+ }
1273
+ if (authorNotesEl.childNodes.length > 0) {
1274
+ articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
1295
1275
  }
1296
1276
  }
1297
1277
  };
1278
+ this.appendCorrespondingToElement = (corresponding, element) => {
1279
+ const correspondingEl = this.document.createElement('corresp');
1280
+ correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1281
+ if (corresponding.label) {
1282
+ const labelEl = this.document.createElement('label');
1283
+ labelEl.textContent = corresponding.label;
1284
+ correspondingEl.appendChild(labelEl);
1285
+ }
1286
+ correspondingEl.append(corresponding.contents);
1287
+ element.appendChild(correspondingEl);
1288
+ };
1289
+ this.appendParagraphToElement = (paragraph, element) => {
1290
+ const parsedDoc = new DOMParser().parseFromString(paragraph.contents, 'text/html');
1291
+ const parsedParagraph = parsedDoc.body.querySelector('p');
1292
+ if (parsedParagraph) {
1293
+ const paragraphEl = this.document.createElement('p');
1294
+ paragraphEl.innerHTML = parsedParagraph.innerHTML;
1295
+ paragraphEl.setAttribute('id', normalizeID(paragraph._id));
1296
+ element.appendChild(paragraphEl);
1297
+ }
1298
+ };
1299
+ this.appendFootnoteToElement = (footnote, element) => {
1300
+ const footnoteEl = this.document.createElement('fn');
1301
+ footnoteEl.setAttribute('id', normalizeID(footnote._id));
1302
+ footnoteEl.innerHTML = footnote.contents;
1303
+ element.appendChild(footnoteEl);
1304
+ };
1298
1305
  this.fixBody = (body, fragment) => {
1299
1306
  fragment.descendants((node) => {
1300
1307
  if (node.attrs.id) {
@@ -1597,6 +1604,12 @@ export class JATSExporter {
1597
1604
  return mathml;
1598
1605
  }
1599
1606
  }
1607
+ getUsedCorrespondings(contributors) {
1608
+ return contributors
1609
+ .flatMap((c) => { var _a; return (_a = c.corresp) !== null && _a !== void 0 ? _a : []; })
1610
+ .map((corresp) => this.modelMap.get(corresp.correspID))
1611
+ .filter((corresp) => !!corresp);
1612
+ }
1600
1613
  buildKeywords(articleMeta) {
1601
1614
  const keywords = [...this.modelMap.values()].filter((model) => model.objectType === ObjectTypes.Keyword);
1602
1615
  const keywordGroups = new Map();
@@ -1668,6 +1681,9 @@ export class JATSExporter {
1668
1681
  }
1669
1682
  }
1670
1683
  }
1684
+ if (!fnGroup.hasChildNodes()) {
1685
+ fnGroup.remove();
1686
+ }
1671
1687
  }
1672
1688
  }
1673
1689
  });
@@ -19,6 +19,7 @@ import { abstracts } from './nodes/abstracts';
19
19
  import { affiliation } from './nodes/affiliation';
20
20
  import { affiliations } from './nodes/affiliations';
21
21
  import { attribution } from './nodes/attribution';
22
+ import { authorNotes } from './nodes/author_notes';
22
23
  import { backmatter } from './nodes/backmatter';
23
24
  import { bibliographyElement } from './nodes/bibliography_element';
24
25
  import { bibliographyItem } from './nodes/bibliography_item';
@@ -198,6 +199,7 @@ export const schema = new Schema({
198
199
  table_row: tableRow,
199
200
  table_col: tableCol,
200
201
  table_colgroup: tableColGroup,
202
+ table_header: tableHeader,
201
203
  text,
202
204
  toc_element: tocElement,
203
205
  toc_section: tocSection,
@@ -209,6 +211,6 @@ export const schema = new Schema({
209
211
  contributors,
210
212
  supplements,
211
213
  supplement,
212
- table_header: tableHeader,
214
+ author_notes: authorNotes,
213
215
  },
214
216
  });
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * © 2019 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
+ export const authorNotes = {
17
+ attrs: {
18
+ id: { default: '' },
19
+ dataTracked: { default: null },
20
+ },
21
+ content: '(footnote | paragraph)+',
22
+ group: 'block element',
23
+ toDOM: () => ['author-notes', 0],
24
+ };
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const contributors = {
17
- content: 'contributor*',
17
+ content: 'contributor* author_notes?',
18
18
  attrs: {
19
19
  id: { default: '' },
20
20
  },
@@ -14,8 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const link = {
17
- content: 'text*',
18
- marks: '',
17
+ content: 'inline*',
19
18
  attrs: {
20
19
  href: { default: '' },
21
20
  title: { default: '' },
@@ -102,6 +102,11 @@ export const buildFootnote = (containingObject, contents, kind = 'footnote') =>
102
102
  contents,
103
103
  kind,
104
104
  });
105
+ export const buildAuthorNotes = (containedObjectIDs) => ({
106
+ _id: generateID(ObjectTypes.AuthorNotes),
107
+ objectType: ObjectTypes.AuthorNotes,
108
+ containedObjectIDs: containedObjectIDs,
109
+ });
105
110
  export const buildFootnotesOrder = (footnotesList, containedObjectID) => ({
106
111
  _id: generateID(ObjectTypes.FootnotesOrder),
107
112
  objectType: ObjectTypes.FootnotesOrder,
@@ -122,13 +127,12 @@ export const buildSection = (priority = 0, path = []) => {
122
127
  path: path.concat(id),
123
128
  };
124
129
  };
125
- export const buildParagraph = (placeholderInnerHTML) => {
130
+ export const buildParagraph = (innerHTML = '') => {
126
131
  const _id = generateID(ObjectTypes.ParagraphElement);
127
- const element = document.createElementNS('http://www.w3.org/1999/xhtml', 'p');
132
+ const element = document.createElementNS(null, 'p');
128
133
  element.setAttribute('id', _id);
129
- element.setAttribute('class', 'MPElement');
130
- if (placeholderInnerHTML) {
131
- element.setAttribute('data-placeholder-text', placeholderInnerHTML);
134
+ if (innerHTML) {
135
+ element.innerHTML = innerHTML;
132
136
  }
133
137
  const contents = serializeToXML(element);
134
138
  return {
@@ -136,7 +140,6 @@ export const buildParagraph = (placeholderInnerHTML) => {
136
140
  objectType: ObjectTypes.ParagraphElement,
137
141
  elementType: 'p',
138
142
  contents,
139
- placeholderInnerHTML,
140
143
  };
141
144
  };
142
145
  export const buildColor = (value, priority) => ({
@@ -53,6 +53,7 @@ export const getModelsByType = (modelMap, objectType) => {
53
53
  export const sortSectionsByPriority = (a, b) => a.priority === b.priority ? 0 : Number(a.priority) - Number(b.priority);
54
54
  const getSections = (modelMap) => getModelsByType(modelMap, ObjectTypes.Section).sort(sortSectionsByPriority);
55
55
  const getAffiliations = (modelMap) => getModelsByType(modelMap, ObjectTypes.Affiliation);
56
+ const getAuthorNotes = (modelMap) => getModelsByType(modelMap, ObjectTypes.AuthorNotes);
56
57
  const getContributors = (modelMap) => getModelsByType(modelMap, ObjectTypes.Contributor);
57
58
  const getKeywordElements = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordsElement);
58
59
  const getSupplements = (modelMap) => getModelsByType(modelMap, ObjectTypes.Supplement);
@@ -82,7 +83,11 @@ export class Decoder {
82
83
  const contributors = getContributors(this.modelMap)
83
84
  .map((c) => this.decode(c))
84
85
  .filter(Boolean);
85
- return schema.nodes.contributors.createAndFill({}, contributors);
86
+ const authorNotes = getAuthorNotes(this.modelMap)
87
+ .map((authorNote) => this.decode(authorNote))
88
+ .filter(Boolean);
89
+ const content = [...contributors, ...authorNotes];
90
+ return schema.nodes.contributors.createAndFill({}, content);
86
91
  }
87
92
  createKeywordsNode() {
88
93
  const elements = getKeywordElements(this.modelMap)
@@ -480,6 +485,13 @@ export class Decoder {
480
485
  id: model._id,
481
486
  }, content);
482
487
  },
488
+ [ObjectTypes.AuthorNotes]: (data) => {
489
+ const model = data;
490
+ const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
491
+ return schema.nodes.author_notes.create({
492
+ id: model._id,
493
+ }, content);
494
+ },
483
495
  [ObjectTypes.Section]: (data) => {
484
496
  const model = data;
485
497
  const elements = [];
@@ -375,6 +375,9 @@ const encoders = {
375
375
  table_element_footer: (node) => ({
376
376
  containedObjectIDs: containedObjectIDs(node),
377
377
  }),
378
+ author_notes: (node) => ({
379
+ containedObjectIDs: containedObjectIDs(node),
380
+ }),
378
381
  footnotes_section: (node, parent, path, priority) => ({
379
382
  category: buildSectionCategory(node),
380
383
  priority: priority.value++,
@@ -58,6 +58,7 @@ export const nodeTypesMap = new Map([
58
58
  [schema.nodes.affiliations, ObjectTypes.Section],
59
59
  [schema.nodes.title, ObjectTypes.Titles],
60
60
  [schema.nodes.supplement, ObjectTypes.Supplement],
61
+ [schema.nodes.author_notes, ObjectTypes.AuthorNotes],
61
62
  ]);
62
63
  export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
63
64
  export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
@@ -63,7 +63,16 @@ export declare const jatsFrontParser: {
63
63
  affiliations: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Affiliation>[];
64
64
  affiliationIDs: Map<string, string>;
65
65
  };
66
- parseAuthorNotes(elements: Element[]): {
66
+ parseAuthorNotes(element: Element | null): {
67
+ footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
68
+ footnoteIDs: Map<string, string>;
69
+ authorNotesParagraphs: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").ParagraphElement>[];
70
+ authorNotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").AuthorNotes>[];
71
+ correspondingIDs: Map<string, string>;
72
+ correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Corresponding>[];
73
+ };
74
+ parseParagraphs(elements: Element[]): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").ParagraphElement>[];
75
+ parseFootnotes(elements: Element[]): {
67
76
  footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
68
77
  footnoteIDs: Map<string, string>;
69
78
  };
@@ -87,6 +87,10 @@ export declare class JATSExporter {
87
87
  protected serializeNode: (node: ManuscriptNode) => Node;
88
88
  private validateContributor;
89
89
  private buildContributors;
90
+ private appendCorrespondingToElement;
91
+ private getUsedCorrespondings;
92
+ private appendParagraphToElement;
93
+ private appendFootnoteToElement;
90
94
  private buildKeywords;
91
95
  private fixBody;
92
96
  private changeTag;
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * © 2019 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 { NodeSpec } from 'prosemirror-model';
17
+ import { ManuscriptNode } from '../types';
18
+ interface Attrs {
19
+ id: string;
20
+ }
21
+ export interface AuthorNotesNode extends ManuscriptNode {
22
+ attrs: Attrs;
23
+ }
24
+ export declare const authorNotes: NodeSpec;
25
+ export {};
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
17
17
  import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
18
18
  import { EditorView, NodeView } from 'prosemirror-view';
19
19
  export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
20
- export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'table_header';
20
+ export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comments' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Affiliation, Attribution, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
16
+ import { Affiliation, Attribution, AuthorNotes, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
17
17
  import { FootnotesOrderIndexList } from './footnotes-order';
18
18
  import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
19
19
  export type Build<T> = Pick<T, Exclude<keyof T, keyof ManuscriptModel>> & {
@@ -45,10 +45,11 @@ export declare const buildSupplementaryMaterial: (title: string, href: string) =
45
45
  export declare const buildComment: (target: string, contents?: string, selector?: CommentSelector, contributions?: Contribution[], annotationColor?: string) => Build<CommentAnnotation>;
46
46
  export declare const buildNote: (target: string, source: 'EMAIL' | 'EDITOR' | 'DASHBOARD', contents?: string) => Build<ManuscriptNote>;
47
47
  export declare const buildFootnote: (containingObject: string, contents: string, kind?: 'footnote' | 'endnote') => Build<Footnote>;
48
+ export declare const buildAuthorNotes: (containedObjectIDs: string[]) => Build<AuthorNotes>;
48
49
  export declare const buildFootnotesOrder: (footnotesList: FootnotesOrderIndexList, containedObjectID: string) => Build<FootnotesOrder>;
49
50
  export declare const buildCorresp: (contents: string) => Build<Corresponding>;
50
51
  export declare const buildSection: (priority?: number, path?: string[]) => Build<Section>;
51
- export declare const buildParagraph: (placeholderInnerHTML: string) => Build<ParagraphElement>;
52
+ export declare const buildParagraph: (innerHTML?: string) => Build<ParagraphElement>;
52
53
  export declare const buildColor: (value: string, priority: number) => Build<Color>;
53
54
  export declare const buildContribution: (profileID: string) => Contribution;
54
55
  export declare const buildContributorRole: (name: string) => Build<ContributorRole>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/transform",
3
3
  "description": "ProseMirror transformer for Manuscripts applications",
4
- "version": "2.1.5",
4
+ "version": "2.1.6-hotfix.1",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -29,8 +29,8 @@
29
29
  "version": "yarn build"
30
30
  },
31
31
  "dependencies": {
32
- "@manuscripts/json-schema": "^2.2.5",
33
- "@manuscripts/library": "^1.3.4",
32
+ "@manuscripts/json-schema": "^2.2.6",
33
+ "@manuscripts/library": "^1.3.5",
34
34
  "debug": "^4.3.4",
35
35
  "jszip": "^3.10.1",
36
36
  "mime": "^3.0.0",