@manuscripts/transform 1.2.4 → 1.2.5-LEAN-2066
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/jats/importer/jats-body-dom-parser.js +33 -1
- package/dist/cjs/jats/importer/jats-body-transformations.js +67 -12
- package/dist/cjs/jats/importer/jats-comments.js +24 -0
- package/dist/cjs/jats/importer/jats-front-parser.js +0 -25
- package/dist/cjs/jats/importer/parse-jats-article.js +2 -7
- package/dist/cjs/jats/jats-exporter.js +52 -21
- package/dist/cjs/schema/index.js +2 -0
- package/dist/cjs/schema/nodes/keyword.js +1 -2
- package/dist/cjs/schema/nodes/keywords_element.js +2 -1
- package/dist/cjs/schema/nodes/keywords_group.js +48 -0
- package/dist/cjs/schema/nodes/keywords_section.js +1 -1
- package/dist/cjs/schema/nodes/section.js +1 -1
- package/dist/cjs/transformer/decode.js +29 -23
- package/dist/cjs/transformer/encode.js +16 -6
- package/dist/cjs/transformer/node-types.js +1 -0
- package/dist/cjs/transformer/object-types.js +2 -1
- package/dist/cjs/transformer/section-category.js +23 -1
- package/dist/es/jats/importer/jats-body-dom-parser.js +33 -1
- package/dist/es/jats/importer/jats-body-transformations.js +68 -13
- package/dist/es/jats/importer/jats-comments.js +25 -1
- package/dist/es/jats/importer/jats-front-parser.js +1 -26
- package/dist/es/jats/importer/parse-jats-article.js +2 -7
- package/dist/es/jats/jats-exporter.js +52 -21
- package/dist/es/schema/index.js +2 -0
- package/dist/es/schema/nodes/keyword.js +1 -2
- package/dist/es/schema/nodes/keywords_element.js +2 -1
- package/dist/es/schema/nodes/keywords_group.js +44 -0
- package/dist/es/schema/nodes/keywords_section.js +1 -1
- package/dist/es/schema/nodes/section.js +1 -1
- package/dist/es/transformer/decode.js +29 -23
- package/dist/es/transformer/encode.js +17 -7
- package/dist/es/transformer/node-types.js +1 -0
- package/dist/es/transformer/object-types.js +1 -0
- package/dist/es/transformer/section-category.js +19 -1
- package/dist/types/jats/importer/jats-body-transformations.d.ts +8 -1
- package/dist/types/jats/importer/jats-front-parser.d.ts +6 -11
- package/dist/types/jats/jats-exporter.d.ts +2 -0
- package/dist/types/schema/nodes/keywords_group.d.ts +26 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/decode.d.ts +1 -0
- package/dist/types/transformer/object-types.d.ts +2 -1
- package/dist/types/transformer/section-category.d.ts +3 -2
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const keywordsSection = {
|
|
17
|
-
content: '
|
|
17
|
+
content: 'section_title (keywords_element | placeholder_element)',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
dataTracked: { default: null },
|
|
@@ -32,7 +32,7 @@ const choosePageBreakStyle = (element) => {
|
|
|
32
32
|
return PAGE_BREAK_NONE;
|
|
33
33
|
};
|
|
34
34
|
export const section = {
|
|
35
|
-
content: 'section_label? section_title (paragraph | element)*
|
|
35
|
+
content: 'section_label? section_title (paragraph | element)* sections*',
|
|
36
36
|
attrs: {
|
|
37
37
|
id: { default: '' },
|
|
38
38
|
category: { default: '' },
|
|
@@ -265,11 +265,11 @@ export class Decoder {
|
|
|
265
265
|
},
|
|
266
266
|
[ObjectTypes.KeywordsElement]: (data) => {
|
|
267
267
|
const model = data;
|
|
268
|
-
const
|
|
268
|
+
const keywordGroups = this.getKeywordGroups();
|
|
269
269
|
return schema.nodes.keywords_element.create({
|
|
270
270
|
id: model._id,
|
|
271
271
|
paragraphStyle: model.paragraphStyle,
|
|
272
|
-
},
|
|
272
|
+
}, keywordGroups);
|
|
273
273
|
},
|
|
274
274
|
[ObjectTypes.Keyword]: (data) => {
|
|
275
275
|
const model = data;
|
|
@@ -416,9 +416,7 @@ export class Decoder {
|
|
|
416
416
|
const elementNodes = elements
|
|
417
417
|
.map(this.decode)
|
|
418
418
|
.filter(isManuscriptNode);
|
|
419
|
-
const sectionTitle =
|
|
420
|
-
? 'section_title_plain'
|
|
421
|
-
: 'section_title';
|
|
419
|
+
const sectionTitle = 'section_title';
|
|
422
420
|
const sectionTitleNode = model.title
|
|
423
421
|
? this.parseContents(model.title, 'h1', this.getComments(model), {
|
|
424
422
|
topNode: schema.nodes[sectionTitle].create(),
|
|
@@ -562,19 +560,6 @@ export class Decoder {
|
|
|
562
560
|
id: generateNodeID(schema.nodes.section),
|
|
563
561
|
}));
|
|
564
562
|
}
|
|
565
|
-
const keywordsSection = getSections(this.modelMap).filter((section) => section.category === 'MPSectionCategory:keywords');
|
|
566
|
-
const keywords = this.getKeywords();
|
|
567
|
-
if (keywordsSection.length === 0 && keywords.length > 0) {
|
|
568
|
-
const keywordsSection = schema.nodes.keywords_section.createAndFill({
|
|
569
|
-
id: generateNodeID(schema.nodes.keywords_section),
|
|
570
|
-
}, [
|
|
571
|
-
schema.nodes.section_title_plain.create({}, schema.text('Keywords')),
|
|
572
|
-
schema.nodes.keywords_element.create({
|
|
573
|
-
id: generateNodeID(schema.nodes.keywords_element),
|
|
574
|
-
}, keywords),
|
|
575
|
-
]);
|
|
576
|
-
rootSectionNodes.unshift(keywordsSection);
|
|
577
|
-
}
|
|
578
563
|
const contents = rootSectionNodes;
|
|
579
564
|
if (this.comments.size) {
|
|
580
565
|
const comments = schema.nodes.comment_list.createAndFill({
|
|
@@ -622,17 +607,16 @@ export class Decoder {
|
|
|
622
607
|
}
|
|
623
608
|
return parser.parse(template.content.firstElementChild, options);
|
|
624
609
|
};
|
|
625
|
-
this.getKeywords = () => {
|
|
610
|
+
this.getKeywords = (id) => {
|
|
626
611
|
const keywordsOfKind = [];
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
612
|
+
const keywordsByGroup = [...this.modelMap.values()].filter((m) => m.objectType === ObjectTypes.Keyword &&
|
|
613
|
+
m.containedGroup === id);
|
|
614
|
+
for (const model of keywordsByGroup) {
|
|
630
615
|
if (isKeyword(model)) {
|
|
631
616
|
const keyword = this.parseContents(model.name || '', 'div', this.getComments(model), {
|
|
632
617
|
topNode: schema.nodes.keyword.create({
|
|
633
618
|
id: model._id,
|
|
634
619
|
contents: model.name,
|
|
635
|
-
comments: commentNodes.map((c) => c.attrs.id),
|
|
636
620
|
}),
|
|
637
621
|
});
|
|
638
622
|
keywordsOfKind.push(keyword);
|
|
@@ -679,4 +663,26 @@ export class Decoder {
|
|
|
679
663
|
this.modelMap = modelMap;
|
|
680
664
|
this.allowMissingElements = allowMissingElements;
|
|
681
665
|
}
|
|
666
|
+
getKeywordGroups() {
|
|
667
|
+
const kwdGroupNodes = [];
|
|
668
|
+
const kwdGroupsModels = [
|
|
669
|
+
...this.modelMap.values(),
|
|
670
|
+
].filter((model) => model.objectType === ObjectTypes.KeywordGroup);
|
|
671
|
+
if (kwdGroupsModels.length > 0) {
|
|
672
|
+
for (const kwdGroupModel of kwdGroupsModels) {
|
|
673
|
+
const keywords = this.getKeywords(kwdGroupModel._id);
|
|
674
|
+
const commentNodes = this.createCommentsNode(kwdGroupModel);
|
|
675
|
+
commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
676
|
+
const contents = [];
|
|
677
|
+
contents.push(...keywords);
|
|
678
|
+
const kwdGroupNode = schema.nodes.keywords_group.create({
|
|
679
|
+
id: kwdGroupModel._id,
|
|
680
|
+
type: kwdGroupModel.type,
|
|
681
|
+
comments: commentNodes.map((c) => c.attrs.id),
|
|
682
|
+
}, contents);
|
|
683
|
+
kwdGroupNodes.push(kwdGroupNode);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return kwdGroupNodes;
|
|
687
|
+
}
|
|
682
688
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { DOMSerializer } from 'prosemirror-model';
|
|
17
17
|
import serializeToXML from 'w3c-xmlserializer';
|
|
18
18
|
import { iterateChildren } from '../lib/utils';
|
|
19
|
-
import { isHighlightMarkerNode, isSectionNode, schema, } from '../schema';
|
|
19
|
+
import { hasGroup, isHighlightMarkerNode, isSectionNode, schema, } from '../schema';
|
|
20
20
|
import { buildAttribution } from './builders';
|
|
21
21
|
import { extractHighlightMarkers, isHighlightableModel, } from './highlight-markers';
|
|
22
22
|
import { nodeTypesMap } from './node-types';
|
|
@@ -154,6 +154,15 @@ const childElements = (node) => {
|
|
|
154
154
|
});
|
|
155
155
|
return nodes;
|
|
156
156
|
};
|
|
157
|
+
const sectionChildElementIds = (node) => {
|
|
158
|
+
const nodes = [];
|
|
159
|
+
node.forEach((childNode) => {
|
|
160
|
+
if (!hasGroup(childNode.type, 'sections')) {
|
|
161
|
+
nodes.push(childNode);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
return nodes.map((childNode) => childNode.attrs.id).filter((id) => id);
|
|
165
|
+
};
|
|
157
166
|
const attributeOfNodeType = (node, type, attribute) => {
|
|
158
167
|
for (const child of iterateChildren(node)) {
|
|
159
168
|
if (child.type.name === type) {
|
|
@@ -393,18 +402,21 @@ const encoders = {
|
|
|
393
402
|
SVGGlyphs: svgDefs(node.attrs.SVGRepresentation),
|
|
394
403
|
}),
|
|
395
404
|
keyword: (node, parent) => ({
|
|
396
|
-
|
|
405
|
+
containedGroup: parent.attrs.id,
|
|
397
406
|
name: keywordContents(node),
|
|
398
407
|
}),
|
|
399
408
|
keywords_element: (node) => ({
|
|
400
|
-
contents:
|
|
409
|
+
contents: '<div></div>',
|
|
401
410
|
elementType: 'div',
|
|
402
411
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
403
412
|
}),
|
|
413
|
+
keywords_group: (node) => ({
|
|
414
|
+
type: node.attrs.type,
|
|
415
|
+
}),
|
|
404
416
|
keywords_section: (node, parent, path, priority) => ({
|
|
405
417
|
category: buildSectionCategory(node),
|
|
406
418
|
priority: priority.value++,
|
|
407
|
-
title: inlineContentsOfNodeType(node, node.type.schema.nodes.
|
|
419
|
+
title: inlineContentsOfNodeType(node, node.type.schema.nodes.section_title),
|
|
408
420
|
path: path.concat([node.attrs.id]),
|
|
409
421
|
elementIDs: childElements(node)
|
|
410
422
|
.map((childNode) => childNode.attrs.id)
|
|
@@ -441,9 +453,7 @@ const encoders = {
|
|
|
441
453
|
label: inlineContentsOfNodeType(node, node.type.schema.nodes.section_label) ||
|
|
442
454
|
undefined,
|
|
443
455
|
path: path.concat([node.attrs.id]),
|
|
444
|
-
elementIDs:
|
|
445
|
-
.map((childNode) => childNode.attrs.id)
|
|
446
|
-
.filter((id) => id),
|
|
456
|
+
elementIDs: sectionChildElementIds(node),
|
|
447
457
|
titleSuppressed: node.attrs.titleSuppressed || undefined,
|
|
448
458
|
generatedLabel: node.attrs.generatedLabel || undefined,
|
|
449
459
|
pageBreakStyle: node.attrs.pageBreakStyle || undefined,
|
|
@@ -38,6 +38,7 @@ export const nodeTypesMap = new Map([
|
|
|
38
38
|
[schema.nodes.keyword, ObjectTypes.Keyword],
|
|
39
39
|
[schema.nodes.keywords_element, ObjectTypes.KeywordsElement],
|
|
40
40
|
[schema.nodes.keywords_section, ObjectTypes.Section],
|
|
41
|
+
[schema.nodes.keywords_group, ObjectTypes.KeywordGroup],
|
|
41
42
|
[schema.nodes.listing, ObjectTypes.Listing],
|
|
42
43
|
[schema.nodes.listing_element, ObjectTypes.ListingElement],
|
|
43
44
|
[schema.nodes.manuscript, ObjectTypes.Manuscript],
|
|
@@ -50,3 +50,4 @@ export const isManuscript = hasObjectType(ObjectTypes.Manuscript);
|
|
|
50
50
|
export const isTable = hasObjectType(ObjectTypes.Table);
|
|
51
51
|
export const isUserProfile = hasObjectType(ObjectTypes.UserProfile);
|
|
52
52
|
export const isCommentAnnotation = hasObjectType(ObjectTypes.CommentAnnotation);
|
|
53
|
+
export const isKeyword = hasObjectType(ObjectTypes.Keyword);
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
16
|
+
import sectionCategories from '@manuscripts/data/dist/shared/section-categories.json';
|
|
17
|
+
import { ObjectTypes, } from '@manuscripts/json-schema';
|
|
17
18
|
import { schema } from '../schema';
|
|
18
19
|
const sectionNodeTypes = [
|
|
19
20
|
schema.nodes.bibliography_section,
|
|
@@ -22,6 +23,17 @@ const sectionNodeTypes = [
|
|
|
22
23
|
schema.nodes.section,
|
|
23
24
|
schema.nodes.toc_section,
|
|
24
25
|
];
|
|
26
|
+
const sectionCategoriesMap = new Map(sectionCategories.map((section) => [
|
|
27
|
+
section._id,
|
|
28
|
+
section,
|
|
29
|
+
]));
|
|
30
|
+
export const getSectionTitles = (sectionCategory) => {
|
|
31
|
+
const category = sectionCategoriesMap.get(sectionCategory);
|
|
32
|
+
if (category) {
|
|
33
|
+
return category.titles.length ? category.titles : [' '];
|
|
34
|
+
}
|
|
35
|
+
throw new Error(`${sectionCategory} not found in section categories`);
|
|
36
|
+
};
|
|
25
37
|
export const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
|
|
26
38
|
export const chooseSectionNodeType = (category) => {
|
|
27
39
|
switch (category) {
|
|
@@ -152,6 +164,12 @@ export const chooseSectionCategoryByType = (secType) => {
|
|
|
152
164
|
return 'MPSectionCategory:supported-by';
|
|
153
165
|
case 'ethics-statement':
|
|
154
166
|
return 'MPSectionCategory:ethics-statement';
|
|
167
|
+
case 'body':
|
|
168
|
+
return 'MPSectionCategory:body';
|
|
169
|
+
case 'backmatter':
|
|
170
|
+
return 'MPSectionCategory:backmatter';
|
|
171
|
+
case 'abstracts':
|
|
172
|
+
return 'MPSectionCategory:abstracts';
|
|
155
173
|
default:
|
|
156
174
|
return undefined;
|
|
157
175
|
}
|
|
@@ -22,10 +22,17 @@ export declare const jatsBodyTransformations: {
|
|
|
22
22
|
createFootnotes(footnoteGroups: Element[], createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
23
23
|
createAppendixSection(app: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
24
24
|
createFloatsGroupSection(floatsGroup: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
|
|
25
|
+
moveAbstractsIntoContainer(doc: Document, abstractsContainer: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
26
|
+
wrapBodySections(doc: Document, bodyContainer: Element): void;
|
|
27
|
+
moveBackSectionsIntoContainer(doc: Document, backmatterContainer: Element): void;
|
|
28
|
+
moveAcknowledgmentsIntoContainer(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
29
|
+
moveAppendicesIntoContainer(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
30
|
+
moveBibliographyIntoContainer(doc: Document, backmatterContainer: Element, references: BibliographyItem[] | null, createElement: (tagName: string) => HTMLElement): void;
|
|
25
31
|
moveSectionsToBody(doc: Document, body: Element, references: BibliographyItem[] | null, createElement: (tagName: string) => HTMLElement): void;
|
|
26
|
-
mapFootnotesToSections(doc: Document,
|
|
32
|
+
mapFootnotesToSections(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
27
33
|
moveCaptionsToEnd(body: Element): void;
|
|
28
34
|
moveTableFooterToEnd(body: Element): void;
|
|
29
35
|
moveFloatsGroupToBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
30
36
|
moveBlockNodesFromParagraph(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
37
|
+
moveKeywordsToBody(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
|
|
31
38
|
};
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Journal
|
|
17
|
-
import { Build } from '../../transformer/builders';
|
|
16
|
+
import { Journal } from '@manuscripts/json-schema';
|
|
18
17
|
export declare const jatsFrontParser: {
|
|
19
18
|
parseCounts(counts: Element | null | undefined): {
|
|
20
19
|
wordCount: number | undefined;
|
|
@@ -28,10 +27,6 @@ export declare const jatsFrontParser: {
|
|
|
28
27
|
}[] | undefined;
|
|
29
28
|
} | undefined;
|
|
30
29
|
parseJournal(journalMeta: Element | null): Partial<Journal>;
|
|
31
|
-
parseKeywords(keywordGroupNodes?: NodeListOf<Element> | null): {
|
|
32
|
-
groups: Build<KeywordGroup>[];
|
|
33
|
-
keywords: Build<Keyword>[];
|
|
34
|
-
};
|
|
35
30
|
parseDates(historyNode: Element | null): {
|
|
36
31
|
acceptanceDate?: number | undefined;
|
|
37
32
|
correctionDate?: number | undefined;
|
|
@@ -40,18 +35,18 @@ export declare const jatsFrontParser: {
|
|
|
40
35
|
revisionReceiveDate?: number | undefined;
|
|
41
36
|
receiveDate?: number | undefined;
|
|
42
37
|
} | undefined;
|
|
43
|
-
parseSupplements(supplementNodes: Element[] | null): Build<import("@manuscripts/json-schema").Supplement>[];
|
|
38
|
+
parseSupplements(supplementNodes: Element[] | null): import("../../transformer/builders").Build<import("@manuscripts/json-schema").Supplement>[];
|
|
44
39
|
parseAffiliationNodes(affiliationNodes: Element[]): {
|
|
45
|
-
affiliations: Build<import("@manuscripts/json-schema").Affiliation>[];
|
|
40
|
+
affiliations: import("../../transformer/builders").Build<import("@manuscripts/json-schema").Affiliation>[];
|
|
46
41
|
affiliationIDs: Map<string, string>;
|
|
47
42
|
};
|
|
48
43
|
parseFootnoteNodes(footnoteNodes: Element[]): {
|
|
49
|
-
footnotes: Build<import("@manuscripts/json-schema").Footnote>[];
|
|
44
|
+
footnotes: import("../../transformer/builders").Build<import("@manuscripts/json-schema").Footnote>[];
|
|
50
45
|
footnoteIDs: Map<string, string>;
|
|
51
46
|
};
|
|
52
47
|
parseCorrespNodes(correspNodes: Element[]): {
|
|
53
|
-
correspondingList: Build<import("@manuscripts/json-schema").Corresponding>[];
|
|
48
|
+
correspondingList: import("../../transformer/builders").Build<import("@manuscripts/json-schema").Corresponding>[];
|
|
54
49
|
correspondingIDs: Map<string, string>;
|
|
55
50
|
};
|
|
56
|
-
parseAuthorNodes(authorNodes: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): Build<import("@manuscripts/json-schema").Contributor>[];
|
|
51
|
+
parseAuthorNodes(authorNodes: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): import("../../transformer/builders").Build<import("@manuscripts/json-schema").Contributor>[];
|
|
57
52
|
};
|
|
@@ -63,6 +63,8 @@ export declare class JATSExporter {
|
|
|
63
63
|
private fixBody;
|
|
64
64
|
private changeTag;
|
|
65
65
|
private fixTable;
|
|
66
|
+
private unwrapBody;
|
|
67
|
+
private removeBackContainer;
|
|
66
68
|
private moveAbstracts;
|
|
67
69
|
private moveSectionsToBack;
|
|
68
70
|
sectionToFootnote: (section: Element, fnType: string) => HTMLElement;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { NodeSpec } from 'prosemirror-model';
|
|
17
|
+
import { ManuscriptNode } from '../types';
|
|
18
|
+
interface Attrs {
|
|
19
|
+
id: string;
|
|
20
|
+
}
|
|
21
|
+
export interface KeywordsGroupNode extends ManuscriptNode {
|
|
22
|
+
attrs: Attrs;
|
|
23
|
+
}
|
|
24
|
+
export declare const keywordsGroup: NodeSpec;
|
|
25
|
+
export declare const isKeywordsGroupNode: (node: ManuscriptNode) => node is KeywordsGroupNode;
|
|
26
|
+
export {};
|
|
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
|
|
|
17
17
|
import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
|
|
18
18
|
import { EditorView, NodeView } from 'prosemirror-view';
|
|
19
19
|
export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
|
|
20
|
-
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section';
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keywords_group' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { CommentAnnotation, Figure, Manuscript, Model, ObjectTypes, Table } from '@manuscripts/json-schema';
|
|
16
|
+
import { CommentAnnotation, Figure, Keyword, Manuscript, Model, ObjectTypes, Table } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptModel, UserProfileWithAvatar } from './models';
|
|
18
18
|
export declare enum ExtraObjectTypes {
|
|
19
19
|
PlaceholderElement = "MPPlaceholderElement"
|
|
@@ -27,3 +27,4 @@ export declare const isManuscript: (model: Model) => model is Manuscript;
|
|
|
27
27
|
export declare const isTable: (model: Model) => model is Table;
|
|
28
28
|
export declare const isUserProfile: (model: Model) => model is UserProfileWithAvatar;
|
|
29
29
|
export declare const isCommentAnnotation: (model: Model) => model is CommentAnnotation;
|
|
30
|
+
export declare const isKeyword: (model: Model) => model is Keyword;
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Element } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptNode, ManuscriptNodeType } from '../schema';
|
|
18
|
+
export declare const getSectionTitles: (sectionCategory: SectionCategory) => string[];
|
|
18
19
|
export declare const isAnySectionNode: (node: ManuscriptNode) => boolean;
|
|
19
|
-
export type SectionCategory = 'MPSectionCategory:abstract' | 'MPSectionCategory:abstract-teaser' | 'MPSectionCategory:abstract-graphical' | 'MPSectionCategory:acknowledgement' | 'MPSectionCategory:availability' | 'MPSectionCategory:bibliography' | 'MPSectionCategory:conclusions' | 'MPSectionCategory:discussion' | 'MPSectionCategory:endnotes' | 'MPSectionCategory:introduction' | 'MPSectionCategory:keywords' | 'MPSectionCategory:materials-method' | 'MPSectionCategory:results' | 'MPSectionCategory:toc' | 'MPSectionCategory:floating-element' | 'MPSectionCategory:appendices' | 'MPSectionCategory:competing-interests' | 'MPSectionCategory:financial-disclosure' | 'MPSectionCategory:con' | 'MPSectionCategory:deceased' | 'MPSectionCategory:equal' | 'MPSectionCategory:present-address' | 'MPSectionCategory:presented-at' | 'MPSectionCategory:previously-at' | 'MPSectionCategory:supplementary-material' | 'MPSectionCategory:supported-by' | 'MPSectionCategory:ethics-statement';
|
|
20
|
-
export type SecType = 'abstract' | 'abstract-teaser' | 'abstract-graphical' | 'acknowledgments' | 'availability' | 'bibliography' | 'conclusions' | 'data-availability' | 'discussion' | 'endnotes' | 'intro' | 'keywords' | 'materials' | 'methods' | 'results' | 'toc' | 'floating-element' | 'appendices' | 'competing-interests' | 'financial-disclosure' | 'con' | 'deceased' | 'equal' | 'present-address' | 'presented-at' | 'previously-at' | 'supplementary-material' | 'supported-by' | 'ethics-statement';
|
|
20
|
+
export type SectionCategory = 'MPSectionCategory:abstract' | 'MPSectionCategory:abstract-teaser' | 'MPSectionCategory:abstract-graphical' | 'MPSectionCategory:acknowledgement' | 'MPSectionCategory:availability' | 'MPSectionCategory:bibliography' | 'MPSectionCategory:conclusions' | 'MPSectionCategory:discussion' | 'MPSectionCategory:endnotes' | 'MPSectionCategory:introduction' | 'MPSectionCategory:keywords' | 'MPSectionCategory:materials-method' | 'MPSectionCategory:results' | 'MPSectionCategory:toc' | 'MPSectionCategory:floating-element' | 'MPSectionCategory:appendices' | 'MPSectionCategory:competing-interests' | 'MPSectionCategory:financial-disclosure' | 'MPSectionCategory:con' | 'MPSectionCategory:deceased' | 'MPSectionCategory:equal' | 'MPSectionCategory:present-address' | 'MPSectionCategory:presented-at' | 'MPSectionCategory:previously-at' | 'MPSectionCategory:supplementary-material' | 'MPSectionCategory:supported-by' | 'MPSectionCategory:ethics-statement' | 'MPSectionCategory:body' | 'MPSectionCategory:abstracts' | 'MPSectionCategory:backmatter';
|
|
21
|
+
export type SecType = 'abstract' | 'abstract-teaser' | 'abstract-graphical' | 'acknowledgments' | 'availability' | 'bibliography' | 'conclusions' | 'data-availability' | 'discussion' | 'endnotes' | 'intro' | 'keywords' | 'materials' | 'methods' | 'results' | 'toc' | 'floating-element' | 'appendices' | 'competing-interests' | 'financial-disclosure' | 'con' | 'deceased' | 'equal' | 'present-address' | 'presented-at' | 'previously-at' | 'supplementary-material' | 'supported-by' | 'ethics-statement' | 'abstracts' | 'body' | 'backmatter';
|
|
21
22
|
export declare const chooseSectionNodeType: (category?: SectionCategory) => ManuscriptNodeType;
|
|
22
23
|
export declare const chooseSectionLableName: (type?: SecType) => string;
|
|
23
24
|
export declare const guessSectionCategory: (elements: Element[]) => SectionCategory | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.5-LEAN-2066",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"version": "yarn build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@manuscripts/json-schema": "^2.0.
|
|
32
|
+
"@manuscripts/json-schema": "^2.0.2",
|
|
33
33
|
"debug": "^4.3.4",
|
|
34
34
|
"jszip": "^3.10.1",
|
|
35
35
|
"mathjax-full": "^3.2.2",
|