@manuscripts/transform 2.1.1-LEAN-3377-2 → 2.1.1-LEAN-3376-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 (32) hide show
  1. package/dist/cjs/jats/importer/jats-body-transformations.js +0 -10
  2. package/dist/cjs/jats/importer/jats-front-parser.js +7 -0
  3. package/dist/cjs/jats/importer/parse-jats-article.js +6 -1
  4. package/dist/cjs/jats/jats-exporter.js +39 -41
  5. package/dist/cjs/schema/index.js +2 -0
  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/transformer/builders.js +8 -3
  9. package/dist/cjs/transformer/decode.js +30 -19
  10. package/dist/cjs/transformer/encode.js +3 -9
  11. package/dist/cjs/transformer/footnotes-order.js +4 -1
  12. package/dist/cjs/transformer/node-types.js +2 -0
  13. package/dist/es/jats/importer/jats-body-transformations.js +0 -10
  14. package/dist/es/jats/importer/jats-front-parser.js +8 -1
  15. package/dist/es/jats/importer/parse-jats-article.js +7 -2
  16. package/dist/es/jats/jats-exporter.js +39 -41
  17. package/dist/es/schema/index.js +2 -0
  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/transformer/builders.js +6 -2
  21. package/dist/es/transformer/decode.js +31 -20
  22. package/dist/es/transformer/encode.js +4 -10
  23. package/dist/es/transformer/footnotes-order.js +2 -0
  24. package/dist/es/transformer/node-types.js +2 -0
  25. package/dist/types/jats/importer/jats-body-transformations.d.ts +0 -1
  26. package/dist/types/jats/importer/jats-front-parser.d.ts +9 -6
  27. package/dist/types/jats/jats-exporter.d.ts +3 -0
  28. package/dist/types/schema/nodes/author_notes.d.ts +25 -0
  29. package/dist/types/schema/types.d.ts +1 -1
  30. package/dist/types/transformer/builders.d.ts +3 -2
  31. package/dist/types/transformer/footnotes-order.d.ts +1 -0
  32. package/package.json +3 -3
@@ -265,16 +265,6 @@ exports.jatsBodyTransformations = {
265
265
  }
266
266
  });
267
267
  },
