@manuscripts/transform 1.5.7 → 1.5.8-LEAN-3030-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.
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/jats/importer/index.js +1 -3
- package/dist/cjs/jats/importer/jats-body-dom-parser.js +23 -227
- package/dist/cjs/jats/importer/jats-body-transformations.js +110 -201
- package/dist/cjs/jats/importer/jats-comments.js +100 -98
- package/dist/cjs/jats/importer/jats-front-parser.js +87 -81
- package/dist/cjs/jats/importer/jats-journal-meta-parser.js +51 -39
- package/dist/cjs/jats/importer/jats-parser-utils.js +17 -56
- package/dist/cjs/jats/importer/jats-reference-parser.js +24 -79
- package/dist/cjs/jats/importer/jats-references.js +34 -0
- package/dist/cjs/jats/importer/parse-jats-article.js +67 -173
- package/dist/cjs/jats/index.js +1 -3
- package/dist/cjs/jats/jats-exporter.js +33 -54
- package/dist/cjs/lib/section-group-type.js +30 -0
- package/dist/cjs/lib/utils.js +14 -12
- package/dist/cjs/schema/index.js +20 -17
- package/dist/cjs/schema/nodes/abstracts.js +27 -0
- package/dist/cjs/schema/nodes/affiliations.js +27 -0
- package/dist/cjs/schema/nodes/backmatter.js +27 -0
- package/dist/cjs/schema/nodes/body.js +27 -0
- package/dist/cjs/schema/nodes/citation.js +10 -15
- package/dist/cjs/schema/nodes/{comment_list.js → comments.js} +4 -4
- package/dist/cjs/schema/nodes/contributors.js +27 -0
- package/dist/cjs/schema/nodes/{meta_section.js → core_section.js} +6 -5
- package/dist/cjs/schema/nodes/cross_reference.js +4 -3
- package/dist/cjs/schema/nodes/inline_footnote.js +6 -5
- package/dist/cjs/schema/nodes/keyword.js +0 -1
- package/dist/cjs/schema/nodes/{keywords_group.js → keyword_group.js} +6 -6
- package/dist/cjs/schema/nodes/{keywords_section.js → keywords.js} +7 -7
- package/dist/cjs/schema/nodes/keywords_element.js +1 -1
- package/dist/cjs/schema/nodes/manuscript.js +5 -2
- package/dist/cjs/transformer/builders.js +9 -86
- package/dist/cjs/transformer/decode.js +129 -165
- package/dist/cjs/transformer/encode.js +54 -45
- package/dist/cjs/transformer/highlight-markers.js +4 -4
- package/dist/cjs/transformer/html.js +5 -20
- package/dist/cjs/transformer/labels.js +3 -17
- package/dist/cjs/transformer/node-names.js +1 -1
- package/dist/cjs/transformer/node-title.js +1 -1
- package/dist/cjs/transformer/node-types.js +7 -6
- package/dist/cjs/transformer/object-types.js +1 -2
- package/dist/cjs/transformer/section-category.js +31 -31
- package/dist/es/index.js +1 -1
- package/dist/es/jats/importer/index.js +1 -1
- package/dist/es/jats/importer/jats-body-dom-parser.js +23 -227
- package/dist/es/jats/importer/jats-body-transformations.js +111 -202
- package/dist/es/jats/importer/jats-comments.js +97 -96
- package/dist/es/jats/importer/jats-front-parser.js +88 -82
- package/dist/es/jats/importer/jats-journal-meta-parser.js +51 -39
- package/dist/es/jats/importer/jats-parser-utils.js +16 -54
- package/dist/es/jats/importer/jats-reference-parser.js +27 -82
- package/dist/es/jats/importer/jats-references.js +30 -0
- package/dist/es/jats/importer/parse-jats-article.js +70 -174
- package/dist/es/jats/index.js +1 -1
- package/dist/es/jats/jats-exporter.js +33 -54
- package/dist/es/lib/section-group-type.js +27 -0
- package/dist/es/lib/utils.js +12 -10
- package/dist/es/schema/index.js +21 -18
- package/dist/es/schema/nodes/abstracts.js +24 -0
- package/dist/es/schema/nodes/affiliations.js +24 -0
- package/dist/es/schema/nodes/backmatter.js +24 -0
- package/dist/es/schema/nodes/body.js +24 -0
- package/dist/es/schema/nodes/citation.js +10 -15
- package/dist/es/schema/nodes/{comment_list.js → comments.js} +3 -3
- package/dist/es/schema/nodes/contributors.js +24 -0
- package/dist/es/schema/nodes/{meta_section.js → core_section.js} +5 -4
- package/dist/es/schema/nodes/cross_reference.js +4 -3
- package/dist/es/schema/nodes/inline_footnote.js +6 -5
- package/dist/es/schema/nodes/keyword.js +0 -1
- package/dist/es/schema/nodes/{keywords_group.js → keyword_group.js} +4 -4
- package/dist/es/schema/nodes/{keywords_section.js → keywords.js} +5 -5
- package/dist/es/schema/nodes/keywords_element.js +1 -1
- package/dist/es/schema/nodes/manuscript.js +3 -1
- package/dist/es/transformer/builders.js +6 -73
- package/dist/es/transformer/decode.js +129 -164
- package/dist/es/transformer/encode.js +57 -48
- package/dist/es/transformer/highlight-markers.js +1 -1
- package/dist/es/transformer/html.js +5 -20
- package/dist/es/transformer/labels.js +3 -17
- package/dist/es/transformer/node-names.js +1 -1
- package/dist/es/transformer/node-title.js +1 -1
- package/dist/es/transformer/node-types.js +7 -6
- package/dist/es/transformer/object-types.js +0 -1
- package/dist/es/transformer/section-category.js +29 -29
- package/dist/types/index.d.ts +1 -1
- package/dist/types/jats/importer/index.d.ts +1 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +16 -19
- package/dist/types/jats/importer/jats-comments.d.ts +13 -9
- package/dist/types/jats/importer/jats-front-parser.d.ts +35 -12
- package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +4 -4
- package/dist/types/jats/importer/jats-parser-utils.d.ts +1 -6
- package/dist/types/jats/importer/jats-reference-parser.d.ts +2 -6
- package/dist/types/jats/importer/jats-references.d.ts +12 -0
- package/dist/types/jats/importer/parse-jats-article.d.ts +5 -17
- package/dist/types/jats/index.d.ts +1 -1
- package/dist/types/lib/section-group-type.d.ts +23 -0
- package/dist/types/lib/utils.d.ts +3 -2
- package/dist/types/schema/index.d.ts +4 -5
- package/dist/types/schema/nodes/{meta_section.d.ts → abstracts.d.ts} +1 -9
- package/dist/types/schema/nodes/affiliations.d.ts +17 -0
- package/dist/types/schema/nodes/backmatter.d.ts +17 -0
- package/dist/types/schema/nodes/body.d.ts +17 -0
- package/dist/types/schema/nodes/citation.d.ts +3 -5
- package/dist/types/schema/nodes/comments.d.ts +17 -0
- package/dist/types/schema/nodes/contributors.d.ts +17 -0
- package/dist/types/schema/nodes/core_section.d.ts +17 -0
- package/dist/types/schema/nodes/cross_reference.d.ts +1 -1
- package/dist/types/schema/nodes/inline_footnote.d.ts +1 -1
- package/dist/types/schema/nodes/keyword.d.ts +0 -1
- package/dist/types/schema/nodes/{contributors_element.d.ts → keyword_group.d.ts} +3 -4
- package/dist/types/schema/nodes/{comment_list.d.ts → keywords.d.ts} +3 -2
- package/dist/types/schema/nodes/manuscript.d.ts +1 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/builders.d.ts +2 -14
- package/dist/types/transformer/decode.d.ts +5 -9
- package/dist/types/transformer/encode.d.ts +1 -1
- package/dist/types/transformer/highlight-markers.d.ts +1 -0
- package/dist/types/transformer/object-types.d.ts +1 -2
- package/dist/types/transformer/section-category.d.ts +4 -3
- package/package.json +1 -1
- package/dist/cjs/lib/core-section-categories.js +0 -29
- package/dist/cjs/schema/nodes/affiliations_section.js +0 -36
- package/dist/cjs/schema/nodes/contributors_element.js +0 -49
- package/dist/cjs/schema/nodes/contributors_section.js +0 -36
- package/dist/es/lib/core-section-categories.js +0 -26
- package/dist/es/schema/nodes/affiliations_section.js +0 -32
- package/dist/es/schema/nodes/contributors_element.js +0 -46
- package/dist/es/schema/nodes/contributors_section.js +0 -32
- package/dist/types/lib/core-section-categories.d.ts +0 -8
- package/dist/types/schema/nodes/affiliations_section.d.ts +0 -11
- package/dist/types/schema/nodes/contributors_section.d.ts +0 -12
- package/dist/types/schema/nodes/keywords_group.d.ts +0 -26
- package/dist/types/schema/nodes/keywords_section.d.ts +0 -26
|
@@ -194,11 +194,9 @@ export class HTMLTransformer {
|
|
|
194
194
|
const citationNode = node;
|
|
195
195
|
const element = this.document.createElement('span');
|
|
196
196
|
element.setAttribute('class', 'citation');
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
199
|
-
element.setAttribute('data-reference-ids',
|
|
200
|
-
.map((item) => item.bibliographyItem)
|
|
201
|
-
.join(' '));
|
|
197
|
+
const rids = citationNode.attrs.rids;
|
|
198
|
+
if (rids.length) {
|
|
199
|
+
element.setAttribute('data-reference-ids', rids.join(' '));
|
|
202
200
|
}
|
|
203
201
|
if (citationNode.attrs.contents) {
|
|
204
202
|
element.innerHTML = citationNode.attrs.contents;
|
|
@@ -209,20 +207,7 @@ export class HTMLTransformer {
|
|
|
209
207
|
const crossReferenceNode = node;
|
|
210
208
|
const element = this.document.createElement('a');
|
|
211
209
|
element.classList.add('cross-reference');
|
|
212
|
-
|
|
213
|
-
if (auxiliaryObjectReference &&
|
|
214
|
-
auxiliaryObjectReference.referencedObject) {
|
|
215
|
-
if (auxiliaryObjectReference.referencedObject.startsWith('MPFigureElement')) {
|
|
216
|
-
const model = getModel(auxiliaryObjectReference.referencedObject);
|
|
217
|
-
if (model && model.containedObjectIDs.length > 0) {
|
|
218
|
-
element.setAttribute('href', `#${model.containedObjectIDs[0]}`);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
element.setAttribute('href', `#${auxiliaryObjectReference.referencedObject}`);
|
|
223
|
-
}
|
|
224
|
-
element.setAttribute('data-reference-ids', crossReferenceNode.attrs.rid);
|
|
225
|
-
}
|
|
210
|
+
element.setAttribute('data-reference-ids', crossReferenceNode.attrs.rids.join(' '));
|
|
226
211
|
element.textContent =
|
|
227
212
|
crossReferenceNode.attrs.customLabel || crossReferenceNode.attrs.label;
|
|
228
213
|
return element;
|
|
@@ -256,7 +241,7 @@ export class HTMLTransformer {
|
|
|
256
241
|
};
|
|
257
242
|
return ['span', attrs];
|
|
258
243
|
};
|
|
259
|
-
nodes.
|
|
244
|
+
nodes.comments = () => '';
|
|
260
245
|
const serializer = new DOMSerializer(nodes, marks);
|
|
261
246
|
return serializer.serializeFragment(fragment, { document });
|
|
262
247
|
};
|
|
@@ -27,6 +27,7 @@ const labelProperties = new Map([
|
|
|
27
27
|
[schema.nodes.equation_element, 'equationElementLabel'],
|
|
28
28
|
[schema.nodes.listing_element, 'listingElementLabel'],
|
|
29
29
|
]);
|
|
30
|
+
const excludedTypes = [schema.nodes.graphical_abstract_section];
|
|
30
31
|
const chooseLabel = (nodeType, manuscript) => {
|
|
31
32
|
const labelProperty = labelProperties.get(nodeType);
|
|
32
33
|
if (labelProperty) {
|
|
@@ -51,25 +52,10 @@ export const buildTargets = (fragment, manuscript) => {
|
|
|
51
52
|
return `${counter.label} ${counter.index}`;
|
|
52
53
|
};
|
|
53
54
|
const targets = new Map();
|
|
54
|
-
|
|
55
|
-
fragment.forEach((node) => {
|
|
56
|
-
if (node.attrs.category === 'MPSectionCategory:abstracts') {
|
|
57
|
-
node.forEach((child) => {
|
|
58
|
-
if (child.type === node.type.schema.nodes.graphical_abstract_section) {
|
|
59
|
-
child.forEach((item) => {
|
|
60
|
-
if (item.type === node.type.schema.nodes.figure_element) {
|
|
61
|
-
figures.push(item.attrs.id);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
fragment.descendants((node) => {
|
|
55
|
+
fragment.descendants((node, pos, parent) => {
|
|
69
56
|
var _a;
|
|
70
57
|
if (node.type.name in counters) {
|
|
71
|
-
|
|
72
|
-
if (isInGraphicalAbstract) {
|
|
58
|
+
if (parent && excludedTypes.includes(parent.type)) {
|
|
73
59
|
return;
|
|
74
60
|
}
|
|
75
61
|
const label = buildLabel(node.type);
|
|
@@ -35,6 +35,6 @@ export const nodeNames = new Map([
|
|
|
35
35
|
[schema.nodes.table_element, 'Table'],
|
|
36
36
|
[schema.nodes.blockquote_element, 'Block Quote'],
|
|
37
37
|
[schema.nodes.pullquote_element, 'Pull Quote'],
|
|
38
|
-
[schema.nodes.
|
|
38
|
+
[schema.nodes.keywords, 'Section'],
|
|
39
39
|
[schema.nodes.toc_section, 'Section'],
|
|
40
40
|
]);
|
|
@@ -47,7 +47,7 @@ export const nodeTitle = (node) => {
|
|
|
47
47
|
case nodes.section:
|
|
48
48
|
case nodes.bibliography_section:
|
|
49
49
|
case nodes.footnotes_section:
|
|
50
|
-
case nodes.
|
|
50
|
+
case nodes.keywords:
|
|
51
51
|
case nodes.toc_section:
|
|
52
52
|
case nodes.graphical_abstract_section:
|
|
53
53
|
return snippetOfNodeType(node, nodes.section_title);
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { GROUP_ELEMENT, GROUP_EXECUTABLE, GROUP_SECTION, hasGroup, schema, } from '../schema';
|
|
18
18
|
export const nodeTypesMap = new Map([
|
|
19
|
+
[schema.nodes.abstracts, ObjectTypes.Section],
|
|
20
|
+
[schema.nodes.body, ObjectTypes.Section],
|
|
21
|
+
[schema.nodes.backmatter, ObjectTypes.Section],
|
|
19
22
|
[schema.nodes.comment, ObjectTypes.CommentAnnotation],
|
|
20
23
|
[schema.nodes.bibliography_item, ObjectTypes.BibliographyItem],
|
|
21
24
|
[schema.nodes.bibliography_element, ObjectTypes.BibliographyElement],
|
|
@@ -23,7 +26,6 @@ export const nodeTypesMap = new Map([
|
|
|
23
26
|
[schema.nodes.blockquote_element, ObjectTypes.QuoteElement],
|
|
24
27
|
[schema.nodes.bullet_list, ObjectTypes.ListElement],
|
|
25
28
|
[schema.nodes.citation, ObjectTypes.Citation],
|
|
26
|
-
[schema.nodes.cross_reference, ObjectTypes.AuxiliaryObjectReference],
|
|
27
29
|
[schema.nodes.equation, ObjectTypes.Equation],
|
|
28
30
|
[schema.nodes.equation_element, ObjectTypes.EquationElement],
|
|
29
31
|
[schema.nodes.figure, ObjectTypes.Figure],
|
|
@@ -37,8 +39,8 @@ export const nodeTypesMap = new Map([
|
|
|
37
39
|
[schema.nodes.inline_equation, ObjectTypes.InlineMathFragment],
|
|
38
40
|
[schema.nodes.keyword, ObjectTypes.Keyword],
|
|
39
41
|
[schema.nodes.keywords_element, ObjectTypes.KeywordsElement],
|
|
40
|
-
[schema.nodes.
|
|
41
|
-
[schema.nodes.
|
|
42
|
+
[schema.nodes.keywords, ObjectTypes.Section],
|
|
43
|
+
[schema.nodes.keyword_group, ObjectTypes.KeywordGroup],
|
|
42
44
|
[schema.nodes.listing, ObjectTypes.Listing],
|
|
43
45
|
[schema.nodes.listing_element, ObjectTypes.ListingElement],
|
|
44
46
|
[schema.nodes.manuscript, ObjectTypes.Manuscript],
|
|
@@ -50,13 +52,12 @@ export const nodeTypesMap = new Map([
|
|
|
50
52
|
[schema.nodes.table_element, ObjectTypes.TableElement],
|
|
51
53
|
[schema.nodes.toc_element, ObjectTypes.TOCElement],
|
|
52
54
|
[schema.nodes.toc_section, ObjectTypes.Section],
|
|
53
|
-
[schema.nodes.meta_section, ObjectTypes.MetaSection],
|
|
54
55
|
[schema.nodes.affiliation, ObjectTypes.Affiliation],
|
|
55
56
|
[schema.nodes.contributor, ObjectTypes.Contributor],
|
|
56
57
|
[schema.nodes.table_element_footer, ObjectTypes.TableElementFooter],
|
|
58
|
+
[schema.nodes.contributors, ObjectTypes.Section],
|
|
59
|
+
[schema.nodes.affiliations, ObjectTypes.Section],
|
|
57
60
|
[schema.nodes.title, ObjectTypes.Titles],
|
|
58
|
-
[schema.nodes.contributors_section, ObjectTypes.Section],
|
|
59
|
-
[schema.nodes.affiliations_section, ObjectTypes.Section],
|
|
60
61
|
]);
|
|
61
62
|
export const isExecutableNodeType = (type) => hasGroup(type, GROUP_EXECUTABLE);
|
|
62
63
|
export const isElementNodeType = (type) => hasGroup(type, GROUP_ELEMENT);
|
|
@@ -48,6 +48,5 @@ export const hasObjectType = (objectType) => (model) => model.objectType === obj
|
|
|
48
48
|
export const isFigure = hasObjectType(ObjectTypes.Figure);
|
|
49
49
|
export const isManuscript = hasObjectType(ObjectTypes.Manuscript);
|
|
50
50
|
export const isTable = hasObjectType(ObjectTypes.Table);
|
|
51
|
-
export const isUserProfile = hasObjectType(ObjectTypes.UserProfile);
|
|
52
51
|
export const isCommentAnnotation = hasObjectType(ObjectTypes.CommentAnnotation);
|
|
53
52
|
export const isKeyword = hasObjectType(ObjectTypes.Keyword);
|
|
@@ -14,22 +14,15 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
|
-
import {
|
|
17
|
+
import { abstractsType, backmatterType, bodyType, } from '../lib/section-group-type';
|
|
18
18
|
import { schema } from '../schema';
|
|
19
19
|
const sectionNodeTypes = [
|
|
20
20
|
schema.nodes.bibliography_section,
|
|
21
21
|
schema.nodes.footnotes_section,
|
|
22
|
-
schema.nodes.
|
|
22
|
+
schema.nodes.keywords,
|
|
23
23
|
schema.nodes.section,
|
|
24
24
|
schema.nodes.toc_section,
|
|
25
25
|
];
|
|
26
|
-
export const getCoreSectionTitles = (sectionCategory) => {
|
|
27
|
-
const category = coreSectionCategories.find((section) => section._id === sectionCategory);
|
|
28
|
-
if (category) {
|
|
29
|
-
return category.titles.length ? category.titles : [' '];
|
|
30
|
-
}
|
|
31
|
-
throw new Error(`${sectionCategory} not found in core sections`);
|
|
32
|
-
};
|
|
33
26
|
export const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
|
|
34
27
|
export const chooseSectionNodeType = (category) => {
|
|
35
28
|
switch (category) {
|
|
@@ -40,11 +33,7 @@ export const chooseSectionNodeType = (category) => {
|
|
|
40
33
|
case 'MPSectionCategory:endnotes':
|
|
41
34
|
return schema.nodes.footnotes_section;
|
|
42
35
|
case 'MPSectionCategory:keywords':
|
|
43
|
-
return schema.nodes.
|
|
44
|
-
case 'MPSectionCategory:affiliations':
|
|
45
|
-
return schema.nodes.affiliations_section;
|
|
46
|
-
case 'MPSectionCategory:contributors':
|
|
47
|
-
return schema.nodes.contributors_section;
|
|
36
|
+
return schema.nodes.keywords;
|
|
48
37
|
case 'MPSectionCategory:toc':
|
|
49
38
|
return schema.nodes.toc_section;
|
|
50
39
|
default:
|
|
@@ -82,16 +71,12 @@ export const buildSectionCategory = (node) => {
|
|
|
82
71
|
return 'MPSectionCategory:bibliography';
|
|
83
72
|
case schema.nodes.footnotes_section:
|
|
84
73
|
return 'MPSectionCategory:endnotes';
|
|
85
|
-
case schema.nodes.
|
|
74
|
+
case schema.nodes.keywords:
|
|
86
75
|
return 'MPSectionCategory:keywords';
|
|
87
76
|
case schema.nodes.toc_section:
|
|
88
77
|
return 'MPSectionCategory:toc';
|
|
89
78
|
case schema.nodes.graphical_abstract_section:
|
|
90
79
|
return 'MPSectionCategory:abstract-graphical';
|
|
91
|
-
case schema.nodes.affiliations_section:
|
|
92
|
-
return 'MPSectionCategory:affiliations';
|
|
93
|
-
case schema.nodes.contributors_section:
|
|
94
|
-
return 'MPSectionCategory:contributors';
|
|
95
80
|
default:
|
|
96
81
|
return node.attrs.category || undefined;
|
|
97
82
|
}
|
|
@@ -117,6 +102,31 @@ export const chooseSecType = (sectionCategory) => {
|
|
|
117
102
|
return suffix;
|
|
118
103
|
}
|
|
119
104
|
};
|
|
105
|
+
export const getSectionGroupType = (category) => {
|
|
106
|
+
switch (category) {
|
|
107
|
+
case 'MPSectionCategory:abstract':
|
|
108
|
+
case 'MPSectionCategory:abstract-graphical':
|
|
109
|
+
return abstractsType;
|
|
110
|
+
case 'MPSectionCategory:competing-interests':
|
|
111
|
+
case 'MPSectionCategory:con':
|
|
112
|
+
case 'MPSectionCategory:ethics-statement':
|
|
113
|
+
case 'MPSectionCategory:financial-disclosure':
|
|
114
|
+
case 'MPSectionCategory:supplementary-material':
|
|
115
|
+
case 'MPSectionCategory:supported-by':
|
|
116
|
+
case 'MPSectionCategory:availability':
|
|
117
|
+
case 'MPSectionCategory:acknowledgement':
|
|
118
|
+
case 'MPSectionCategory:endnotes':
|
|
119
|
+
case 'MPSectionCategory:bibliography':
|
|
120
|
+
case 'MPSectionCategory:appendices':
|
|
121
|
+
case 'MPSectionCategory:deceased':
|
|
122
|
+
case 'MPSectionCategory:equal':
|
|
123
|
+
case 'MPSectionCategory:present-address':
|
|
124
|
+
case 'MPSectionCategory:presented-at':
|
|
125
|
+
case 'MPSectionCategory:previously-at':
|
|
126
|
+
return backmatterType;
|
|
127
|
+
}
|
|
128
|
+
return bodyType;
|
|
129
|
+
};
|
|
120
130
|
export const chooseSectionCategoryByType = (secType) => {
|
|
121
131
|
switch (secType) {
|
|
122
132
|
case 'abstract':
|
|
@@ -176,16 +186,6 @@ export const chooseSectionCategoryByType = (secType) => {
|
|
|
176
186
|
return 'MPSectionCategory:supported-by';
|
|
177
187
|
case 'ethics-statement':
|
|
178
188
|
return 'MPSectionCategory:ethics-statement';
|
|
179
|
-
case 'body':
|
|
180
|
-
return 'MPSectionCategory:body';
|
|
181
|
-
case 'backmatter':
|
|
182
|
-
return 'MPSectionCategory:backmatter';
|
|
183
|
-
case 'abstracts':
|
|
184
|
-
return 'MPSectionCategory:abstracts';
|
|
185
|
-
case 'affiliations':
|
|
186
|
-
return 'MPSectionCategory:affiliations';
|
|
187
|
-
case 'contributors':
|
|
188
|
-
return 'MPSectionCategory:contributors';
|
|
189
189
|
default:
|
|
190
190
|
return undefined;
|
|
191
191
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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 { parseJATSFront, parseJATSBody,
|
|
16
|
+
export { parseJATSFront, parseJATSBody, parseJATSArticle, } from './parse-jats-article';
|
|
@@ -13,29 +13,26 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Affiliation, BibliographyItem, Contributor } from '@manuscripts/json-schema';
|
|
17
|
-
import { Build } from '../../transformer';
|
|
18
16
|
export declare const jatsBodyTransformations: {
|
|
19
17
|
ensureSection(body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
createFootnotes(footnoteGroups: Element[], createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
18
|
+
createAbstractSection(abstractNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
19
|
+
createAcknowledgmentsSection(ackNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
20
|
+
createFootnotesSection(footnoteGroups: Element[], createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
24
21
|
createAppendixSection(app: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
25
|
-
createFloatsGroupSection(
|
|
26
|
-
|
|
27
|
-
wrapBodySections(doc: Document,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
createFloatsGroupSection(group: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
23
|
+
moveAbstracts(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
24
|
+
wrapBodySections(doc: Document, group: Element): void;
|
|
25
|
+
moveBackSections(doc: Document, group: Element): void;
|
|
26
|
+
moveAcknowledgments(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
27
|
+
moveAppendices(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
28
|
+
createBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
29
|
+
createAbstracts(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
30
|
+
createBackmatter(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
31
|
+
moveSpecialFootnotes(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
32
|
+
moveFootnotes(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
34
33
|
moveCaptionsToEnd(body: Element): void;
|
|
34
|
+
fixTables(body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
35
35
|
moveTableFooterToEnd(body: Element): void;
|
|
36
|
-
moveAffiliationsToBody(doc: Document, affiliations: Build<Affiliation>[] | undefined, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
37
|
-
moveAuthorsToBody(doc: Document, authors: Build<Contributor>[] | undefined, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
38
36
|
moveFloatsGroupToBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
39
|
-
|
|
40
|
-
moveKeywordsToBody(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
37
|
+
createKeywords(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
41
38
|
};
|
|
@@ -13,14 +13,18 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
type
|
|
16
|
+
import { CommentAnnotation, Model } from '@manuscripts/json-schema';
|
|
17
|
+
import { References } from './jats-references';
|
|
18
|
+
export type JATSComment = {
|
|
19
19
|
id: string;
|
|
20
|
-
|
|
20
|
+
text: string;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export
|
|
22
|
+
export type JATSCommentMark = {
|
|
23
|
+
token: string;
|
|
24
|
+
comment: JATSComment;
|
|
25
|
+
};
|
|
26
|
+
export declare const isJATSComment: (node: Node) => boolean;
|
|
27
|
+
export declare const parseJATSComment: (node: Node) => JATSComment | undefined;
|
|
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[];
|
|
@@ -13,20 +13,43 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Journal } from '@manuscripts/json-schema';
|
|
17
16
|
export declare const jatsFrontParser: {
|
|
18
|
-
|
|
17
|
+
parseTitles(element: Element | null, createElement: (tagName: string) => HTMLElement): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Titles>;
|
|
18
|
+
parseCounts(counts: Element | null): {
|
|
19
19
|
wordCount: number | undefined;
|
|
20
20
|
figureCount: number | undefined;
|
|
21
21
|
tableCount: number | undefined;
|
|
22
22
|
equationCount: number | undefined;
|
|
23
23
|
referencesCount: number | undefined;
|
|
24
24
|
genericCounts: {
|
|
25
|
-
count: number;
|
|
25
|
+
count: number | undefined;
|
|
26
26
|
countType: string;
|
|
27
27
|
}[] | undefined;
|
|
28
28
|
} | undefined;
|
|
29
|
-
parseJournal(
|
|
29
|
+
parseJournal(element: Element | null): {
|
|
30
|
+
title: string | undefined;
|
|
31
|
+
templateID?: string | undefined;
|
|
32
|
+
ISSNs: {
|
|
33
|
+
[k: string]: any;
|
|
34
|
+
ISSN: string;
|
|
35
|
+
publicationType?: string | undefined;
|
|
36
|
+
}[];
|
|
37
|
+
abbreviatedTitles: {
|
|
38
|
+
[k: string]: any;
|
|
39
|
+
abbreviatedTitle: string;
|
|
40
|
+
abbrevType?: string | undefined;
|
|
41
|
+
}[];
|
|
42
|
+
journalIdentifiers: {
|
|
43
|
+
[k: string]: any;
|
|
44
|
+
journalID: string;
|
|
45
|
+
journalIDType?: string | undefined;
|
|
46
|
+
}[];
|
|
47
|
+
submittable?: boolean | undefined;
|
|
48
|
+
publisherName: string | undefined;
|
|
49
|
+
_id: string;
|
|
50
|
+
objectType: string;
|
|
51
|
+
contributions?: import("@manuscripts/json-schema/dist/types").Contribution[] | undefined;
|
|
52
|
+
};
|
|
30
53
|
parseDates(historyNode: Element | null): {
|
|
31
54
|
acceptanceDate?: number | undefined;
|
|
32
55
|
correctionDate?: number | undefined;
|
|
@@ -35,18 +58,18 @@ export declare const jatsFrontParser: {
|
|
|
35
58
|
revisionReceiveDate?: number | undefined;
|
|
36
59
|
receiveDate?: number | undefined;
|
|
37
60
|
} | undefined;
|
|
38
|
-
parseSupplements(
|
|
39
|
-
|
|
40
|
-
affiliations: import("../../transformer").Build<import("@manuscripts/json-schema").Affiliation>[];
|
|
61
|
+
parseSupplements(elements: Element[] | null): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Supplement>[];
|
|
62
|
+
parseAffiliations(elements: Element[]): {
|
|
63
|
+
affiliations: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Affiliation>[];
|
|
41
64
|
affiliationIDs: Map<string, string>;
|
|
42
65
|
};
|
|
43
|
-
|
|
44
|
-
footnotes: import("../../transformer").Build<import("@manuscripts/json-schema").Footnote>[];
|
|
66
|
+
parseAuthorNotes(elements: Element[]): {
|
|
67
|
+
footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
|
|
45
68
|
footnoteIDs: Map<string, string>;
|
|
46
69
|
};
|
|
47
|
-
|
|
48
|
-
correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema").Corresponding>[];
|
|
70
|
+
parseCorresp(elements: Element[]): {
|
|
71
|
+
correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Corresponding>[];
|
|
49
72
|
correspondingIDs: Map<string, string>;
|
|
50
73
|
};
|
|
51
|
-
|
|
74
|
+
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>[];
|
|
52
75
|
};
|
|
@@ -25,10 +25,10 @@ export type JournalIdentifier = {
|
|
|
25
25
|
journalID: string;
|
|
26
26
|
journalIDType?: string;
|
|
27
27
|
};
|
|
28
|
-
export declare const parseJournalIdentifiers: (
|
|
29
|
-
export declare const parseJournalAbbreviatedTitles: (
|
|
30
|
-
export declare const parseJournalISSNs: (
|
|
31
|
-
export declare const parseJournalMeta: (
|
|
28
|
+
export declare const parseJournalIdentifiers: (element: Element | null) => JournalIdentifier[];
|
|
29
|
+
export declare const parseJournalAbbreviatedTitles: (element: Element | null) => AbbreviatedTitle[];
|
|
30
|
+
export declare const parseJournalISSNs: (element: Element | null) => ISSN[];
|
|
31
|
+
export declare const parseJournalMeta: (element: Element | null) => {
|
|
32
32
|
abbreviatedTitles: AbbreviatedTitle[];
|
|
33
33
|
journalIdentifiers: JournalIdentifier[];
|
|
34
34
|
ISSNs: ISSN[];
|
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Model } from '@manuscripts/json-schema';
|
|
17
16
|
import { ManuscriptNode } from '../../schema';
|
|
18
|
-
export declare
|
|
19
|
-
export declare const fixBodyPMNode: (output: ManuscriptNode, models: Model[], referenceIdsMap?: Map<string, string>) => {
|
|
20
|
-
warnings: string[];
|
|
21
|
-
replacements: Map<string, string>;
|
|
22
|
-
};
|
|
17
|
+
export declare const updateDocumentIDs: (node: ManuscriptNode, replacements: Map<string, string>) => string[];
|
|
23
18
|
export declare const htmlFromJatsNode: (element: Element | undefined | null, createElement: (tagName: string) => HTMLElement) => string | undefined;
|
|
@@ -13,11 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { References } from './jats-references';
|
|
16
17
|
export declare const jatsReferenceParser: {
|
|
17
|
-
parseReferences(
|
|
18
|
-
references: import("../../transformer/builders").Build<import("@manuscripts/json-schema").BibliographyItem>[];
|
|
19
|
-
referenceIDs: Map<string, string>;
|
|
20
|
-
referenceQueries: Map<string, string[]>;
|
|
21
|
-
};
|
|
22
|
-
parseCrossReferences(crossReferenceNodes: Element[], referenceIDs: Map<string, string>): (import("../../transformer/builders").Build<import("@manuscripts/json-schema").AuxiliaryObjectReference> | import("../../transformer/builders").Build<import("@manuscripts/json-schema").Citation>)[];
|
|
18
|
+
parseReferences(elements: Element[], createElement: (tagName: string) => HTMLElement): References;
|
|
23
19
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BibliographyItem } from '@manuscripts/json-schema';
|
|
2
|
+
import { JATSComment } from './jats-comments';
|
|
3
|
+
export declare class References {
|
|
4
|
+
items: Map<string, BibliographyItem>;
|
|
5
|
+
IDs: Map<string, string>;
|
|
6
|
+
comments: Map<string, JATSComment[]>;
|
|
7
|
+
constructor();
|
|
8
|
+
add(item: BibliographyItem, id: string | null, comments: JATSComment[]): void;
|
|
9
|
+
getBibliographyItems(): BibliographyItem[];
|
|
10
|
+
getComments(id: string): JATSComment[];
|
|
11
|
+
private getValue;
|
|
12
|
+
}
|
|
@@ -13,20 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
export declare const
|
|
20
|
-
|
|
21
|
-
authors: Build<Contributor>[];
|
|
22
|
-
affiliations: Build<Affiliation>[];
|
|
23
|
-
}>;
|
|
24
|
-
export declare const parseJATSReferences: (back: Element | null, body: Element | null, createElement: (tagName: string) => HTMLElement) => {
|
|
25
|
-
references: Model[];
|
|
26
|
-
crossReferences: Model[];
|
|
27
|
-
referenceQueriesMap: Map<string, string[]> | undefined;
|
|
28
|
-
referenceIdsMap: Map<string, string> | undefined;
|
|
29
|
-
};
|
|
30
|
-
export declare const parseJATSBody: (document: Document, body: Element, bibliographyItems: BibliographyItem[] | null, authors: Build<Contributor>[], affiliations: Build<Affiliation>[], refModels: Model[], referenceIdsMap: Map<string, string> | undefined, footnotesOrder?: FootnotesOrder) => ManuscriptNode;
|
|
31
|
-
export declare const parseJATSArticle: (doc: Document) => Promise<Model[]>;
|
|
32
|
-
export declare const getElementsOrder: (node: ManuscriptNode) => ElementsOrder[];
|
|
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,6 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export { parseJATSFront,
|
|
16
|
+
export { parseJATSFront, parseJATSBody, parseJATSArticle, } from './importer';
|
|
17
17
|
export * from './jats-exporter';
|
|
18
18
|
export * from './jats-versions';
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
export type SectionGroupTypeID = 'abstracts' | 'body' | 'backmatter';
|
|
17
|
+
export type SectionGroupType = {
|
|
18
|
+
_id: SectionGroupTypeID;
|
|
19
|
+
title: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const abstractsType: SectionGroupType;
|
|
22
|
+
export declare const bodyType: SectionGroupType;
|
|
23
|
+
export declare const backmatterType: SectionGroupType;
|
|
@@ -13,17 +13,18 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { Model } from '@manuscripts/json-schema';
|
|
16
17
|
import { Node as ProsemirrorNode, ResolvedPos } from 'prosemirror-model';
|
|
17
18
|
import { ManuscriptEditorState, ManuscriptNode } from '../schema';
|
|
18
19
|
export declare function iterateChildren(node: ManuscriptNode, recurse?: boolean): Iterable<ManuscriptNode>;
|
|
19
20
|
export declare const findNodePositions: (state: ManuscriptEditorState, predicate: (node: ManuscriptNode) => boolean) => number[];
|
|
20
21
|
export declare const isInGraphicalAbstractSection: ($pos: ResolvedPos) => boolean;
|
|
21
22
|
export declare const isInBibliographySection: ($pos: ResolvedPos) => boolean;
|
|
22
|
-
export declare const isInAbstractsSection: ($pos: ResolvedPos) => boolean;
|
|
23
23
|
export declare const findParentNodeClosestToPos: ($pos: ResolvedPos, predicate: (node: ProsemirrorNode) => boolean) => {
|
|
24
24
|
pos: number;
|
|
25
25
|
start: number;
|
|
26
26
|
depth: number;
|
|
27
27
|
node: ProsemirrorNode;
|
|
28
28
|
} | undefined;
|
|
29
|
-
export declare const getTrimmedTextContent: (node: Element | Document, querySelector: string) => string | null | undefined;
|
|
29
|
+
export declare const getTrimmedTextContent: (node: Element | Document | null, querySelector: string) => string | null | undefined;
|
|
30
|
+
export declare function modelsEqual(model: Model, model2: Model): boolean;
|
|
@@ -18,7 +18,7 @@ import { Marks, Nodes } from './types';
|
|
|
18
18
|
export * from './groups';
|
|
19
19
|
export * from './types';
|
|
20
20
|
export * from './nodes/comment';
|
|
21
|
-
export * from './nodes/
|
|
21
|
+
export * from './nodes/comments';
|
|
22
22
|
export * from './nodes/attribution';
|
|
23
23
|
export * from './nodes/bibliography_item';
|
|
24
24
|
export * from './nodes/bibliography_element';
|
|
@@ -44,7 +44,7 @@ export * from './nodes/inline_equation';
|
|
|
44
44
|
export * from './nodes/inline_footnote';
|
|
45
45
|
export * from './nodes/keyword';
|
|
46
46
|
export * from './nodes/keywords_element';
|
|
47
|
-
export * from './nodes/
|
|
47
|
+
export * from './nodes/keywords';
|
|
48
48
|
export * from './nodes/link';
|
|
49
49
|
export * from './nodes/list';
|
|
50
50
|
export * from './nodes/listing';
|
|
@@ -65,10 +65,9 @@ export * from './nodes/text';
|
|
|
65
65
|
export * from './nodes/toc_element';
|
|
66
66
|
export * from './nodes/toc_section';
|
|
67
67
|
export * from './nodes/affiliation';
|
|
68
|
-
export * from './nodes/meta_section';
|
|
69
68
|
export * from './nodes/contributor';
|
|
70
69
|
export * from './nodes/table_element_footer';
|
|
71
70
|
export * from './nodes/title';
|
|
72
|
-
export * from './nodes/
|
|
73
|
-
export * from './nodes/
|
|
71
|
+
export * from './nodes/affiliations';
|
|
72
|
+
export * from './nodes/contributors';
|
|
74
73
|
export declare const schema: Schema<Nodes, Marks>;
|
|
@@ -14,12 +14,4 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
-
|
|
18
|
-
interface Attrs {
|
|
19
|
-
id: string;
|
|
20
|
-
}
|
|
21
|
-
export interface MetaSectionNode extends ManuscriptNode {
|
|
22
|
-
attrs: Attrs;
|
|
23
|
-
}
|
|
24
|
-
export declare const metaSection: NodeSpec;
|
|
25
|
-
export {};
|
|
17
|
+
export declare const abstracts: NodeSpec;
|