@manuscripts/transform 1.5.6 → 1.5.7-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 +32 -52
- package/dist/cjs/lib/section-group-type.js +30 -0
- package/dist/cjs/lib/utils.js +10 -1
- package/dist/cjs/schema/index.js +15 -11
- package/dist/cjs/schema/nodes/{affiliations_section.js → affiliations.js} +9 -8
- package/dist/cjs/schema/nodes/citation.js +10 -15
- package/dist/cjs/schema/nodes/{contributors_section.js → contributors.js} +8 -7
- package/dist/cjs/schema/nodes/core_section.js +27 -0
- package/dist/cjs/schema/nodes/cross_reference.js +4 -3
- package/dist/cjs/schema/nodes/graphical_abstract_section.js +1 -0
- 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 +1 -1
- package/dist/cjs/transformer/builders.js +9 -86
- package/dist/cjs/transformer/decode.js +110 -113
- package/dist/cjs/transformer/encode.js +46 -29
- package/dist/cjs/transformer/highlight-markers.js +4 -4
- package/dist/cjs/transformer/html.js +4 -19
- 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 -5
- package/dist/cjs/transformer/object-types.js +1 -2
- package/dist/cjs/transformer/section-category.js +35 -17
- 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 +32 -52
- package/dist/es/lib/section-group-type.js +27 -0
- package/dist/es/lib/utils.js +8 -0
- package/dist/es/schema/index.js +15 -11
- package/dist/es/schema/nodes/{affiliations_section.js → affiliations.js} +7 -6
- package/dist/es/schema/nodes/citation.js +10 -15
- package/dist/es/schema/nodes/{contributors_section.js → contributors.js} +6 -5
- package/dist/es/schema/nodes/core_section.js +24 -0
- package/dist/es/schema/nodes/cross_reference.js +4 -3
- package/dist/es/schema/nodes/graphical_abstract_section.js +1 -0
- 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 +1 -1
- package/dist/es/transformer/builders.js +6 -73
- package/dist/es/transformer/decode.js +111 -114
- package/dist/es/transformer/encode.js +47 -30
- package/dist/es/transformer/highlight-markers.js +1 -1
- package/dist/es/transformer/html.js +4 -19
- 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 -5
- package/dist/es/transformer/object-types.js +0 -1
- package/dist/es/transformer/section-category.js +33 -15
- 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 +31 -0
- package/dist/types/lib/utils.d.ts +2 -1
- package/dist/types/schema/index.d.ts +3 -3
- package/dist/types/schema/nodes/affiliations.d.ts +11 -0
- package/dist/types/schema/nodes/citation.d.ts +3 -5
- package/dist/types/schema/nodes/contributors.d.ts +12 -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/{keywords_group.d.ts → keyword_group.d.ts} +3 -3
- package/dist/types/schema/nodes/{keywords_section.d.ts → keywords.d.ts} +3 -3
- 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 +6 -6
- 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 +1 -1
- package/package.json +1 -1
- package/dist/cjs/lib/core-section-categories.js +0 -29
- package/dist/es/lib/core-section-categories.js +0 -26
- 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
|
@@ -18,14 +18,12 @@ 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.
|
|
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;
|
|
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");
|
|
25
25
|
const id_1 = require("./id");
|
|
26
26
|
const timestamp_1 = require("./timestamp");
|
|
27
|
-
exports.DEFAULT_BUNDLE = 'MPBundle:www-zotero-org-styles-nature';
|
|
28
|
-
exports.DEFAULT_PAGE_LAYOUT = 'MPPageLayout:defaultA4';
|
|
29
27
|
const buildProject = (owner) => ({
|
|
30
28
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Project),
|
|
31
29
|
objectType: json_schema_1.ObjectTypes.Project,
|
|
@@ -57,34 +55,14 @@ const buildBibliographicName = (data) => (Object.assign(Object.assign({}, data),
|
|
|
57
55
|
exports.buildBibliographicName = buildBibliographicName;
|
|
58
56
|
const buildBibliographicDate = (data) => (Object.assign(Object.assign({}, data), { _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.BibliographicDate), objectType: json_schema_1.ObjectTypes.BibliographicDate }));
|
|
59
57
|
exports.buildBibliographicDate = buildBibliographicDate;
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
Object.assign(auxiliaryObjectReference, { referencedObjects: rids });
|
|
71
|
-
}
|
|
72
|
-
return auxiliaryObjectReference;
|
|
73
|
-
};
|
|
74
|
-
exports.buildAuxiliaryObjectReference = buildAuxiliaryObjectReference;
|
|
75
|
-
const buildEmbeddedCitationItem = (bibliographyItem) => ({
|
|
76
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.CitationItem),
|
|
77
|
-
objectType: json_schema_1.ObjectTypes.CitationItem,
|
|
78
|
-
bibliographyItem,
|
|
79
|
-
});
|
|
80
|
-
exports.buildEmbeddedCitationItem = buildEmbeddedCitationItem;
|
|
81
|
-
const buildCitation = (containingObject, embeddedCitationItems) => ({
|
|
82
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Citation),
|
|
83
|
-
objectType: json_schema_1.ObjectTypes.Citation,
|
|
84
|
-
containingObject: containingObject || undefined,
|
|
85
|
-
embeddedCitationItems: embeddedCitationItems.map(exports.buildEmbeddedCitationItem),
|
|
86
|
-
});
|
|
87
|
-
exports.buildCitation = buildCitation;
|
|
58
|
+
const buildBibliographyElement = (bibliographyItems) => ({
|
|
59
|
+
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.BibliographyElement),
|
|
60
|
+
objectType: json_schema_1.ObjectTypes.BibliographyElement,
|
|
61
|
+
contents: '',
|
|
62
|
+
elementType: 'div',
|
|
63
|
+
containedObjectIDs: bibliographyItems.map((b) => b._id),
|
|
64
|
+
});
|
|
65
|
+
exports.buildBibliographyElement = buildBibliographyElement;
|
|
88
66
|
const buildKeyword = (name) => ({
|
|
89
67
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Keyword),
|
|
90
68
|
objectType: json_schema_1.ObjectTypes.Keyword,
|
|
@@ -93,21 +71,6 @@ const buildKeyword = (name) => ({
|
|
|
93
71
|
exports.buildKeyword = buildKeyword;
|
|
94
72
|
const buildKeywordGroup = (attributes) => (Object.assign(Object.assign(Object.assign({ _id: (0, id_1.generateID)(json_schema_1.ObjectTypes.KeywordGroup), objectType: json_schema_1.ObjectTypes.KeywordGroup }, (attributes.type && { type: attributes.type })), (attributes.title && { title: attributes.title })), (attributes.label && { label: attributes.label })));
|
|
95
73
|
exports.buildKeywordGroup = buildKeywordGroup;
|
|
96
|
-
const buildManuscriptKeyword = (name) => ({
|
|
97
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.ManuscriptKeyword),
|
|
98
|
-
objectType: json_schema_1.ObjectTypes.ManuscriptKeyword,
|
|
99
|
-
name,
|
|
100
|
-
});
|
|
101
|
-
exports.buildManuscriptKeyword = buildManuscriptKeyword;
|
|
102
|
-
const buildLibraryCollection = (owner, name) => ({
|
|
103
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.LibraryCollection),
|
|
104
|
-
objectType: json_schema_1.ObjectTypes.LibraryCollection,
|
|
105
|
-
owners: [owner],
|
|
106
|
-
writers: [],
|
|
107
|
-
viewers: [],
|
|
108
|
-
name,
|
|
109
|
-
});
|
|
110
|
-
exports.buildLibraryCollection = buildLibraryCollection;
|
|
111
74
|
const buildFigure = (blob) => ({
|
|
112
75
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Figure),
|
|
113
76
|
objectType: json_schema_1.ObjectTypes.Figure,
|
|
@@ -134,13 +97,6 @@ const buildSupplementaryMaterial = (title, href) => ({
|
|
|
134
97
|
href,
|
|
135
98
|
});
|
|
136
99
|
exports.buildSupplementaryMaterial = buildSupplementaryMaterial;
|
|
137
|
-
const buildUserProfileAffiliation = (institution, priority = 0) => ({
|
|
138
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.UserProfileAffiliation),
|
|
139
|
-
objectType: json_schema_1.ObjectTypes.UserProfileAffiliation,
|
|
140
|
-
institution,
|
|
141
|
-
priority,
|
|
142
|
-
});
|
|
143
|
-
exports.buildUserProfileAffiliation = buildUserProfileAffiliation;
|
|
144
100
|
const buildComment = (target, contents = '', selector, contributions, annotationColor) => ({
|
|
145
101
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.CommentAnnotation),
|
|
146
102
|
objectType: json_schema_1.ObjectTypes.CommentAnnotation,
|
|
@@ -159,12 +115,6 @@ const buildNote = (target, source, contents = '') => ({
|
|
|
159
115
|
contents,
|
|
160
116
|
});
|
|
161
117
|
exports.buildNote = buildNote;
|
|
162
|
-
const buildValidation = (results) => ({
|
|
163
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.RequirementsValidation),
|
|
164
|
-
objectType: json_schema_1.ObjectTypes.RequirementsValidation,
|
|
165
|
-
results,
|
|
166
|
-
});
|
|
167
|
-
exports.buildValidation = buildValidation;
|
|
168
118
|
const buildInlineMathFragment = (containingObject, TeXRepresentation) => ({
|
|
169
119
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.InlineMathFragment),
|
|
170
120
|
objectType: json_schema_1.ObjectTypes.InlineMathFragment,
|
|
@@ -227,20 +177,6 @@ const buildColor = (value, priority) => ({
|
|
|
227
177
|
value,
|
|
228
178
|
});
|
|
229
179
|
exports.buildColor = buildColor;
|
|
230
|
-
const buildHighlight = () => ({
|
|
231
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Highlight),
|
|
232
|
-
objectType: json_schema_1.ObjectTypes.Highlight,
|
|
233
|
-
});
|
|
234
|
-
exports.buildHighlight = buildHighlight;
|
|
235
|
-
const buildHighlightMarker = (highlightID, start, offset, field) => ({
|
|
236
|
-
highlightID,
|
|
237
|
-
objectType: json_schema_1.ObjectTypes.HighlightMarker,
|
|
238
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.HighlightMarker),
|
|
239
|
-
start,
|
|
240
|
-
offset,
|
|
241
|
-
field,
|
|
242
|
-
});
|
|
243
|
-
exports.buildHighlightMarker = buildHighlightMarker;
|
|
244
180
|
const buildContribution = (profileID) => ({
|
|
245
181
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Contribution),
|
|
246
182
|
objectType: json_schema_1.ObjectTypes.Contribution,
|
|
@@ -254,13 +190,6 @@ const buildContributorRole = (name) => ({
|
|
|
254
190
|
name,
|
|
255
191
|
});
|
|
256
192
|
exports.buildContributorRole = buildContributorRole;
|
|
257
|
-
const buildInlineStyle = (priority, title) => ({
|
|
258
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.InlineStyle),
|
|
259
|
-
objectType: json_schema_1.ObjectTypes.InlineStyle,
|
|
260
|
-
priority,
|
|
261
|
-
title,
|
|
262
|
-
});
|
|
263
|
-
exports.buildInlineStyle = buildInlineStyle;
|
|
264
193
|
const buildAttribution = () => ({
|
|
265
194
|
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.Attribution),
|
|
266
195
|
objectType: json_schema_1.ObjectTypes.Attribution,
|
|
@@ -271,12 +200,6 @@ const buildJournal = () => ({
|
|
|
271
200
|
objectType: json_schema_1.ObjectTypes.Journal,
|
|
272
201
|
});
|
|
273
202
|
exports.buildJournal = buildJournal;
|
|
274
|
-
const buildStatusLabel = (name) => ({
|
|
275
|
-
_id: (0, id_1.generateID)(json_schema_1.ObjectTypes.StatusLabel),
|
|
276
|
-
objectType: json_schema_1.ObjectTypes.StatusLabel,
|
|
277
|
-
name,
|
|
278
|
-
});
|
|
279
|
-
exports.buildStatusLabel = buildStatusLabel;
|
|
280
203
|
exports.auxiliaryObjectTypes = new Set([
|
|
281
204
|
schema_1.schema.nodes.figure_element,
|
|
282
205
|
schema_1.schema.nodes.table_element,
|
|
@@ -34,6 +34,7 @@ const json_schema_1 = require("@manuscripts/json-schema");
|
|
|
34
34
|
const debug_1 = __importDefault(require("debug"));
|
|
35
35
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
36
36
|
const errors_1 = require("../errors");
|
|
37
|
+
const utils_1 = require("../lib/utils");
|
|
37
38
|
const schema_1 = require("../schema");
|
|
38
39
|
const builders_1 = require("./builders");
|
|
39
40
|
const highlight_markers_1 = require("./highlight-markers");
|
|
@@ -63,18 +64,42 @@ exports.sortSectionsByPriority = sortSectionsByPriority;
|
|
|
63
64
|
const getSections = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Section).sort(exports.sortSectionsByPriority);
|
|
64
65
|
const getAffiliations = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Affiliation);
|
|
65
66
|
const getContributors = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Contributor);
|
|
67
|
+
const getKeywordElements = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordsElement);
|
|
68
|
+
const getKeywordGroups = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.KeywordGroup);
|
|
69
|
+
const getKeywords = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Keyword);
|
|
70
|
+
const getTitles = (modelMap) => (0, exports.getModelsByType)(modelMap, json_schema_1.ObjectTypes.Titles)[0];
|
|
66
71
|
const isManuscriptNode = (model) => model !== null;
|
|
67
72
|
exports.isManuscriptNode = isManuscriptNode;
|
|
68
|
-
const isParagraphElement = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.ParagraphElement);
|
|
69
73
|
const isFootnote = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Footnote);
|
|
70
|
-
const isKeyword = (0, object_types_1.hasObjectType)(json_schema_1.ObjectTypes.Keyword);
|
|
71
|
-
const isKeywordsSection = (model) => model.category === 'MPSectionCategory:keywords';
|
|
72
|
-
const isAffiliationsSection = (model) => model.category === 'MPSectionCategory:affiliations';
|
|
73
|
-
const isContributorsSection = (model) => model.category === 'MPSectionCategory:contributors';
|
|
74
74
|
const hasParentSection = (id) => (section) => section.path &&
|
|
75
75
|
section.path.length > 1 &&
|
|
76
76
|
section.path[section.path.length - 2] === id;
|
|
77
77
|
class Decoder {
|
|
78
|
+
createTitleNode() {
|
|
79
|
+
const titles = getTitles(this.modelMap) || (0, builders_1.buildTitles)();
|
|
80
|
+
return this.decode(titles);
|
|
81
|
+
}
|
|
82
|
+
createAffiliationsNode() {
|
|
83
|
+
const affiliations = getAffiliations(this.modelMap)
|
|
84
|
+
.map((a) => this.decode(a))
|
|
85
|
+
.filter(Boolean);
|
|
86
|
+
return schema_1.schema.nodes.affiliations.createAndFill({}, affiliations);
|
|
87
|
+
}
|
|
88
|
+
createContributorsNode() {
|
|
89
|
+
const contributors = getContributors(this.modelMap)
|
|
90
|
+
.map((c) => this.decode(c))
|
|
91
|
+
.filter(Boolean);
|
|
92
|
+
return schema_1.schema.nodes.contributors.createAndFill({}, contributors);
|
|
93
|
+
}
|
|
94
|
+
createKeywordsNode() {
|
|
95
|
+
const elements = getKeywordElements(this.modelMap)
|
|
96
|
+
.map((e) => this.decode(e))
|
|
97
|
+
.filter(Boolean);
|
|
98
|
+
return schema_1.schema.nodes.keywords.createAndFill({}, [
|
|
99
|
+
schema_1.schema.nodes.section_title.create({}, schema_1.schema.text('Keywords')),
|
|
100
|
+
...elements,
|
|
101
|
+
]);
|
|
102
|
+
}
|
|
78
103
|
createMetaSectionNode() {
|
|
79
104
|
const commentListNode = this.createCommentListNode();
|
|
80
105
|
return schema_1.schema.nodes.meta_section.createAndFill({}, [
|
|
@@ -86,54 +111,51 @@ class Decoder {
|
|
|
86
111
|
...this.comments.values(),
|
|
87
112
|
]);
|
|
88
113
|
}
|
|
89
|
-
handleMissingRootSectionNodes(rootSectionNodes) {
|
|
90
|
-
if (!rootSectionNodes.find((node) => node.type.name === 'affiliations_section')) {
|
|
91
|
-
this.createAffiliationSectionNode(rootSectionNodes);
|
|
92
|
-
}
|
|
93
|
-
if (!rootSectionNodes.find((node) => node.type.name === 'contributors_section')) {
|
|
94
|
-
this.createContributorSectionNode(rootSectionNodes);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
createAffiliationSectionNode(rootSectionNodes) {
|
|
98
|
-
const affiliationNodes = getAffiliations(this.modelMap)
|
|
99
|
-
.map((affiliation) => this.decode(affiliation))
|
|
100
|
-
.filter(Boolean);
|
|
101
|
-
if (affiliationNodes.length) {
|
|
102
|
-
const node = schema_1.schema.nodes.affiliations_section.createAndFill({
|
|
103
|
-
id: (0, id_1.generateNodeID)(schema_1.schema.nodes.section),
|
|
104
|
-
}, affiliationNodes);
|
|
105
|
-
rootSectionNodes.unshift(node);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
createContributorSectionNode(rootSectionNodes) {
|
|
109
|
-
const contributorNodes = getContributors(this.modelMap)
|
|
110
|
-
.map((contributor) => this.decode(contributor))
|
|
111
|
-
.filter(Boolean);
|
|
112
|
-
if (contributorNodes.length) {
|
|
113
|
-
const node = schema_1.schema.nodes.contributors_section.createAndFill({
|
|
114
|
-
id: (0, id_1.generateNodeID)(schema_1.schema.nodes.section),
|
|
115
|
-
}, contributorNodes);
|
|
116
|
-
rootSectionNodes.unshift(node);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
createTitleNode() {
|
|
120
|
-
const titles = (0, exports.getModelsByType)(this.modelMap, json_schema_1.ObjectTypes.Titles)[0] ||
|
|
121
|
-
(0, builders_1.buildTitles)();
|
|
122
|
-
return this.decode(titles);
|
|
123
|
-
}
|
|
124
114
|
createRootSectionNodes() {
|
|
125
|
-
let rootSections = getSections(this.modelMap)
|
|
115
|
+
let rootSections = getSections(this.modelMap)
|
|
116
|
+
.filter((section) => !section.path || section.path.length <= 1)
|
|
117
|
+
.filter((section) => section.category !== 'MPSectionCategory:contributors' &&
|
|
118
|
+
section.category !== 'MPSectionCategory:affiliations' &&
|
|
119
|
+
section.category !== 'MPSectionCategory:keywords');
|
|
126
120
|
rootSections = this.addGeneratedLabels(rootSections);
|
|
127
|
-
const
|
|
121
|
+
const sectionGroups = (0, utils_1.groupBy)(rootSections, (sec) => {
|
|
122
|
+
var _a;
|
|
123
|
+
return (0, section_category_1.chooseCoreSectionBySection)((_a = sec.category) !== null && _a !== void 0 ? _a : '');
|
|
124
|
+
});
|
|
125
|
+
this.ensureCoreSectionsExist(sectionGroups);
|
|
126
|
+
const absSectionNode = sectionGroups['MPSectionCategory:abstracts']
|
|
127
|
+
.map(this.decode)
|
|
128
|
+
.filter(exports.isManuscriptNode);
|
|
129
|
+
const bodySectionNodes = sectionGroups['MPSectionCategory:body']
|
|
130
|
+
.map(this.decode)
|
|
131
|
+
.filter(exports.isManuscriptNode);
|
|
132
|
+
const backmatterSectionNodes = sectionGroups['MPSectionCategory:backmatter']
|
|
128
133
|
.map(this.decode)
|
|
129
134
|
.filter(exports.isManuscriptNode);
|
|
130
|
-
this.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
const abstractCoreSectionNodes = this.createAndFill(schema_1.schema.nodes.abstracts, absSectionNode);
|
|
136
|
+
const bodyCoreSectionNodes = this.createAndFill(schema_1.schema.nodes.body, bodySectionNodes);
|
|
137
|
+
const backmatterCoreSectionNodes = this.createAndFill(schema_1.schema.nodes.backmatter, backmatterSectionNodes);
|
|
138
|
+
return {
|
|
139
|
+
abstracts: abstractCoreSectionNodes,
|
|
140
|
+
body: bodyCoreSectionNodes,
|
|
141
|
+
backmatter: backmatterCoreSectionNodes,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
ensureCoreSectionsExist(coreSections) {
|
|
145
|
+
if (!coreSections['MPSectionCategory:abstracts']) {
|
|
146
|
+
coreSections['MPSectionCategory:abstracts'] = [];
|
|
147
|
+
}
|
|
148
|
+
if (!coreSections['MPSectionCategory:body']) {
|
|
149
|
+
coreSections['MPSectionCategory:body'] = [];
|
|
135
150
|
}
|
|
136
|
-
|
|
151
|
+
if (!coreSections['MPSectionCategory:backmatter']) {
|
|
152
|
+
coreSections['MPSectionCategory:backmatter'] = [];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
createAndFill(nodeType, content) {
|
|
156
|
+
return nodeType.createAndFill({
|
|
157
|
+
id: (0, id_1.generateNodeID)(nodeType),
|
|
158
|
+
}, content);
|
|
137
159
|
}
|
|
138
160
|
createCommentsNode(model) {
|
|
139
161
|
const comments = [];
|
|
@@ -339,19 +361,34 @@ class Decoder {
|
|
|
339
361
|
},
|
|
340
362
|
[json_schema_1.ObjectTypes.KeywordsElement]: (data) => {
|
|
341
363
|
const model = data;
|
|
342
|
-
const keywordGroups = this.
|
|
364
|
+
const keywordGroups = getKeywordGroups(this.modelMap).map((k) => this.decode(k));
|
|
343
365
|
return schema_1.schema.nodes.keywords_element.create({
|
|
344
366
|
id: model._id,
|
|
345
367
|
paragraphStyle: model.paragraphStyle,
|
|
346
368
|
}, keywordGroups);
|
|
347
369
|
},
|
|
370
|
+
[json_schema_1.ObjectTypes.KeywordGroup]: (data) => {
|
|
371
|
+
const keywordGroup = data;
|
|
372
|
+
const keywords = getKeywords(this.modelMap)
|
|
373
|
+
.filter((k) => k.containedGroup === keywordGroup._id)
|
|
374
|
+
.map((k) => this.decode(k));
|
|
375
|
+
const comments = this.createCommentsNode(keywordGroup);
|
|
376
|
+
comments.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
377
|
+
return schema_1.schema.nodes.keyword_group.create({
|
|
378
|
+
id: keywordGroup._id,
|
|
379
|
+
type: keywordGroup.type,
|
|
380
|
+
comments: comments.map((c) => c.attrs.id),
|
|
381
|
+
}, keywords);
|
|
382
|
+
},
|
|
348
383
|
[json_schema_1.ObjectTypes.Keyword]: (data) => {
|
|
349
|
-
const
|
|
384
|
+
const keyword = data;
|
|
385
|
+
const comments = this.createCommentsNode(keyword);
|
|
386
|
+
comments.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
350
387
|
return schema_1.schema.nodes.keyword.create({
|
|
351
|
-
id:
|
|
352
|
-
contents:
|
|
353
|
-
comments:
|
|
354
|
-
}, schema_1.schema.text(
|
|
388
|
+
id: keyword._id,
|
|
389
|
+
contents: keyword.name,
|
|
390
|
+
comments: comments.map((c) => c.attrs.id),
|
|
391
|
+
}, schema_1.schema.text(keyword.name));
|
|
355
392
|
},
|
|
356
393
|
[json_schema_1.ObjectTypes.ListElement]: (data) => {
|
|
357
394
|
const model = data;
|
|
@@ -473,9 +510,6 @@ class Decoder {
|
|
|
473
510
|
for (const id of model.elementIDs) {
|
|
474
511
|
const element = this.getModel(id);
|
|
475
512
|
if (element) {
|
|
476
|
-
if (isKeywordsSection(model) && isParagraphElement(element)) {
|
|
477
|
-
continue;
|
|
478
|
-
}
|
|
479
513
|
elements.push(element);
|
|
480
514
|
}
|
|
481
515
|
else if (this.allowMissingElements) {
|
|
@@ -516,17 +550,11 @@ class Decoder {
|
|
|
516
550
|
const sectionNodeType = (0, section_category_1.chooseSectionNodeType)(sectionCategory);
|
|
517
551
|
const commentNodes = this.createCommentsNode(model);
|
|
518
552
|
commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
content = (sectionLabelNode
|
|
525
|
-
? [sectionLabelNode, sectionTitleNode]
|
|
526
|
-
: [sectionTitleNode])
|
|
527
|
-
.concat(elementNodes)
|
|
528
|
-
.concat(nestedSections);
|
|
529
|
-
}
|
|
553
|
+
const content = (sectionLabelNode
|
|
554
|
+
? [sectionLabelNode, sectionTitleNode]
|
|
555
|
+
: [sectionTitleNode])
|
|
556
|
+
.concat(elementNodes)
|
|
557
|
+
.concat(nestedSections);
|
|
530
558
|
const sectionNode = sectionNodeType.createAndFill({
|
|
531
559
|
id: model._id,
|
|
532
560
|
category: sectionCategory,
|
|
@@ -645,13 +673,21 @@ class Decoder {
|
|
|
645
673
|
};
|
|
646
674
|
this.getModel = (id) => this.modelMap.get(id);
|
|
647
675
|
this.createArticleNode = (manuscriptID) => {
|
|
648
|
-
const
|
|
649
|
-
const
|
|
650
|
-
const
|
|
676
|
+
const title = this.createTitleNode();
|
|
677
|
+
const contributors = this.createContributorsNode();
|
|
678
|
+
const affiliations = this.createAffiliationsNode();
|
|
679
|
+
const keywords = this.createKeywordsNode();
|
|
680
|
+
const { abstracts, body, backmatter } = this.createRootSectionNodes();
|
|
681
|
+
const meta = this.createMetaSectionNode();
|
|
651
682
|
const contents = [
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
683
|
+
title,
|
|
684
|
+
contributors,
|
|
685
|
+
affiliations,
|
|
686
|
+
keywords,
|
|
687
|
+
abstracts,
|
|
688
|
+
body,
|
|
689
|
+
backmatter,
|
|
690
|
+
meta,
|
|
655
691
|
];
|
|
656
692
|
return schema_1.schema.nodes.manuscript.create({
|
|
657
693
|
id: manuscriptID || this.getManuscriptID(),
|
|
@@ -693,23 +729,6 @@ class Decoder {
|
|
|
693
729
|
}
|
|
694
730
|
return parser.parse(template.content.firstElementChild, options);
|
|
695
731
|
};
|
|
696
|
-
this.getKeywords = (id) => {
|
|
697
|
-
const keywordsOfKind = [];
|
|
698
|
-
const keywordsByGroup = [...this.modelMap.values()].filter((m) => m.objectType === json_schema_1.ObjectTypes.Keyword &&
|
|
699
|
-
m.containedGroup === id);
|
|
700
|
-
for (const model of keywordsByGroup) {
|
|
701
|
-
if (isKeyword(model)) {
|
|
702
|
-
const keyword = this.parseContents(model.name || '', 'div', this.getComments(model), {
|
|
703
|
-
topNode: schema_1.schema.nodes.keyword.create({
|
|
704
|
-
id: model._id,
|
|
705
|
-
contents: model.name,
|
|
706
|
-
}),
|
|
707
|
-
});
|
|
708
|
-
keywordsOfKind.push(keyword);
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
return keywordsOfKind;
|
|
712
|
-
};
|
|
713
732
|
this.getManuscriptID = () => {
|
|
714
733
|
for (const item of this.modelMap.values()) {
|
|
715
734
|
if ((0, object_types_1.isManuscript)(item)) {
|
|
@@ -794,27 +813,5 @@ class Decoder {
|
|
|
794
813
|
}
|
|
795
814
|
return listing;
|
|
796
815
|
}
|
|
797
|
-
getKeywordGroups() {
|
|
798
|
-
const kwdGroupNodes = [];
|
|
799
|
-
const kwdGroupsModels = [
|
|
800
|
-
...this.modelMap.values(),
|
|
801
|
-
].filter((model) => model.objectType === json_schema_1.ObjectTypes.KeywordGroup);
|
|
802
|
-
if (kwdGroupsModels.length > 0) {
|
|
803
|
-
for (const kwdGroupModel of kwdGroupsModels) {
|
|
804
|
-
const keywords = this.getKeywords(kwdGroupModel._id);
|
|
805
|
-
const commentNodes = this.createCommentsNode(kwdGroupModel);
|
|
806
|
-
commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
807
|
-
const contents = [];
|
|
808
|
-
contents.push(...keywords);
|
|
809
|
-
const kwdGroupNode = schema_1.schema.nodes.keywords_group.create({
|
|
810
|
-
id: kwdGroupModel._id,
|
|
811
|
-
type: kwdGroupModel.type,
|
|
812
|
-
comments: commentNodes.map((c) => c.attrs.id),
|
|
813
|
-
}, contents);
|
|
814
|
-
kwdGroupNodes.push(kwdGroupNode);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
return kwdGroupNodes;
|
|
818
|
-
}
|
|
819
816
|
}
|
|
820
817
|
exports.Decoder = Decoder;
|
|
@@ -428,34 +428,9 @@ const encoders = {
|
|
|
428
428
|
elementType: 'div',
|
|
429
429
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
430
430
|
}),
|
|
431
|
-
|
|
431
|
+
keyword_group: (node) => ({
|
|
432
432
|
type: node.attrs.type,
|
|
433
433
|
}),
|
|
434
|
-
keywords_section: (node, parent, path, priority) => ({
|
|
435
|
-
category: (0, section_category_1.buildSectionCategory)(node),
|
|
436
|
-
priority: priority.value++,
|
|
437
|
-
title: inlineContentsOfNodeType(node, node.type.schema.nodes.section_title),
|
|
438
|
-
path: path.concat([node.attrs.id]),
|
|
439
|
-
elementIDs: childElements(node)
|
|
440
|
-
.map((childNode) => childNode.attrs.id)
|
|
441
|
-
.filter((id) => id),
|
|
442
|
-
}),
|
|
443
|
-
affiliations_section: (node, parent, path, priority) => ({
|
|
444
|
-
category: (0, section_category_1.buildSectionCategory)(node),
|
|
445
|
-
priority: priority.value++,
|
|
446
|
-
path: path.concat([node.attrs.id]),
|
|
447
|
-
elementIDs: childElements(node)
|
|
448
|
-
.map((childNode) => childNode.attrs.id)
|
|
449
|
-
.filter((id) => id),
|
|
450
|
-
}),
|
|
451
|
-
contributors_section: (node, parent, path, priority) => ({
|
|
452
|
-
category: (0, section_category_1.buildSectionCategory)(node),
|
|
453
|
-
priority: priority.value++,
|
|
454
|
-
path: path.concat([node.attrs.id]),
|
|
455
|
-
elementIDs: childElements(node)
|
|
456
|
-
.map((childNode) => childNode.attrs.id)
|
|
457
|
-
.filter((id) => id),
|
|
458
|
-
}),
|
|
459
434
|
missing_figure: (node) => ({
|
|
460
435
|
position: node.attrs.position || undefined,
|
|
461
436
|
}),
|
|
@@ -577,6 +552,14 @@ const modelFromNode = (node, parent, path, priority) => {
|
|
|
577
552
|
return { model, comments };
|
|
578
553
|
};
|
|
579
554
|
exports.modelFromNode = modelFromNode;
|
|
555
|
+
function isCoreSection(child) {
|
|
556
|
+
return (child.type === schema_1.schema.nodes.abstracts ||
|
|
557
|
+
child.type === schema_1.schema.nodes.body ||
|
|
558
|
+
child.type === schema_1.schema.nodes.backmatter ||
|
|
559
|
+
child.type === schema_1.schema.nodes.affiliations ||
|
|
560
|
+
child.type === schema_1.schema.nodes.contributors ||
|
|
561
|
+
child.type === schema_1.schema.nodes.keywords);
|
|
562
|
+
}
|
|
580
563
|
const encode = (node) => {
|
|
581
564
|
const models = new Map();
|
|
582
565
|
const priority = {
|
|
@@ -584,6 +567,10 @@ const encode = (node) => {
|
|
|
584
567
|
};
|
|
585
568
|
const placeholders = ['placeholder', 'placeholder_element'];
|
|
586
569
|
const addModel = (path, parent) => (child) => {
|
|
570
|
+
if (isCoreSection(child)) {
|
|
571
|
+
child.forEach(addModel([], child));
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
587
574
|
if (!child.attrs.id) {
|
|
588
575
|
return;
|
|
589
576
|
}
|
|
@@ -596,6 +583,9 @@ const encode = (node) => {
|
|
|
596
583
|
if (placeholders.includes(child.type.name)) {
|
|
597
584
|
return;
|
|
598
585
|
}
|
|
586
|
+
if (parent.type === schema_1.schema.nodes.paragraph) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
599
589
|
const { model, comments } = (0, exports.modelFromNode)(child, parent, path, priority);
|
|
600
590
|
if (models.has(model._id)) {
|
|
601
591
|
throw Error(`Encountered duplicate ids in models map while encoding: ${model._id}`);
|
|
@@ -611,12 +601,20 @@ const encode = (node) => {
|
|
|
611
601
|
models.set(model._id, model);
|
|
612
602
|
child.forEach(addModel(path.concat(child.attrs.id), child));
|
|
613
603
|
};
|
|
614
|
-
node.forEach((
|
|
615
|
-
if (
|
|
616
|
-
processMetaSectionNode(
|
|
604
|
+
node.forEach((child) => {
|
|
605
|
+
if (child.type === schema_1.schema.nodes.meta_section) {
|
|
606
|
+
processMetaSectionNode(child, models, priority);
|
|
617
607
|
}
|
|
618
608
|
});
|
|
619
609
|
node.forEach(addModel([], node));
|
|
610
|
+
if (node.type === schema_1.schema.nodes.manuscript) {
|
|
611
|
+
builders_1.auxiliaryObjectTypes.forEach((t) => {
|
|
612
|
+
const order = generateElementOrder(node, t);
|
|
613
|
+
if (order) {
|
|
614
|
+
models.set(order._id, order);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
}
|
|
620
618
|
return models;
|
|
621
619
|
};
|
|
622
620
|
exports.encode = encode;
|
|
@@ -629,3 +627,22 @@ const processMetaSectionNode = (node, models, priority) => {
|
|
|
629
627
|
}
|
|
630
628
|
});
|
|
631
629
|
};
|
|
630
|
+
const generateElementOrder = (node, nodeType) => {
|
|
631
|
+
const ids = [];
|
|
632
|
+
node.descendants((n) => {
|
|
633
|
+
if (n.type === nodeType) {
|
|
634
|
+
ids.push(n.attrs.id);
|
|
635
|
+
}
|
|
636
|
+
return true;
|
|
637
|
+
});
|
|
638
|
+
if (!ids.length) {
|
|
639
|
+
return undefined;
|
|
640
|
+
}
|
|
641
|
+
const type = node_types_1.nodeTypesMap.get(nodeType);
|
|
642
|
+
if (!type) {
|
|
643
|
+
return undefined;
|
|
644
|
+
}
|
|
645
|
+
const order = (0, builders_1.buildElementsOrder)(type);
|
|
646
|
+
order.elements = ids;
|
|
647
|
+
return order;
|
|
648
|
+
};
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.insertHighlightMarkers = exports.extractHighlightMarkers = exports.isHighlightableModel = void 0;
|
|
18
|
+
exports.insertHighlightMarkers = exports.extractHighlightMarkers = exports.isHighlightableModel = exports.highlightableFields = void 0;
|
|
19
19
|
const builders_1 = require("./builders");
|
|
20
|
-
|
|
20
|
+
exports.highlightableFields = [
|
|
21
21
|
'caption',
|
|
22
22
|
'contents',
|
|
23
23
|
'title',
|
|
24
24
|
];
|
|
25
25
|
const isHighlightableModel = (model) => {
|
|
26
|
-
for (const field of highlightableFields) {
|
|
26
|
+
for (const field of exports.highlightableFields) {
|
|
27
27
|
if (field in model) {
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
@@ -32,7 +32,7 @@ const isHighlightableModel = (model) => {
|
|
|
32
32
|
};
|
|
33
33
|
exports.isHighlightableModel = isHighlightableModel;
|
|
34
34
|
const extractHighlightMarkers = (model, commentAnnotationsMap) => {
|
|
35
|
-
for (const field of highlightableFields) {
|
|
35
|
+
for (const field of exports.highlightableFields) {
|
|
36
36
|
let html = model[field];
|
|
37
37
|
if (html === undefined) {
|
|
38
38
|
continue;
|
|
@@ -200,11 +200,9 @@ class HTMLTransformer {
|
|
|
200
200
|
const citationNode = node;
|
|
201
201
|
const element = this.document.createElement('span');
|
|
202
202
|
element.setAttribute('class', 'citation');
|
|
203
|
-
const
|
|
204
|
-
if (
|
|
205
|
-
element.setAttribute('data-reference-ids',
|
|
206
|
-
.map((item) => item.bibliographyItem)
|
|
207
|
-
.join(' '));
|
|
203
|
+
const rids = citationNode.attrs.rids;
|
|
204
|
+
if (rids.length) {
|
|
205
|
+
element.setAttribute('data-reference-ids', rids.join(' '));
|
|
208
206
|
}
|
|
209
207
|
if (citationNode.attrs.contents) {
|
|
210
208
|
element.innerHTML = citationNode.attrs.contents;
|
|
@@ -215,20 +213,7 @@ class HTMLTransformer {
|
|
|
215
213
|
const crossReferenceNode = node;
|
|
216
214
|
const element = this.document.createElement('a');
|
|
217
215
|
element.classList.add('cross-reference');
|
|
218
|
-
|
|
219
|
-
if (auxiliaryObjectReference &&
|
|
220
|
-
auxiliaryObjectReference.referencedObject) {
|
|
221
|
-
if (auxiliaryObjectReference.referencedObject.startsWith('MPFigureElement')) {
|
|
222
|
-
const model = getModel(auxiliaryObjectReference.referencedObject);
|
|
223
|
-
if (model && model.containedObjectIDs.length > 0) {
|
|
224
|
-
element.setAttribute('href', `#${model.containedObjectIDs[0]}`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
element.setAttribute('href', `#${auxiliaryObjectReference.referencedObject}`);
|
|
229
|
-
}
|
|
230
|
-
element.setAttribute('data-reference-ids', crossReferenceNode.attrs.rid);
|
|
231
|
-
}
|
|
216
|
+
element.setAttribute('data-reference-ids', crossReferenceNode.attrs.rids.join(' '));
|
|
232
217
|
element.textContent =
|
|
233
218
|
crossReferenceNode.attrs.customLabel || crossReferenceNode.attrs.label;
|
|
234
219
|
return element;
|
|
@@ -38,6 +38,6 @@ exports.nodeNames = new Map([
|
|
|
38
38
|
[schema_1.schema.nodes.table_element, 'Table'],
|
|
39
39
|
[schema_1.schema.nodes.blockquote_element, 'Block Quote'],
|
|
40
40
|
[schema_1.schema.nodes.pullquote_element, 'Pull Quote'],
|
|
41
|
-
[schema_1.schema.nodes.
|
|
41
|
+
[schema_1.schema.nodes.keywords, 'Section'],
|
|
42
42
|
[schema_1.schema.nodes.toc_section, 'Section'],
|
|
43
43
|
]);
|
|
@@ -50,7 +50,7 @@ const nodeTitle = (node) => {
|
|
|
50
50
|
case nodes.section:
|
|
51
51
|
case nodes.bibliography_section:
|
|
52
52
|
case nodes.footnotes_section:
|
|
53
|
-
case nodes.
|
|
53
|
+
case nodes.keywords:
|
|
54
54
|
case nodes.toc_section:
|
|
55
55
|
case nodes.graphical_abstract_section:
|
|
56
56
|
return snippetOfNodeType(node, nodes.section_title);
|