@manuscripts/transform 2.3.38-LEAN-3911.0 → 2.6.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 (126) hide show
  1. package/dist/cjs/__tests__/data/project-dump.json +825 -0
  2. package/dist/cjs/index.js +6 -6
  3. package/dist/cjs/jats/importer/index.js +22 -0
  4. package/dist/cjs/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +34 -273
  5. package/dist/cjs/jats/importer/jats-body-transformations.js +22 -74
  6. package/dist/cjs/jats/importer/jats-comments.js +104 -27
  7. package/dist/cjs/jats/importer/jats-front-parser.js +321 -0
  8. package/dist/cjs/jats/importer/jats-journal-meta-parser.js +1 -8
  9. package/dist/cjs/jats/importer/jats-parser-utils.js +5 -43
  10. package/dist/cjs/jats/importer/jats-reference-parser.js +23 -16
  11. package/dist/cjs/jats/importer/jats-references.js +18 -18
  12. package/dist/cjs/jats/importer/parse-jats-article.js +79 -40
  13. package/dist/cjs/jats/index.js +7 -7
  14. package/dist/cjs/jats/{exporter/jats-exporter.js → jats-exporter.js} +398 -264
  15. package/dist/cjs/jats/{exporter/jats-versions.js → jats-versions.js} +3 -1
  16. package/dist/cjs/lib/utils.js +1 -12
  17. package/dist/cjs/transformer/__tests__/__helpers__/doc.js +37 -0
  18. package/dist/cjs/transformer/builders.js +219 -0
  19. package/dist/cjs/transformer/decode.js +898 -0
  20. package/dist/cjs/transformer/document-object-types.js +31 -0
  21. package/dist/cjs/transformer/encode.js +674 -0
  22. package/dist/cjs/{jats/importer/create-article-node.js → transformer/filename.js} +9 -10
  23. package/dist/cjs/transformer/footnote-category.js +20 -0
  24. package/dist/cjs/transformer/footnotes-order.js +60 -0
  25. package/dist/cjs/transformer/highlight-markers.js +138 -0
  26. package/dist/cjs/transformer/html.js +400 -0
  27. package/dist/cjs/transformer/id.js +5 -10
  28. package/dist/cjs/transformer/index.js +18 -0
  29. package/dist/cjs/{jats/exporter → transformer}/labels.js +5 -4
  30. package/dist/cjs/transformer/manuscript-dependencies.js +21 -0
  31. package/dist/cjs/transformer/model-map.js +26 -0
  32. package/dist/cjs/{lib/deafults.js → transformer/models.js} +1 -3
  33. package/dist/cjs/transformer/node-names.js +1 -0
  34. package/dist/cjs/transformer/object-types.js +57 -0
  35. package/dist/cjs/transformer/project-bundle.js +94 -0
  36. package/dist/cjs/transformer/serializer.js +23 -0
  37. package/dist/cjs/transformer/timestamp.js +20 -0
  38. package/dist/cjs/transformer/update-identifiers.js +93 -0
  39. package/dist/cjs/version.js +1 -1
  40. package/dist/es/__tests__/data/project-dump.json +825 -0
  41. package/dist/es/index.js +5 -5
  42. package/dist/{types/jats/importer/create-article-node.d.ts → es/jats/importer/index.js} +2 -3
  43. package/dist/es/jats/importer/{jats-dom-parser.js → jats-body-dom-parser.js} +35 -274
  44. package/dist/es/jats/importer/jats-body-transformations.js +22 -74
  45. package/dist/es/jats/importer/jats-comments.js +101 -26
  46. package/dist/es/jats/importer/jats-front-parser.js +315 -0
  47. package/dist/es/jats/importer/jats-journal-meta-parser.js +0 -6
  48. package/dist/es/jats/importer/jats-parser-utils.js +6 -44
  49. package/dist/es/jats/importer/jats-reference-parser.js +23 -16
  50. package/dist/es/jats/importer/jats-references.js +18 -18
  51. package/dist/es/jats/importer/parse-jats-article.js +78 -41
  52. package/dist/es/jats/index.js +3 -5
  53. package/dist/es/jats/{exporter/jats-exporter.js → jats-exporter.js} +392 -258
  54. package/dist/es/jats/{exporter/jats-versions.js → jats-versions.js} +1 -0
  55. package/dist/es/lib/utils.js +0 -9
  56. package/dist/es/transformer/__tests__/__helpers__/doc.js +29 -0
  57. package/dist/es/transformer/builders.js +186 -0
  58. package/dist/es/transformer/decode.js +888 -0
  59. package/dist/es/transformer/document-object-types.js +28 -0
  60. package/dist/es/transformer/encode.js +664 -0
  61. package/dist/es/transformer/filename.js +23 -0
  62. package/dist/es/transformer/footnote-category.js +16 -0
  63. package/dist/es/transformer/footnotes-order.js +55 -0
  64. package/dist/es/transformer/highlight-markers.js +132 -0
  65. package/dist/es/transformer/html.js +393 -0
  66. package/dist/es/transformer/id.js +3 -8
  67. package/dist/es/transformer/index.js +16 -0
  68. package/dist/es/{jats/exporter → transformer}/labels.js +5 -4
  69. package/dist/es/transformer/manuscript-dependencies.js +17 -0
  70. package/dist/es/transformer/model-map.js +22 -0
  71. package/dist/es/{lib/deafults.js → transformer/models.js} +2 -2
  72. package/dist/es/transformer/node-names.js +1 -0
  73. package/dist/es/transformer/object-types.js +52 -0
  74. package/dist/es/transformer/project-bundle.js +85 -0
  75. package/dist/es/transformer/serializer.js +17 -0
  76. package/dist/es/transformer/timestamp.js +16 -0
  77. package/dist/es/transformer/update-identifiers.js +87 -0
  78. package/dist/es/version.js +1 -1
  79. package/dist/types/index.d.ts +6 -6
  80. package/dist/types/jats/importer/index.d.ts +16 -0
  81. package/dist/types/jats/importer/{jats-dom-parser.d.ts → jats-body-dom-parser.d.ts} +1 -1
  82. package/dist/types/jats/importer/jats-body-transformations.d.ts +1 -5
  83. package/dist/types/jats/importer/jats-comments.d.ts +10 -4
  84. package/dist/types/jats/importer/jats-front-parser.d.ts +84 -0
  85. package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +0 -10
  86. package/dist/types/jats/importer/jats-references.d.ts +8 -19
  87. package/dist/types/jats/importer/parse-jats-article.d.ts +5 -12
  88. package/dist/types/jats/index.d.ts +3 -5
  89. package/dist/types/jats/{exporter/jats-exporter.d.ts → jats-exporter.d.ts} +29 -15
  90. package/dist/types/jats/{exporter/jats-versions.d.ts → jats-versions.d.ts} +1 -0
  91. package/dist/types/lib/utils.d.ts +0 -2
  92. package/dist/types/schema/nodes/bibliography_item.d.ts +3 -3
  93. package/dist/types/schema/nodes/contributor.d.ts +0 -10
  94. package/dist/types/schema/nodes/keyword_group.d.ts +0 -1
  95. package/dist/types/schema/nodes/manuscript.d.ts +7 -8
  96. package/dist/types/schema/nodes/title.d.ts +3 -0
  97. package/dist/types/transformer/__tests__/__helpers__/doc.d.ts +18 -0
  98. package/dist/types/transformer/builders.d.ts +61 -0
  99. package/dist/types/transformer/decode.d.ts +52 -0
  100. package/dist/types/transformer/document-object-types.d.ts +17 -0
  101. package/dist/types/transformer/encode.d.ts +29 -0
  102. package/dist/types/transformer/filename.d.ts +16 -0
  103. package/dist/types/transformer/footnote-category.d.ts +17 -0
  104. package/dist/{es/jats/importer/create-article-node.js → types/transformer/footnotes-order.d.ts} +8 -10
  105. package/dist/types/transformer/highlight-markers.d.ts +31 -0
  106. package/dist/types/transformer/html.d.ts +36 -0
  107. package/dist/types/transformer/id.d.ts +2 -5
  108. package/dist/types/transformer/index.d.ts +16 -0
  109. package/dist/types/{jats/exporter → transformer}/labels.d.ts +2 -2
  110. package/dist/types/transformer/manuscript-dependencies.d.ts +4 -0
  111. package/dist/types/transformer/model-map.d.ts +19 -0
  112. package/dist/types/transformer/models.d.ts +48 -0
  113. package/dist/types/transformer/object-types.d.ts +30 -0
  114. package/dist/types/transformer/project-bundle.d.ts +30 -0
  115. package/dist/types/transformer/serializer.d.ts +19 -0
  116. package/dist/types/{lib/deafults.d.ts → transformer/timestamp.d.ts} +2 -2
  117. package/dist/types/transformer/update-identifiers.d.ts +23 -0
  118. package/dist/types/types.d.ts +2 -0
  119. package/dist/types/version.d.ts +1 -1
  120. package/package.json +1 -2
  121. package/dist/cjs/jats/importer/jats-front-transformations.js +0 -79
  122. package/dist/es/jats/importer/jats-front-transformations.js +0 -76
  123. package/dist/types/jats/importer/jats-front-transformations.d.ts +0 -22
  124. package/dist/types/jats/types.d.ts +0 -1
  125. /package/dist/cjs/{jats/types.js → types.js} +0 -0
  126. /package/dist/es/{jats/types.js → types.js} +0 -0