268
- orderTableFootnote(doc, body) {
269
- const tableInlineFootnotesIds = new Set(Array.from(body.querySelectorAll('tbody > tr > td > xref[ref-type="fn"]').values()).map((inlineFootnote) => inlineFootnote.getAttribute('rid')));
270
- const fnGroups = doc.querySelectorAll('table-wrap-foot > fn-group');
271
- fnGroups.forEach((fnGroup) => {
272
- const orderedFootnotes = Array.from(fnGroup.querySelectorAll('fn')).sort((fn) => tableInlineFootnotesIds.has(fn.getAttribute('id'))
273
- ? -1
274
- : 0);
275
- fnGroup.replaceChildren(...orderedFootnotes);
276
- });
277
- },
278
268
  moveFloatsGroupToBody(doc, body, createElement) {
279
269
  const group = doc.querySelector('floats-group');
280
270
  if (group) {
@@ -189,6 +189,13 @@ exports.jatsFrontParser = {
189
189
  footnoteIDs,
190
190
  };
191
191
  },
192
+ parseAuthorNotesParagraphs(elements) {
193
+ const paragraphs = [];
194
+ elements.forEach((p) => {
195
+ paragraphs.push((0, transformer_1.buildParagraph)(p.innerHTML));
196
+ });
197
+ return paragraphs;
198
+ },
192
199
  parseCorresp(elements) {
193
200
  const correspondingIDs = new Map();
194
201
  const correspondingList = elements.map((element) => {
@@ -40,6 +40,10 @@ const parseJATSFront = (doc, front) => {
40
40
  const { correspondingList, correspondingIDs } = jats_front_parser_1.jatsFrontParser.parseCorresp([
41
41
  ...front.querySelectorAll('article-meta > author-notes > corresp'),
42
42
  ]);
43
+ const authorNotesParagraphs = jats_front_parser_1.jatsFrontParser.parseAuthorNotesParagraphs([
44
+ ...front.querySelectorAll('article-meta > author-notes > p'),
45
+ ]);
46
+ const authorNotes = (0, transformer_1.buildAuthorNotes)(Array.from(footnoteIDs.values()).concat(authorNotesParagraphs.map((p) => p._id)));
43
47
  const authors = jats_front_parser_1.jatsFrontParser.parseContributors([
44
48
  ...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
45
49
  ], affiliationIDs, footnoteIDs, correspondingIDs);
@@ -50,6 +54,8 @@ const parseJATSFront = (doc, front) => {
50
54
  manuscript,
51
55
  titles,
52
56
  journal,
57
+ ...authorNotesParagraphs,
58
+ authorNotes,
53
59
  ...footnotes,
54
60
  ...authors,
55
61
  ...affiliations,
@@ -67,7 +73,6 @@ const parseJATSBody = (doc, body, references) => {
67
73
  jats_body_transformations_1.jatsBodyTransformations.createBackmatter(doc, body, createElement);
68
74
  jats_body_transformations_1.jatsBodyTransformations.createSuppleMaterials(doc, body, createElement);
69
75
  jats_body_transformations_1.jatsBodyTransformations.createKeywords(doc, body, createElement);
70
- jats_body_transformations_1.jatsBodyTransformations.orderTableFootnote(doc, body);
71
76
  const node = jats_body_dom_parser_1.jatsBodyDOMParser.parse(body).firstChild;
72
77
  if (!node) {
73
78
  throw new Error('No content was parsed from the JATS article body');
@@ -614,6 +614,7 @@ class JATSExporter {
614
614
  this.createSerializer = () => {
615
615
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
616
616
  const nodes = {
617
+ author_notes: () => ['author-notes', 0],
617
618
  title: () => '',
618
619
  affiliations: () => '',
619
620
  contributors: () => '',
@@ -1252,49 +1253,23 @@ class JATSExporter {
1252
1253
  }
1253
1254
  });
1254
1255
  }
1255
- const noteIDs = [];
1256
- for (const contributor of [...authorContributors, ...otherContributors]) {
1257
- if (contributor.footnote) {
1258
- const ids = contributor.footnote.map((note) => {
1259
- return note.noteID;
1260
- });
1261
- noteIDs.push(...ids);
1262
- }
1263
- if (contributor.corresp) {
1264
- const ids = contributor.corresp.map((corresp) => {
1265
- return corresp.correspID;
1266
- });
1267
- noteIDs.push(...ids);
1268
- }
1269
- }
1270
- const footnotes = [];
1271
- footnotes.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Footnote)));
1272
- const correspodings = [];
1273
- correspodings.push(...this.models.filter((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Corresponding)));
1274
- if (footnotes || correspodings) {
1256
+ const authorNotes = this.models.find((0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.AuthorNotes));
1257
+ if (authorNotes) {
1275
1258
  const authorNotesEl = this.document.createElement('author-notes');
1276
- const usedFootnotes = footnotes.filter((footnote) => {
1277
- return noteIDs.includes(footnote._id);
1278
- });
1279
- const usedCorrespodings = correspodings.filter((corresp) => {
1280
- return noteIDs.includes(corresp._id);
1281
- });
1282
- usedFootnotes.forEach((footnote) => {
1283
- const authorFootNote = this.document.createElement('fn');
1284
- authorFootNote.setAttribute('id', normalizeID(footnote._id));
1285
- authorFootNote.innerHTML = footnote.contents;
1286
- authorNotesEl.appendChild(authorFootNote);
1287
- });
1288
- usedCorrespodings.forEach((corresponding) => {
1289
- const correspondingEl = this.document.createElement('corresp');
1290
- correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1291
- if (corresponding.label) {
1292
- const labelEl = this.document.createElement('label');
1293
- labelEl.textContent = corresponding.label;
1294
- correspondingEl.appendChild(labelEl);
1259
+ authorNotes.containedObjectIDs.forEach((id) => {
1260
+ const model = this.modelMap.get(id);
1261
+ if (!model) {
1262
+ return;
1263
+ }
1264
+ if (id.startsWith('MPParagraphElement')) {
1265
+ this.appendParagraphToElement(model, authorNotesEl);
1266
+ }
1267
+ else if (id.startsWith('MPCorresponding')) {
1268
+ this.appendCorrespondingToElement(model, authorNotesEl);
1269
+ }
1270
+ else if (id.startsWith('MPFootnote')) {
1271
+ this.appendFootnoteToElement(model, authorNotesEl);
1295
1272
  }
1296
- correspondingEl.append(corresponding.contents);
1297
- authorNotesEl.appendChild(correspondingEl);
1298
1273
  });
1299
1274
  if (authorNotesEl.childNodes.length > 0) {
1300
1275
  articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
@@ -1302,6 +1277,29 @@ class JATSExporter {
1302
1277
  }
1303
1278
  }
1304
1279
  };
1280
+ this.appendParagraphToElement = (paragraph, element) => {
1281
+ const paragraphEl = this.document.createElement('p');
1282
+ paragraphEl.setAttribute('id', normalizeID(paragraph._id));
1283
+ paragraphEl.innerHTML = paragraph.contents;
1284
+ element.appendChild(paragraphEl);
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.appendFootnoteToElement = (footnote, element) => {
1298
+ const footnoteEl = this.document.createElement('fn');
1299
+ footnoteEl.setAttribute('id', normalizeID(footnote._id));
1300
+ footnoteEl.innerHTML = footnote.contents;
1301
+ element.appendChild(footnoteEl);
1302
+ };
1305
1303
  this.fixBody = (body, fragment) => {
1306
1304
  fragment.descendants((node) => {
1307
1305
  if (node.attrs.id) {
@@ -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");
@@ -230,5 +231,6 @@ exports.schema = new prosemirror_model_1.Schema({
230
231
  contributors: contributors_1.contributors,
231
232
  supplements: supplements_1.supplements,
232
233
  supplement: supplement_1.supplement,
234
+ author_notes: author_notes_1.authorNotes,
233
235
  },
234
236
  });
@@ -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
  },
@@ -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.buildInlineMathFragment = 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.buildInlineMathFragment = 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");
@@ -130,11 +130,16 @@ const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
130
130
  kind,
131
131
  });
132
132
  exports.buildFootnote = buildFootnote;
133
- const buildFootnotesOrder = (footnotesList, containedObjectID) => ({
133
+ const buildAuthorNotes = (containedObjectIDs) => ({
134
+ _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.AuthorNotes),
135
+ objectType: json_schema_1.ObjectTypes.AuthorNotes,
136
+ containedObjectIDs: containedObjectIDs,
137
+ });
138
+ exports.buildAuthorNotes = buildAuthorNotes;
139
+ const buildFootnotesOrder = (footnotesList) => ({
134
140
  _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.FootnotesOrder),
135
141
  objectType: json_schema_1.ObjectTypes.FootnotesOrder,
136
142
  footnotesList,
137
- containedObjectID,
138
143
  });
139
144
  exports.buildFootnotesOrder = buildFootnotesOrder;
140
145
  const buildCorresp = (contents) => ({
@@ -62,12 +62,14 @@ 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);
68
69
  const getKeywordGroups = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordGroup);
69
70
  const getKeywords = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Keyword);
70
71
  const getTitles = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Titles)[0];
72
+ const isFootnote = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Footnote);
71
73
  const hasParentSection = (id) => (section) => section.path &&
72
74
  section.path.length > 1 &&
73
75
  section.path[section.path.length - 2] === id;
@@ -91,7 +93,11 @@ class Decoder {
91
93
  const contributors = getContributors(this.modelMap)
92
94
  .map((c) => this.decode(c))
93
95
  .filter(Boolean);
94
- return schema_1.schema.nodes.contributors.createAndFill({}, contributors);
96
+ const authorNotes = getAuthorNotes(this.modelMap)
97
+ .map((authorNote) => this.decode(authorNote))
98
+ .filter(Boolean);
99
+ const content = [...contributors, ...authorNotes];
100
+ return schema_1.schema.nodes.contributors.createAndFill({}, content);
95
101
  }
96
102
  createKeywordsNode() {
97
103
  const elements = getKeywordElements(this.modelMap)
@@ -310,25 +316,23 @@ class Decoder {
310
316
  },
311
317
  [json_schema_1.ObjectTypes.FootnotesElement]: (data) => {
312
318
  const foonotesElementModel = data;
319
+ const collateByKind = foonotesElementModel.collateByKind || 'footnote';
313
320
  const footnotesOfKind = [];
314
- const footnoteOrder = (0, exports.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.FootnotesOrder).find((model) => model.containedObjectID === data._id);
315
- if (footnoteOrder) {
316
- footnoteOrder.footnotesList.map(({ id }) => {
317
- const model = this.modelMap.get(id);
318
- const collateByKind = foonotesElementModel.collateByKind || 'footnote';
319
- if (model.kind === collateByKind) {
320
- const comments = this.createCommentNodes(model);
321
- comments.forEach((c) => this.comments.set(c.attrs.id, c));
322
- const footnote = this.parseContents(model.contents || '<div></div>', undefined, this.getComments(model), {
323
- topNode: schema_1.schema.nodes.footnote.create({
324
- id: model._id,
325
- kind: model.kind,
326
- comments: comments.map((c) => c.attrs.id),
327
- }),
328
- });
329
- footnotesOfKind.push(footnote);
330
- }
331
- });
321
+ for (const model of this.modelMap.values()) {
322
+ if (isFootnote(model) &&
323
+ model.kind === collateByKind &&
324
+ model.containingObject === foonotesElementModel._id) {
325
+ const comments = this.createCommentNodes(model);
326
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
327
+ const footnote = this.parseContents(model.contents || '<div></div>', undefined, this.getComments(model), {
328
+ topNode: schema_1.schema.nodes.footnote.create({
329
+ id: model._id,
330
+ kind: model.kind,
331
+ comments: comments.map((c) => c.attrs.id),
332
+ }),
333
+ });
334
+ footnotesOfKind.push(footnote);
335
+ }
332
336
  }
333
337
  return schema_1.schema.nodes.footnotes_element.create({
334
338
  id: foonotesElementModel._id,
@@ -492,6 +496,13 @@ class Decoder {
492
496
  id: model._id,
493
497
  }, content);
494
498
  },
499
+ [json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
500
+ const model = data;
501
+ const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
502
+ return schema_1.schema.nodes.author_notes.create({
503
+ id: model._id,
504
+ }, content);
505
+ },
495
506
  [json_schema_1.ObjectTypes.Section]: (data) => {
496
507
  const model = data;
497
508
  const elements = [];
@@ -395,6 +395,9 @@ const encoders = {
395
395
  table_element_footer: (node) => ({
396
396
  containedObjectIDs: containedObjectIDs(node),
397
397
  }),
398
+ author_notes: (node) => ({
399
+ containedObjectIDs: containedObjectIDs(node),
400
+ }),
398
401
  footnotes_section: (node, parent, path, priority) => ({
399
402
  category: (0, section_category_1.buildSectionCategory)(node),
400
403
  priority: priority.value++,
@@ -596,9 +599,6 @@ const encode = (node) => {
596
599
  child.type !== schema_1.schema.nodes.inline_equation) {
597
600
  return;
598
601
  }
599
- if (child.type === schema_1.schema.nodes.footnotes_element) {
600
- addFootnotesOrderModel(child, models);
601
- }
602
602
  const { model, markers } = (0, exports.modelFromNode)(child, parent, path, priority);
603
603
  markers.forEach((marker) => {
604
604
  const comment = models.get(marker._id);
@@ -650,9 +650,3 @@ const generateElementOrder = (node, nodeType) => {
650
650
  order.elements = ids;
651
651
  return order;
652
652
  };
653
- const addFootnotesOrderModel = (child, models) => {
654
- const footnoteList = [];
655
- child.forEach((footnote, _, index) => footnoteList.push({ id: footnote.attrs.id, index }));
656
- const footnotesOrder = (0, builders_1.buildFootnotesOrder)(footnoteList, child.attrs.id);
657
- models.set(footnotesOrder._id, footnotesOrder);
658
- };
@@ -15,7 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.handleFootnotesOrder = exports.createOrderedFootnotesIDs = void 0;
18
+ exports.createEmptyFootnotesOrder = exports.handleFootnotesOrder = exports.createOrderedFootnotesIDs = void 0;
19
+ const builders_1 = require("./builders");
19
20
  const createOrderedFootnotesIDs = (doc) => {
20
21
  const footnotesRefs = [...doc.querySelectorAll('xref[ref-type="fn"][rid]')];
21
22
  const footnotes = [...doc.querySelectorAll('fn:not([fn-type])')];
@@ -58,3 +59,5 @@ const handleFootnotesOrder = (orderedFootnotesIDs, replacements, footnotesOrder)
58
59
  footnotesOrder.footnotesList = footnotesList;
59
60
  };
60
61
  exports.handleFootnotesOrder = handleFootnotesOrder;
62
+ const createEmptyFootnotesOrder = () => (0, builders_1.buildFootnotesOrder)([]);
63
+ exports.createEmptyFootnotesOrder = createEmptyFootnotesOrder;
@@ -62,6 +62,8 @@ exports.nodeTypesMap = new Map([
62
62
  [schema_1.schema.nodes.affiliations, json_schema_1.ObjectTypes.Section],
63
63
  [schema_1.schema.nodes.title, json_schema_1.ObjectTypes.Titles],
64
64
  [schema_1.schema.nodes.supplement, json_schema_1.ObjectTypes.Supplement],
65
+ [schema_1.schema.nodes.author_notes, json_schema_1.ObjectTypes.AuthorNotes],
66
+ [schema_1.schema.nodes.corresp, json_schema_1.ObjectTypes.Corresponding],
65
67
  ]);
66
68
  const isExecutableNodeType = (type) => (0, schema_1.hasGroup)(type, schema_1.GROUP_EXECUTABLE);
67
69
  exports.isExecutableNodeType = isExecutableNodeType;
@@ -262,16 +262,6 @@ export const jatsBodyTransformations = {
262
262
  }
263
263
  });
264
264
  },
265
- orderTableFootnote(doc, body) {
266
- const tableInlineFootnotesIds = new Set(Array.from(body.querySelectorAll('tbody > tr > td > xref[ref-type="fn"]').values()).map((inlineFootnote) => inlineFootnote.getAttribute('rid')));
267
- const fnGroups = doc.querySelectorAll('table-wrap-foot > fn-group');
268
- fnGroups.forEach((fnGroup) => {
269
- const orderedFootnotes = Array.from(fnGroup.querySelectorAll('fn')).sort((fn) => tableInlineFootnotesIds.has(fn.getAttribute('id'))
270
- ? -1
271
- : 0);
272
- fnGroup.replaceChildren(...orderedFootnotes);
273
- });
274
- },
275
265
  moveFloatsGroupToBody(doc, body, createElement) {
276
266
  const group = doc.querySelector('floats-group');
277
267
  if (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, 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');
@@ -183,6 +183,13 @@ export const jatsFrontParser = {
183
183
  footnoteIDs,
184
184
  };
185
185
  },
186
+ parseAuthorNotesParagraphs(elements) {
187
+ const paragraphs = [];
188
+ elements.forEach((p) => {
189
+ paragraphs.push(buildParagraph(p.innerHTML));
190
+ });
191
+ return paragraphs;
192
+ },
186
193
  parseCorresp(elements) {
187
194
  const correspondingIDs = new Map();
188
195
  const correspondingList = elements.map((element) => {
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { InvalidInput } from '../../errors';
17
- import { buildBibliographyElement, buildSection, encode, } from '../../transformer';
17
+ import { buildAuthorNotes, buildBibliographyElement, buildSection, encode, } from '../../transformer';
18
18
  import { buildManuscript } from '../../transformer/builders';
19
19
  import { generateID } from '../../transformer/id';
20
20
  import { findManuscript } from '../../transformer/project-bundle';
@@ -37,6 +37,10 @@ export const parseJATSFront = (doc, front) => {
37
37
  const { correspondingList, correspondingIDs } = jatsFrontParser.parseCorresp([
38
38
  ...front.querySelectorAll('article-meta > author-notes > corresp'),
39
39
  ]);
40
+ const authorNotesParagraphs = jatsFrontParser.parseAuthorNotesParagraphs([
41
+ ...front.querySelectorAll('article-meta > author-notes > p'),
42
+ ]);
43
+ const authorNotes = buildAuthorNotes(Array.from(footnoteIDs.values()).concat(authorNotesParagraphs.map((p) => p._id)));
40
44
  const authors = jatsFrontParser.parseContributors([
41
45
  ...front.querySelectorAll('article-meta > contrib-group > contrib[contrib-type="author"]'),
42
46
  ], affiliationIDs, footnoteIDs, correspondingIDs);
@@ -47,6 +51,8 @@ export const parseJATSFront = (doc, front) => {
47
51
  manuscript,
48
52
  titles,
49
53
  journal,
54
+ ...authorNotesParagraphs,
55
+ authorNotes,
50
56
  ...footnotes,
51
57
  ...authors,
52
58
  ...affiliations,
@@ -63,7 +69,6 @@ export const parseJATSBody = (doc, body, references) => {
63
69
  jatsBodyTransformations.createBackmatter(doc, body, createElement);
64
70
  jatsBodyTransformations.createSuppleMaterials(doc, body, createElement);
65
71
  jatsBodyTransformations.createKeywords(doc, body, createElement);
66
- jatsBodyTransformations.orderTableFootnote(doc, body);
67
72
  const node = jatsBodyDOMParser.parse(body).firstChild;
68
73
  if (!node) {
69
74
  throw new Error('No content was parsed from the JATS article body');
@@ -606,6 +606,7 @@ export class JATSExporter {
606
606
  this.createSerializer = () => {
607
607
  const getModel = (id) => id ? this.modelMap.get(id) : undefined;
608
608
  const nodes = {
609
+ author_notes: () => ['author-notes', 0],
609
610
  title: () => '',
610
611
  affiliations: () => '',
611
612
  contributors: () => '',
@@ -1244,49 +1245,23 @@ export class JATSExporter {
1244
1245
  }
1245
1246
  });
1246
1247
  }
1247
- const noteIDs = [];
1248
- for (const contributor of [...authorContributors, ...otherContributors]) {
1249
- if (contributor.footnote) {
1250
- const ids = contributor.footnote.map((note) => {
1251
- return note.noteID;
1252
- });
1253
- noteIDs.push(...ids);
1254
- }
1255
- if (contributor.corresp) {
1256
- const ids = contributor.corresp.map((corresp) => {
1257
- return corresp.correspID;
1258
- });
1259
- noteIDs.push(...ids);
1260
- }
1261
- }
1262
- const footnotes = [];
1263
- footnotes.push(...this.models.filter(hasObjectType(ObjectTypes.Footnote)));
1264
- const correspodings = [];
1265
- correspodings.push(...this.models.filter(hasObjectType(ObjectTypes.Corresponding)));
1266
- if (footnotes || correspodings) {
1248
+ const authorNotes = this.models.find(hasObjectType(ObjectTypes.AuthorNotes));
1249
+ if (authorNotes) {
1267
1250
  const authorNotesEl = this.document.createElement('author-notes');
1268
- const usedFootnotes = footnotes.filter((footnote) => {
1269
- return noteIDs.includes(footnote._id);
1270
- });
1271
- const usedCorrespodings = correspodings.filter((corresp) => {
1272
- return noteIDs.includes(corresp._id);
1273
- });
1274
- usedFootnotes.forEach((footnote) => {
1275
- const authorFootNote = this.document.createElement('fn');
1276
- authorFootNote.setAttribute('id', normalizeID(footnote._id));
1277
- authorFootNote.innerHTML = footnote.contents;
1278
- authorNotesEl.appendChild(authorFootNote);
1279
- });
1280
- usedCorrespodings.forEach((corresponding) => {
1281
- const correspondingEl = this.document.createElement('corresp');
1282
- correspondingEl.setAttribute('id', normalizeID(corresponding._id));
1283
- if (corresponding.label) {
1284
- const labelEl = this.document.createElement('label');
1285
- labelEl.textContent = corresponding.label;
1286
- correspondingEl.appendChild(labelEl);
1251
+ authorNotes.containedObjectIDs.forEach((id) => {
1252
+ const model = this.modelMap.get(id);
1253
+ if (!model) {
1254
+ return;
1255
+ }
1256
+ if (id.startsWith('MPParagraphElement')) {
1257
+ this.appendParagraphToElement(model, authorNotesEl);
1258
+ }
1259
+ else if (id.startsWith('MPCorresponding')) {
1260
+ this.appendCorrespondingToElement(model, authorNotesEl);
1261
+ }
1262
+ else if (id.startsWith('MPFootnote')) {
1263
+ this.appendFootnoteToElement(model, authorNotesEl);
1287
1264
  }
1288
- correspondingEl.append(corresponding.contents);
1289
- authorNotesEl.appendChild(correspondingEl);
1290
1265
  });
1291
1266
  if (authorNotesEl.childNodes.length > 0) {
1292
1267
  articleMeta.insertBefore(authorNotesEl, contribGroup.nextSibling);
@@ -1294,6 +1269,29 @@ export class JATSExporter {
1294
1269
  }
1295
1270
  }
1296
1271
  };
1272
+ this.appendParagraphToElement = (paragraph, element) => {
1273
+ const paragraphEl = this.document.createElement('p');
1274
+ paragraphEl.setAttribute('id', normalizeID(paragraph._id));
1275
+ paragraphEl.innerHTML = paragraph.contents;
1276
+ element.appendChild(paragraphEl);
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.appendFootnoteToElement = (footnote, element) => {
1290
+ const footnoteEl = this.document.createElement('fn');
1291
+ footnoteEl.setAttribute('id', normalizeID(footnote._id));
1292
+ footnoteEl.innerHTML = footnote.contents;
1293
+ element.appendChild(footnoteEl);
1294
+ };
1297
1295
  this.fixBody = (body, fragment) => {
1298
1296
  fragment.descendants((node) => {
1299
1297
  if (node.attrs.id) {
@@ -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';
@@ -213,5 +214,6 @@ export const schema = new Schema({
213
214
  contributors,
214
215
  supplements,
215
216
  supplement,
217
+ author_notes: authorNotes,
216
218
  },
217
219
  });
@@ -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
  },
@@ -108,11 +108,15 @@ export const buildFootnote = (containingObject, contents, kind = 'footnote') =>
108
108
  contents,
109
109
  kind,
110
110
  });
111
- export const buildFootnotesOrder = (footnotesList, containedObjectID) => ({
111
+ export const buildAuthorNotes = (containedObjectIDs) => ({
112
+ _id: generateID(ObjectTypes.AuthorNotes),
113
+ objectType: ObjectTypes.AuthorNotes,
114
+ containedObjectIDs: containedObjectIDs,
115
+ });
116
+ export const buildFootnotesOrder = (footnotesList) => ({
112
117
  _id: generateID(ObjectTypes.FootnotesOrder),
113
118
  objectType: ObjectTypes.FootnotesOrder,
114
119
  footnotesList,
115
- containedObjectID,
116
120
  });
117
121
  export const buildCorresp = (contents) => ({
118
122
  _id: generateID(ObjectTypes.Corresponding),
@@ -32,7 +32,7 @@ import { abstractsType, backmatterType, bodyType, } from '../lib/section-group-t
32
32
  import { schema, } from '../schema';
33
33
  import { buildTitles } from './builders';
34
34
  import { insertHighlightMarkers } from './highlight-markers';
35
- import { ExtraObjectTypes, isCommentAnnotation, isManuscript, } from './object-types';
35
+ import { ExtraObjectTypes, hasObjectType, isCommentAnnotation, isManuscript, } from './object-types';
36
36
  import { chooseSectionLableName, chooseSectionNodeType, chooseSecType, getSectionGroupType, guessSectionCategory, } from './section-category';
37
37
  import { timestamp } from './timestamp';
38
38
  const warn = debug('manuscripts-transform');
@@ -53,12 +53,14 @@ 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);
59
60
  const getKeywordGroups = (modelMap) => getModelsByType(modelMap, ObjectTypes.KeywordGroup);
60
61
  const getKeywords = (modelMap) => getModelsByType(modelMap, ObjectTypes.Keyword);
61
62
  const getTitles = (modelMap) => getModelsByType(modelMap, ObjectTypes.Titles)[0];
63
+ const isFootnote = hasObjectType(ObjectTypes.Footnote);
62
64
  const hasParentSection = (id) => (section) => section.path &&
63
65
  section.path.length > 1 &&
64
66
  section.path[section.path.length - 2] === id;
@@ -82,7 +84,11 @@ export class Decoder {
82
84
  const contributors = getContributors(this.modelMap)
83
85
  .map((c) => this.decode(c))
84
86
  .filter(Boolean);
85
- return schema.nodes.contributors.createAndFill({}, contributors);
87
+ const authorNotes = getAuthorNotes(this.modelMap)
88
+ .map((authorNote) => this.decode(authorNote))
89
+ .filter(Boolean);
90
+ const content = [...contributors, ...authorNotes];
91
+ return schema.nodes.contributors.createAndFill({}, content);
86
92
  }
87
93
  createKeywordsNode() {
88
94
  const elements = getKeywordElements(this.modelMap)
@@ -301,25 +307,23 @@ export class Decoder {
301
307
  },
302
308
  [ObjectTypes.FootnotesElement]: (data) => {
303
309
  const foonotesElementModel = data;
310
+ const collateByKind = foonotesElementModel.collateByKind || 'footnote';
304
311
  const footnotesOfKind = [];
305
- const footnoteOrder = getModelsByType(this.modelMap, ObjectTypes.FootnotesOrder).find((model) => model.containedObjectID === data._id);
306
- if (footnoteOrder) {
307
- footnoteOrder.footnotesList.map(({ id }) => {
308
- const model = this.modelMap.get(id);
309
- const collateByKind = foonotesElementModel.collateByKind || 'footnote';
310
- if (model.kind === collateByKind) {
311
- const comments = this.createCommentNodes(model);
312
- comments.forEach((c) => this.comments.set(c.attrs.id, c));
313
- const footnote = this.parseContents(model.contents || '<div></div>', undefined, this.getComments(model), {
314
- topNode: schema.nodes.footnote.create({
315
- id: model._id,
316
- kind: model.kind,
317
- comments: comments.map((c) => c.attrs.id),
318
- }),
319
- });
320
- footnotesOfKind.push(footnote);
321
- }
322
- });
312
+ for (const model of this.modelMap.values()) {
313
+ if (isFootnote(model) &&
314
+ model.kind === collateByKind &&
315
+ model.containingObject === foonotesElementModel._id) {
316
+ const comments = this.createCommentNodes(model);
317
+ comments.forEach((c) => this.comments.set(c.attrs.id, c));
318
+ const footnote = this.parseContents(model.contents || '<div></div>', undefined, this.getComments(model), {
319
+ topNode: schema.nodes.footnote.create({
320
+ id: model._id,
321
+ kind: model.kind,
322
+ comments: comments.map((c) => c.attrs.id),
323
+ }),
324
+ });
325
+ footnotesOfKind.push(footnote);
326
+ }
323
327
  }
324
328
  return schema.nodes.footnotes_element.create({
325
329
  id: foonotesElementModel._id,
@@ -483,6 +487,13 @@ export class Decoder {
483
487
  id: model._id,
484
488
  }, content);
485
489
  },
490
+ [ObjectTypes.AuthorNotes]: (data) => {
491
+ const model = data;
492
+ const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
493
+ return schema.nodes.author_notes.create({
494
+ id: model._id,
495
+ }, content);
496
+ },
486
497
  [ObjectTypes.Section]: (data) => {
487
498
  const model = data;
488
499
  const elements = [];
@@ -17,7 +17,7 @@ import { DOMSerializer } from 'prosemirror-model';
17
17
  import serializeToXML from 'w3c-xmlserializer';
18
18
  import { iterateChildren } from '../lib/utils';
19
19
  import { hasGroup, isHighlightMarkerNode, isManuscriptNode, isSectionNode, schema, } from '../schema';
20
- import { auxiliaryObjectTypes, buildAttribution, buildElementsOrder, buildFootnotesOrder, } from './builders';
20
+ import { auxiliaryObjectTypes, buildAttribution, buildElementsOrder, } from './builders';
21
21
  import { extractCommentMarkers } from './highlight-markers';
22
22
  import { nodeTypesMap } from './node-types';
23
23
  import { buildSectionCategory } from './section-category';
@@ -387,6 +387,9 @@ const encoders = {
387
387
  table_element_footer: (node) => ({
388
388
  containedObjectIDs: containedObjectIDs(node),
389
389
  }),
390
+ author_notes: (node) => ({
391
+ containedObjectIDs: containedObjectIDs(node),
392
+ }),
390
393
  footnotes_section: (node, parent, path, priority) => ({
391
394
  category: buildSectionCategory(node),
392
395
  priority: priority.value++,
@@ -587,9 +590,6 @@ export const encode = (node) => {
587
590
  child.type !== schema.nodes.inline_equation) {
588
591
  return;
589
592
  }
590
- if (child.type === schema.nodes.footnotes_element) {
591
- addFootnotesOrderModel(child, models);
592
- }
593
593
  const { model, markers } = modelFromNode(child, parent, path, priority);
594
594
  markers.forEach((marker) => {
595
595
  const comment = models.get(marker._id);
@@ -640,9 +640,3 @@ const generateElementOrder = (node, nodeType) => {
640
640
  order.elements = ids;
641
641
  return order;
642
642
  };
643
- const addFootnotesOrderModel = (child, models) => {
644
- const footnoteList = [];
645
- child.forEach((footnote, _, index) => footnoteList.push({ id: footnote.attrs.id, index }));
646
- const footnotesOrder = buildFootnotesOrder(footnoteList, child.attrs.id);
647
- models.set(footnotesOrder._id, footnotesOrder);
648
- };
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { buildFootnotesOrder } from './builders';
16
17
  export const createOrderedFootnotesIDs = (doc) => {
17
18
  const footnotesRefs = [...doc.querySelectorAll('xref[ref-type="fn"][rid]')];
18
19
  const footnotes = [...doc.querySelectorAll('fn:not([fn-type])')];
@@ -53,3 +54,4 @@ export const handleFootnotesOrder = (orderedFootnotesIDs, replacements, footnote
53
54
  });
54
55
  footnotesOrder.footnotesList = footnotesList;
55
56
  };
57
+ export const createEmptyFootnotesOrder = () => buildFootnotesOrder([]);
@@ -59,6 +59,8 @@ export const nodeTypesMap = new Map([
59
59
  [schema.nodes.affiliations, ObjectTypes.Section],
60
60
  [schema.nodes.title, ObjectTypes.Titles],
61
61
  [schema.nodes.supplement, ObjectTypes.Supplement],
62
+ [schema.nodes.author_notes, ObjectTypes.AuthorNotes],
63
+ [schema.nodes.corresp, ObjectTypes.Corresponding],
62
64
  ]);
63
65
  export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
64
66
  export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
@@ -32,7 +32,6 @@ export declare const jatsBodyTransformations: {
32
32
  moveFootnotes(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
33
33
  moveCaptionsToEnd(body: Element): void;
34
34
  fixTables(body: Element, createElement: (tagName: string) => HTMLElement): void;
35
- orderTableFootnote(doc: Document, body: Element): void;
36
35
  moveFloatsGroupToBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
37
36
  createKeywords(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
38
37
  createSuppleMaterials(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
@@ -13,8 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { ParagraphElement } from '@manuscripts/json-schema';
17
+ import { Build } from '../../transformer';
16
18
  export declare const jatsFrontParser: {
17
- parseTitles(element: Element | null, createElement: (tagName: string) => HTMLElement): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Titles>;
19
+ parseTitles(element: Element | null, createElement: (tagName: string) => HTMLElement): Build<import("@manuscripts/json-schema").Titles>;
18
20
  parseCounts(counts: Element | null): {
19
21
  wordCount: number | undefined;
20
22
  figureCount: number | undefined;
@@ -48,7 +50,7 @@ export declare const jatsFrontParser: {
48
50
  publisherName: string | undefined;
49
51
  _id: string;
50
52
  objectType: string;
51
- contributions?: import("@manuscripts/json-schema/dist/types").Contribution[] | undefined;
53
+ contributions?: import("@manuscripts/json-schema").Contribution[] | undefined;
52
54
  };
53
55
  parseDates(historyNode: Element | null): {
54
56
  acceptanceDate?: number | undefined;
@@ -59,16 +61,17 @@ export declare const jatsFrontParser: {
59
61
  receiveDate?: number | undefined;
60
62
  } | undefined;
61
63
  parseAffiliations(elements: Element[]): {
62
- affiliations: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Affiliation>[];
64
+ affiliations: Build<import("@manuscripts/json-schema").Affiliation>[];
63
65
  affiliationIDs: Map<string, string>;
64
66
  };
65
67
  parseAuthorNotes(elements: Element[]): {
66
- footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
68
+ footnotes: Build<import("@manuscripts/json-schema").Footnote>[];
67
69
  footnoteIDs: Map<string, string>;
68
70
  };
71
+ parseAuthorNotesParagraphs(elements: Element[]): Build<ParagraphElement>[];
69
72
  parseCorresp(elements: Element[]): {
70
- correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Corresponding>[];
73
+ correspondingList: Build<import("@manuscripts/json-schema").Corresponding>[];
71
74
  correspondingIDs: Map<string, string>;
72
75
  };
73
- parseContributors(elements: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Contributor>[];
76
+ parseContributors(elements: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): Build<import("@manuscripts/json-schema").Contributor>[];
74
77
  };
@@ -86,6 +86,9 @@ export declare class JATSExporter {
86
86
  protected serializeNode: (node: ManuscriptNode) => Node;
87
87
  private validateContributor;
88
88
  private buildContributors;
89
+ private appendParagraphToElement;
90
+ private appendCorrespondingToElement;
91
+ private appendFootnoteToElement;
89
92
  private buildKeywords;
90
93
  private fixBody;
91
94
  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_body' | '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';
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_body' | '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' | '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, InlineMathFragment, 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, InlineMathFragment, 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>> & {
@@ -46,7 +46,8 @@ export declare const buildComment: (target: string, contents?: string, selector?
46
46
  export declare const buildNote: (target: string, source: 'EMAIL' | 'EDITOR' | 'DASHBOARD', contents?: string) => Build<ManuscriptNote>;
47
47
  export declare const buildInlineMathFragment: (containingObject: string, TeXRepresentation: string) => Build<InlineMathFragment>;
48
48
  export declare const buildFootnote: (containingObject: string, contents: string, kind?: 'footnote' | 'endnote') => Build<Footnote>;
49
- export declare const buildFootnotesOrder: (footnotesList: FootnotesOrderIndexList, containedObjectID: string) => Build<FootnotesOrder>;
49
+ export declare const buildAuthorNotes: (containedObjectIDs: string[]) => Build<AuthorNotes>;
50
+ export declare const buildFootnotesOrder: (footnotesList: FootnotesOrderIndexList) => Build<FootnotesOrder>;
50
51
  export declare const buildCorresp: (contents: string) => Build<Corresponding>;
51
52
  export declare const buildSection: (priority?: number, path?: string[]) => Build<Section>;
52
53
  export declare const buildParagraph: (placeholderInnerHTML: string) => Build<ParagraphElement>;
@@ -20,3 +20,4 @@ export type FootnotesOrderIndexList = {
20
20
  }[];
21
21
  export declare const createOrderedFootnotesIDs: (doc: Document) => string[];
22
22
  export declare const handleFootnotesOrder: (orderedFootnotesIDs: Array<string>, replacements: Map<string, string>, footnotesOrder: FootnotesOrder) => void;
23
+ export declare const createEmptyFootnotesOrder: () => import("./builders").Build<FootnotesOrder>;
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.1-LEAN-3377-2",
4
+ "version": "2.1.1-LEAN-3376-0",
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.3-LEAN-3377-0",
33
- "@manuscripts/library": "1.3.2-LEAN-3377-0",
32
+ "@manuscripts/json-schema": "2.2.3-LEAN-3376-2",
33
+ "@manuscripts/library": "1.3.2-LEAN-3376-1",
34
34
  "debug": "^4.3.4",
35
35
  "jszip": "^3.10.1",
36
36
  "mathjax-full": "^3.2.2",