@@ -13,19 +13,20 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { schema, } from '../../schema';
17
- import { nodeNames } from '../../transformer/node-names';
16
+ import { schema } from '../schema';
17
+ import { nodeNames } from './node-names';
18
18
  const labelledNodeTypes = [
19
19
  schema.nodes.figure_element,
20
20
  schema.nodes.table_element,
21
21
  schema.nodes.equation_element,
22
22
  schema.nodes.listing_element,
23
+ schema.nodes.box_element,
23
24
  ];
24
25
  const excludedTypes = [schema.nodes.graphical_abstract_section];
25
26
  const chooseLabel = (nodeType) => {
26
27
  return nodeNames.get(nodeType);
27
28
  };
28
- export const buildTargets = (node) => {
29
+ export const buildTargets = (fragment) => {
29
30
  const counters = {};
30
31
  for (const nodeType of labelledNodeTypes) {
31
32
  counters[nodeType.name] = {
@@ -39,7 +40,7 @@ export const buildTargets = (node) => {
39
40
  return `${counter.label} ${counter.index}`;
40
41
  };
41
42
  const targets = new Map();
42
- node.descendants((node, pos, parent) => {
43
+ fragment.descendants((node, pos, parent) => {
43
44
  var _a;
44
45
  if (node.type.name in counters) {
45
46
  if (parent && excludedTypes.includes(parent.type)) {
@@ -0,0 +1,17 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { generateID } from './id';
13
+ export const fromPrototype = (model) => {
14
+ const { _id } = model, data = __rest(model, ["_id"]);
15
+ const output = Object.assign(Object.assign({}, data), { prototype: _id, _id: generateID(model.objectType) });
16
+ return output;
17
+ };
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * © 2020 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 { generateID } from './id';
17
+ export const addModelToMap = (modelMap) => (data) => {
18
+ if (!data._id) {
19
+ data._id = generateID(data.objectType);
20
+ }
21
+ modelMap.set(data._id, data);
22
+ };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * © 2024 Atypon Systems LLC
2
+ * © 2019 Atypon Systems LLC
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export const defaultTitle = 'Untitled Manuscript';
16
+ export {};
@@ -36,4 +36,5 @@ export const nodeNames = new Map([
36
36
  [schema.nodes.pullquote_element, 'Pull Quote'],
37
37
  [schema.nodes.keywords, 'Section'],
38
38
  [schema.nodes.toc_section, 'Section'],
39
+ [schema.nodes.box_element, 'Box'],
39
40
  ]);
@@ -0,0 +1,52 @@
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 { manuscriptIDTypes, ObjectTypes, } from '@manuscripts/json-schema';
17
+ export var ExtraObjectTypes;
18
+ (function (ExtraObjectTypes) {
19
+ ExtraObjectTypes["PlaceholderElement"] = "MPPlaceholderElement";
20
+ ExtraObjectTypes["GeneralTableFootnote"] = "MPGeneralTableFootnote";
21
+ })(ExtraObjectTypes || (ExtraObjectTypes = {}));
22
+ export const elementObjects = [
23
+ ObjectTypes.BibliographyElement,
24
+ ObjectTypes.EquationElement,
25
+ ObjectTypes.FigureElement,
26
+ ObjectTypes.FootnotesElement,
27
+ ObjectTypes.ListElement,
28
+ ObjectTypes.ListingElement,
29
+ ObjectTypes.ParagraphElement,
30
+ ObjectTypes.TableElement,
31
+ ObjectTypes.TOCElement,
32
+ ];
33
+ export const manuscriptObjects = [
34
+ ObjectTypes.Affiliation,
35
+ ObjectTypes.Citation,
36
+ ObjectTypes.CommentAnnotation,
37
+ ObjectTypes.Contributor,
38
+ ObjectTypes.Footnote,
39
+ ObjectTypes.Section,
40
+ ].concat(elementObjects);
41
+ export const isManuscriptModel = (model) => {
42
+ if (!model.objectType) {
43
+ throw new Error('Model must have objectType');
44
+ }
45
+ return manuscriptIDTypes.has(model.objectType);
46
+ };
47
+ export const hasObjectType = (objectType) => (model) => model.objectType === objectType;
48
+ export const isFigure = hasObjectType(ObjectTypes.Figure);
49
+ export const isManuscript = hasObjectType(ObjectTypes.Manuscript);
50
+ export const isTable = hasObjectType(ObjectTypes.Table);
51
+ export const isCommentAnnotation = hasObjectType(ObjectTypes.CommentAnnotation);
52
+ export const isKeyword = hasObjectType(ObjectTypes.Keyword);
@@ -0,0 +1,85 @@
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 { ObjectTypes, } from '@manuscripts/json-schema';
17
+ import { Decoder } from './decode';
18
+ import { hasObjectType } from './object-types';
19
+ export const parseProjectBundle = (projectBundle, manuscriptID) => {
20
+ const manuscriptData = manuscriptID
21
+ ? projectBundle.data.filter((doc) => !doc.manuscriptID || doc.manuscriptID === manuscriptID)
22
+ : projectBundle.data;
23
+ const modelMap = new Map();
24
+ for (const component of manuscriptData) {
25
+ modelMap.set(component._id, component);
26
+ }
27
+ const decoder = new Decoder(modelMap);
28
+ const doc = decoder.createArticleNode();
29
+ return { doc, modelMap };
30
+ };
31
+ const isManuscript = hasObjectType(ObjectTypes.Manuscript);
32
+ export const findManuscript = (modelMap) => {
33
+ for (const model of modelMap.values()) {
34
+ if (isManuscript(model)) {
35
+ return model;
36
+ }
37
+ }
38
+ throw new Error('No manuscript found');
39
+ };
40
+ const isJournal = hasObjectType(ObjectTypes.Journal);
41
+ export const findJournal = (modelMap) => {
42
+ for (const model of modelMap.values()) {
43
+ if (isJournal(model)) {
44
+ return model;
45
+ }
46
+ }
47
+ return null;
48
+ };
49
+ const isManuscriptModel = (model) => 'manuscriptID' in model;
50
+ export const findManuscriptModelByType = (modelMap, manuscript, objectType) => {
51
+ for (const model of modelMap.values()) {
52
+ if (model.objectType === objectType &&
53
+ isManuscriptModel(model) &&
54
+ manuscript._id === model.manuscriptID) {
55
+ return model;
56
+ }
57
+ }
58
+ };
59
+ export const findManuscriptById = (modelMap, manuscriptID) => {
60
+ const manuscript = modelMap.get(manuscriptID);
61
+ if (manuscript && isManuscript(manuscript)) {
62
+ return manuscript;
63
+ }
64
+ throw new Error(`There is no manuscript found for the following _id (${manuscriptID})`);
65
+ };
66
+ const isTitle = hasObjectType(ObjectTypes.Titles);
67
+ export const findTitles = (modelMap) => {
68
+ for (const model of modelMap.values()) {
69
+ if (isTitle(model)) {
70
+ return model;
71
+ }
72
+ }
73
+ const defaultTitle = {
74
+ _id: 'MPTitles:8EB79C14-9F61-483A-902F-A0B8EF5973C1',
75
+ createdAt: 1538472121.690101,
76
+ updatedAt: 1538472121.690101,
77
+ objectType: 'MPTitles',
78
+ title: 'main title',
79
+ subtitle: 'subtitle',
80
+ runningTitle: 'running title',
81
+ manuscriptID: 'MPManuscript:E3830344-E77B-42BA-BD77-3E95489712A0',
82
+ containerID: 'MPProject:1',
83
+ };
84
+ return defaultTitle;
85
+ };
@@ -0,0 +1,17 @@
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 serializeToString from 'w3c-xmlserializer';
17
+ export const xmlSerializer = { serializeToString };
@@ -0,0 +1,16 @@
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 timestamp = () => Math.floor(Date.now() / 1000);
@@ -0,0 +1,87 @@
1
+ /*!
2
+ * © 2020 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 { generateID } from './id';
17
+ export const updateIdentifiers = async (data) => {
18
+ const idMap = new Map();
19
+ const updateIDs = (model) => {
20
+ const { _id, objectType } = model;
21
+ if (!objectType || !_id || !_id.match(/^MP.+:.+/)) {
22
+ return;
23
+ }
24
+ if (idMap.has(_id)) {
25
+ model._id = idMap.get(_id);
26
+ }
27
+ else {
28
+ model._id = generateID(objectType);
29
+ idMap.set(_id, model._id);
30
+ }
31
+ for (const value of Object.values(model)) {
32
+ if (Array.isArray(value)) {
33
+ value.forEach(updateIDs);
34
+ }
35
+ else {
36
+ updateIDs(value);
37
+ }
38
+ }
39
+ };
40
+ const replaceContent = (content) => {
41
+ content = content.replace(/MP\w+:[\w-]+/g, (match) => {
42
+ const value = idMap.get(match);
43
+ return value !== null && value !== void 0 ? value : match;
44
+ });
45
+ content = content.replace(/MP\w+_[\w-]+/g, (match) => {
46
+ const value = idMap.get(match.replace('_', ':'));
47
+ return value ? value.replace(':', '_') : match;
48
+ });
49
+ return content;
50
+ };
51
+ const updateContent = (model) => {
52
+ for (const [key, value] of Object.entries(model)) {
53
+ if (typeof value === 'object') {
54
+ updateContent(value);
55
+ }
56
+ else if (typeof value === 'string') {
57
+ model[key] = replaceContent(value);
58
+ }
59
+ }
60
+ };
61
+ for (const item of data) {
62
+ updateIDs(item);
63
+ }
64
+ for (const item of data) {
65
+ updateContent(item);
66
+ }
67
+ return { data, idMap };
68
+ };
69
+ export const updateAttachmentPath = (oldPath, idMap) => {
70
+ const matches = oldPath.match(/^Data\/([^.]+)(.*)/);
71
+ if (matches) {
72
+ const [, prefix, suffix] = matches;
73
+ const id = idMap.get(prefix.replace('_', ':'));
74
+ if (id) {
75
+ const newPrefix = id.replace(':', '_');
76
+ return `Data/${newPrefix}${suffix}`;
77
+ }
78
+ }
79
+ };
80
+ export const updateAttachments = async (zip, idMap) => {
81
+ for (const [oldPath, entry] of Object.entries(zip.files)) {
82
+ const newPath = updateAttachmentPath(oldPath, idMap);
83
+ if (newPath) {
84
+ zip.file(newPath, await entry.async('blob')).remove(oldPath);
85
+ }
86
+ }
87
+ };
@@ -1 +1 @@
1
- export const VERSION = "2.3.38-LEAN-3911.0";
1
+ export const VERSION = "2.6.0";
@@ -1,11 +1,11 @@
1
- export * from './errors';
2
- export { getVersion } from './getVersion';
3
- export * from './jats';
4
- export * from './jats/types';
5
1
  export * from './lib/section-group-type';
6
2
  export * from './lib/table-cell-styles';
7
3
  export * from './lib/utils';
8
4
  export * from './schema';
9
- export { JSONNode, migrateFor } from './schema/migration/migrate';
10
- export { isSectionLabelNode } from './schema/nodes/section_label';
11
5
  export * from './transformer';
6
+ export * from './jats';
7
+ export * from './types';
8
+ export * from './errors';
9
+ export { getVersion } from './getVersion';
10
+ export { migrateFor, JSONNode } from './schema/migration/migrate';
11
+ export { isSectionLabelNode } from './schema/nodes/section_label';
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * © 2020 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 { parseJATSFront, parseJATSBody, parseJATSArticle, } from './parse-jats-article';
@@ -21,4 +21,4 @@ export type MarkRule = ParseRule & {
21
21
  export type NodeRule = ParseRule & {
22
22
  node?: Nodes | null;
23
23
  };
24
- export declare const jatsDOMParser: DOMParser;
24
+ export declare const jatsBodyDOMParser: DOMParser;
@@ -13,8 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { BibliographyItemAttrs } from '../../schema';
17
- import { References } from './jats-references';
18
16
  export declare const jatsBodyTransformations: {
19
17
  ensureSection(body: Element, createElement: (tagName: string) => HTMLElement): void;
20
18
  createAbstractSection(abstractNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
@@ -27,6 +25,7 @@ export declare const jatsBodyTransformations: {
27
25
  moveBackSections(doc: Document, group: Element): void;
28
26
  moveAcknowledgments(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
29
27
  moveAppendices(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
28
+ createBoxedElementSection(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
30
29
  createBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
31
30
  createAbstracts(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
32
31
  createBackmatter(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
@@ -38,7 +37,4 @@ export declare const jatsBodyTransformations: {
38
37
  moveFloatsGroupToBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
39
38
  createKeywords(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
40
39
  createSuppleMaterials(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
41
- moveReferencesToBackmatter(body: Element, references: References | undefined, createElement: (tagName: string) => HTMLElement): void;
42
- createBibliographySection(createElement: (tagName: string) => HTMLElement): HTMLElement;
43
- createBibliographyItem(item: BibliographyItemAttrs, createElement: (tagName: string) => HTMLElement): HTMLElement;
44
40
  };
@@ -13,12 +13,18 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { CommentAnnotation, Model } from '@manuscripts/json-schema';
17
+ import { References } from './jats-references';
16
18
  export type JATSComment = {
17
- index: number;
18
- text: string;
19
19
  id: string;
20
+ text: string;
21
+ };
22
+ export type JATSCommentMark = {
23
+ token: string;
24
+ comment: JATSComment;
20
25
  };
21
- export declare const DEFAULT_PROFILE_ID = "MPUserProfile:0000000000000000000000000000000000000001";
22
26
  export declare const isJATSComment: (node: Node) => boolean;
23
27
  export declare const parseJATSComment: (node: Node) => JATSComment | undefined;
24
- export declare const markComments: (doc: Document) => void;
28
+ export declare const markComments: (doc: Document) => JATSCommentMark[];
29
+ export declare const createComments: (models: Model[], marks: JATSCommentMark[]) => CommentAnnotation[];
30
+ export declare const createReferenceComments: (references: References) => CommentAnnotation[];
@@ -0,0 +1,84 @@
1
+ /*!
2
+ * © 2020 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 declare const jatsFrontParser: {
17
+ parseTitles(element: Element | null, createElement: (tagName: string) => HTMLElement): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Titles>;
18
+ parseDOI(front: Element | null): string | undefined;
19
+ parseCounts(counts: Element | null): {
20
+ wordCount: number | undefined;
21
+ figureCount: number | undefined;
22
+ tableCount: number | undefined;
23
+ equationCount: number | undefined;
24
+ referencesCount: number | undefined;
25
+ genericCounts: {
26
+ count: number | undefined;
27
+ countType: string;
28
+ }[] | undefined;
29
+ } | undefined;
30
+ parseJournal(element: Element | null): {
31
+ title: string | undefined;
32
+ templateID?: string | undefined;
33
+ ISSNs: {
34
+ [k: string]: any;
35
+ ISSN: string;
36
+ publicationType?: string | undefined;
37
+ }[];
38
+ abbreviatedTitles: {
39
+ [k: string]: any;
40
+ abbreviatedTitle: string;
41
+ abbrevType?: string | undefined;
42
+ }[];
43
+ journalIdentifiers: {
44
+ [k: string]: any;
45
+ journalID: string;
46
+ journalIDType?: string | undefined;
47
+ }[];
48
+ submittable?: boolean | undefined;
49
+ publisherName: string | undefined;
50
+ _id: string;
51
+ objectType: string;
52
+ contributions?: import("@manuscripts/json-schema/dist/types").Contribution[] | undefined;
53
+ };
54
+ parseDates(historyNode: Element | null): {
55
+ acceptanceDate?: number | undefined;
56
+ correctionDate?: number | undefined;
57
+ retractionDate?: number | undefined;
58
+ revisionRequestDate?: number | undefined;
59
+ revisionReceiveDate?: number | undefined;
60
+ receiveDate?: number | undefined;
61
+ } | undefined;
62
+ parseAffiliations(elements: Element[]): {
63
+ affiliations: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Affiliation>[];
64
+ affiliationIDs: Map<string, string>;
65
+ };
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[]): {
76
+ footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
77
+ footnoteIDs: Map<string, string>;
78
+ };
79
+ parseCorresp(elements: Element[]): {
80
+ correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Corresponding>[];
81
+ correspondingIDs: Map<string, string>;
82
+ };
83
+ 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>[];
84
+ };
@@ -13,7 +13,6 @@
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';
17
16
  export type ISSN = {
18
17
  ISSN: string;
19
18
  publicationType?: string;
@@ -36,12 +35,3 @@ export declare const parseJournalMeta: (element: Element | null) => {
36
35
  publisherName: string | undefined;
37
36
  title: string | undefined;
38
37
  };
39
- export declare const parseJournal: (element: Element | null) => {
40
- _id: string;
41
- objectType: ObjectTypes;
42
- abbreviatedTitles: AbbreviatedTitle[];
43
- journalIdentifiers: JournalIdentifier[];
44
- ISSNs: ISSN[];
45
- publisherName: string | undefined;
46
- title: string | undefined;
47
- };
@@ -1,23 +1,12 @@
1
- /*!
2
- * © 2023 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 { BibliographyItemAttrs } from '../../schema';
1
+ import { BibliographyItem } from '@manuscripts/json-schema';
2
+ import { JATSComment } from './jats-comments';
17
3
  export declare class References {
18
- items: Map<string, BibliographyItemAttrs>;
4
+ items: Map<string, BibliographyItem>;
19
5
  IDs: Map<string, string>;
6
+ comments: Map<string, JATSComment[]>;
20
7
  constructor();
21
- add(item: BibliographyItemAttrs, id: string | null): void;
22
- getBibliographyItems(): BibliographyItemAttrs[];
8
+ add(item: BibliographyItem, id: string | null, comments: JATSComment[]): void;
9
+ getBibliographyItems(): BibliographyItem[];
10
+ getComments(id: string): JATSComment[];
11
+ private getValue;
23
12
  }
@@ -13,15 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const parseJATSArticle: (doc: Document, template?: string) => {
17
- node: import("prosemirror-model").Node;
18
- journal: {
19
- _id: string;
20
- objectType: import("@manuscripts/json-schema/dist/types").ObjectTypes;
21
- abbreviatedTitles: import("./jats-journal-meta-parser").AbbreviatedTitle[];
22
- journalIdentifiers: import("./jats-journal-meta-parser").JournalIdentifier[];
23
- ISSNs: import("./jats-journal-meta-parser").ISSN[];
24
- publisherName: string | undefined;
25
- title: string | undefined;
26
- };
27
- };
16
+ import { Model } from '@manuscripts/json-schema';
17
+ import { References } from './jats-references';
18
+ export declare const parseJATSFront: (doc: Document, front: Element) => Model[];
19
+ export declare const parseJATSBody: (doc: Document, body: Element, references?: References) => IterableIterator<Model>;
20
+ export declare const parseJATSArticle: (doc: Document) => Model[];
@@ -13,8 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export * from './exporter/jats-exporter';
17
- export * from './exporter/jats-versions';
18
- export * from './exporter/labels';
19
- export * from './importer/create-article-node';
20
- export { parseJATSArticle } from './importer/parse-jats-article';
16
+ export { parseJATSFront, parseJATSBody, parseJATSArticle } from './importer';
17
+ export * from './jats-exporter';
18
+ export * from './jats-versions';