@manuscripts/transform 1.5.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +34 -55
- package/dist/cjs/lib/section-group-type.js +30 -0
- package/dist/cjs/lib/utils.js +1 -25
- 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 +147 -176
- package/dist/cjs/transformer/encode.js +66 -67
- package/dist/cjs/transformer/highlight-markers.js +48 -36
- package/dist/cjs/transformer/html.js +7 -23
- 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 +34 -55
- package/dist/es/lib/section-group-type.js +27 -0
- package/dist/es/lib/utils.js +0 -22
- 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 +147 -175
- package/dist/es/transformer/encode.js +70 -71
- package/dist/es/transformer/highlight-markers.js +44 -32
- package/dist/es/transformer/html.js +7 -23
- 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 +1 -4
- 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 +4 -4
- package/dist/types/transformer/highlight-markers.d.ts +7 -2
- package/dist/types/transformer/object-types.d.ts +1 -2
- package/dist/types/transformer/section-category.d.ts +4 -3
- package/package.json +1 -6
- 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
|
@@ -424,9 +424,11 @@ export class JATSExporter {
|
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
426
|
this.buildBody = (fragment) => {
|
|
427
|
-
const content = this.serializeFragment(fragment);
|
|
428
427
|
const body = this.document.createElement('body');
|
|
429
|
-
|
|
428
|
+
fragment.forEach((cFragment) => {
|
|
429
|
+
const serializedNode = this.serializeNode(cFragment);
|
|
430
|
+
body.append(...serializedNode.childNodes);
|
|
431
|
+
});
|
|
430
432
|
this.fixBody(body, fragment);
|
|
431
433
|
return body;
|
|
432
434
|
};
|
|
@@ -593,17 +595,19 @@ export class JATSExporter {
|
|
|
593
595
|
const getModel = (id) => id ? this.modelMap.get(id) : undefined;
|
|
594
596
|
const nodes = {
|
|
595
597
|
title: () => '',
|
|
596
|
-
|
|
597
|
-
|
|
598
|
+
affiliations: () => '',
|
|
599
|
+
contributors: () => '',
|
|
598
600
|
table_element_footer: () => ['table-wrap-foot', 0],
|
|
599
601
|
contributor: () => '',
|
|
600
602
|
affiliation: () => '',
|
|
601
|
-
meta_section: () => '',
|
|
602
603
|
attribution: () => ['attrib', 0],
|
|
603
604
|
bibliography_element: () => '',
|
|
604
605
|
bibliography_item: () => '',
|
|
605
|
-
|
|
606
|
-
|
|
606
|
+
comments: () => '',
|
|
607
|
+
keyword_group: () => '',
|
|
608
|
+
body: () => ['body', 0],
|
|
609
|
+
abstracts: () => ['abstract', 0],
|
|
610
|
+
backmatter: () => ['backmatter', 0],
|
|
607
611
|
bibliography_section: (node) => [
|
|
608
612
|
'ref-list',
|
|
609
613
|
{ id: normalizeID(node.attrs.id) },
|
|
@@ -619,26 +623,15 @@ export class JATSExporter {
|
|
|
619
623
|
return ['title', 0];
|
|
620
624
|
},
|
|
621
625
|
citation: (node) => {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
return node.attrs.label;
|
|
625
|
-
}
|
|
626
|
-
const rids = node.attrs
|
|
627
|
-
.embeddedCitationItems.filter((item) => {
|
|
628
|
-
if (!this.modelMap.has(item.bibliographyItem)) {
|
|
629
|
-
warn(`Missing ${item.bibliographyItem} referenced by ${node.attrs.rid}`);
|
|
630
|
-
return false;
|
|
631
|
-
}
|
|
632
|
-
return true;
|
|
633
|
-
});
|
|
626
|
+
const citation = node;
|
|
627
|
+
const rids = citation.attrs.rids;
|
|
634
628
|
if (!rids.length) {
|
|
635
|
-
warn(`${node.attrs.rid} has no confirmed rids`);
|
|
636
629
|
return '';
|
|
637
630
|
}
|
|
638
631
|
const xref = this.document.createElement('xref');
|
|
639
632
|
xref.setAttribute('ref-type', 'bibr');
|
|
640
|
-
xref.setAttribute('rid',
|
|
641
|
-
if (
|
|
633
|
+
xref.setAttribute('rid', normalizeID(rids.join(' ')));
|
|
634
|
+
if (citation.attrs.contents) {
|
|
642
635
|
const text = textFromHTML(node.attrs.contents);
|
|
643
636
|
if (text !== null && text.length) {
|
|
644
637
|
xref.textContent = text;
|
|
@@ -647,41 +640,27 @@ export class JATSExporter {
|
|
|
647
640
|
return xref;
|
|
648
641
|
},
|
|
649
642
|
cross_reference: (node) => {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
return
|
|
643
|
+
const cross = node;
|
|
644
|
+
const rids = cross.attrs.rids;
|
|
645
|
+
if (!rids.length) {
|
|
646
|
+
return cross.attrs.label;
|
|
654
647
|
}
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
648
|
+
const text = cross.attrs.customLabel || cross.attrs.label;
|
|
649
|
+
const model = getModel(rids[0]);
|
|
650
|
+
if (!model) {
|
|
651
|
+
warn('');
|
|
652
|
+
return text;
|
|
659
653
|
}
|
|
660
654
|
const xref = this.document.createElement('xref');
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
if (referencedObject) {
|
|
665
|
-
const refType = chooseRefType(referencedObject.objectType);
|
|
666
|
-
if (refType) {
|
|
667
|
-
xref.setAttribute('ref-type', refType);
|
|
668
|
-
}
|
|
669
|
-
else {
|
|
670
|
-
warn(`Unset ref-type for objectType ${referencedObject.objectType}`);
|
|
671
|
-
}
|
|
655
|
+
const type = chooseRefType(model.objectType);
|
|
656
|
+
if (type) {
|
|
657
|
+
xref.setAttribute('ref-type', type);
|
|
672
658
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
};
|
|
676
|
-
if (auxiliaryObjectReference.referencedObjects) {
|
|
677
|
-
const rid = (_a = auxiliaryObjectReference.referencedObjects) === null || _a === void 0 ? void 0 : _a.map((referencedObject) => getReferencedObjectId(referencedObject)).join(' ');
|
|
678
|
-
xref.setAttribute('rid', rid);
|
|
679
|
-
}
|
|
680
|
-
if (auxiliaryObjectReference.referencedObject) {
|
|
681
|
-
const rid = getReferencedObjectId(auxiliaryObjectReference.referencedObject);
|
|
682
|
-
xref.setAttribute('rid', rid);
|
|
659
|
+
else {
|
|
660
|
+
warn(`Unset ref-type for objectType ${model.objectType}`);
|
|
683
661
|
}
|
|
684
|
-
xref.
|
|
662
|
+
xref.setAttribute('rid', normalizeID(rids.join(' ')));
|
|
663
|
+
xref.textContent = text;
|
|
685
664
|
return xref;
|
|
686
665
|
},
|
|
687
666
|
doc: () => '',
|
|
@@ -749,7 +728,7 @@ export class JATSExporter {
|
|
|
749
728
|
};
|
|
750
729
|
return ['sec', attrs, 0];
|
|
751
730
|
},
|
|
752
|
-
hard_break: () =>
|
|
731
|
+
hard_break: () => '',
|
|
753
732
|
highlight_marker: () => '',
|
|
754
733
|
inline_equation: (node) => {
|
|
755
734
|
const formula = this.document.createElement('inline-formula');
|
|
@@ -776,13 +755,13 @@ export class JATSExporter {
|
|
|
776
755
|
inline_footnote: (node) => {
|
|
777
756
|
const xref = this.document.createElement('xref');
|
|
778
757
|
xref.setAttribute('ref-type', 'fn');
|
|
779
|
-
xref.setAttribute('rid', normalizeID(node.attrs.
|
|
758
|
+
xref.setAttribute('rid', normalizeID(node.attrs.rids.join(' ')));
|
|
780
759
|
xref.textContent = node.attrs.contents;
|
|
781
760
|
return xref;
|
|
782
761
|
},
|
|
783
762
|
keyword: () => '',
|
|
784
763
|
keywords_element: () => '',
|
|
785
|
-
|
|
764
|
+
keywords: () => '',
|
|
786
765
|
link: (node) => {
|
|
787
766
|
const text = node.textContent;
|
|
788
767
|
if (!text) {
|
|
@@ -0,0 +1,27 @@
|
|
|
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 const abstractsType = {
|
|
17
|
+
_id: 'abstracts',
|
|
18
|
+
title: 'Abstracts',
|
|
19
|
+
};
|
|
20
|
+
export const bodyType = {
|
|
21
|
+
_id: 'body',
|
|
22
|
+
title: 'Body',
|
|
23
|
+
};
|
|
24
|
+
export const backmatterType = {
|
|
25
|
+
_id: 'backmatter',
|
|
26
|
+
title: 'Backmatter',
|
|
27
|
+
};
|
package/dist/es/lib/utils.js
CHANGED
|
@@ -54,16 +54,6 @@ export const isInBibliographySection = ($pos) => {
|
|
|
54
54
|
}
|
|
55
55
|
return false;
|
|
56
56
|
};
|
|
57
|
-
const isAbstractsSectionNode = (node) => node.attrs.category === 'MPSectionCategory:abstracts';
|
|
58
|
-
export const isInAbstractsSection = ($pos) => {
|
|
59
|
-
for (let i = $pos.depth; i > 0; i--) {
|
|
60
|
-
const node = $pos.node(i);
|
|
61
|
-
if (isAbstractsSectionNode(node)) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
};
|
|
67
57
|
export const findParentNodeClosestToPos = ($pos, predicate) => {
|
|
68
58
|
for (let i = $pos.depth; i > 0; i--) {
|
|
69
59
|
const node = $pos.node(i);
|
|
@@ -84,15 +74,3 @@ export const getTrimmedTextContent = (node, querySelector) => {
|
|
|
84
74
|
}
|
|
85
75
|
return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
86
76
|
};
|
|
87
|
-
export function modelsEqual(model, model2) {
|
|
88
|
-
for (const v in model) {
|
|
89
|
-
for (const v2 in model2) {
|
|
90
|
-
const prepV = typeof v == 'object' ? JSON.stringify(v) : v;
|
|
91
|
-
const prepV2 = typeof v2 == 'object' ? JSON.stringify(v2) : v2;
|
|
92
|
-
if (prepV !== prepV2) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return true;
|
|
98
|
-
}
|
package/dist/es/schema/index.js
CHANGED
|
@@ -15,20 +15,23 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Schema } from 'prosemirror-model';
|
|
17
17
|
import { bold, code, italic, smallcaps, strikethrough, styled, subscript, superscript, tracked_delete, tracked_insert, underline, } from './marks';
|
|
18
|
+
import { abstracts } from './nodes/abstracts';
|
|
18
19
|
import { affiliation } from './nodes/affiliation';
|
|
19
|
-
import {
|
|
20
|
+
import { affiliations } from './nodes/affiliations';
|
|
20
21
|
import { attribution } from './nodes/attribution';
|
|
22
|
+
import { backmatter } from './nodes/backmatter';
|
|
21
23
|
import { bibliographyElement } from './nodes/bibliography_element';
|
|
22
24
|
import { bibliographyItem } from './nodes/bibliography_item';
|
|
23
25
|
import { bibliographySection } from './nodes/bibliography_section';
|
|
24
26
|
import { blockquoteElement } from './nodes/blockquote_element';
|
|
27
|
+
import { body } from './nodes/body';
|
|
25
28
|
import { caption } from './nodes/caption';
|
|
26
29
|
import { captionTitle } from './nodes/caption_title';
|
|
27
30
|
import { citation } from './nodes/citation';
|
|
28
31
|
import { comment } from './nodes/comment';
|
|
29
|
-
import {
|
|
32
|
+
import { comments } from './nodes/comments';
|
|
30
33
|
import { contributor } from './nodes/contributor';
|
|
31
|
-
import {
|
|
34
|
+
import { contributors } from './nodes/contributors';
|
|
32
35
|
import { crossReference } from './nodes/cross_reference';
|
|
33
36
|
import { doc } from './nodes/doc';
|
|
34
37
|
import { equation } from './nodes/equation';
|
|
@@ -45,15 +48,14 @@ import { highlightMarker } from './nodes/highlight_marker';
|
|
|
45
48
|
import { inlineEquation } from './nodes/inline_equation';
|
|
46
49
|
import { inlineFootnote } from './nodes/inline_footnote';
|
|
47
50
|
import { keyword } from './nodes/keyword';
|
|
51
|
+
import { keywordGroup } from './nodes/keyword_group';
|
|
52
|
+
import { keywords } from './nodes/keywords';
|
|
48
53
|
import { keywordsElement } from './nodes/keywords_element';
|
|
49
|
-
import { keywordsGroup } from './nodes/keywords_group';
|
|
50
|
-
import { keywordsSection } from './nodes/keywords_section';
|
|
51
54
|
import { link } from './nodes/link';
|
|
52
55
|
import { bulletList, listItem, orderedList } from './nodes/list';
|
|
53
56
|
import { listing } from './nodes/listing';
|
|
54
57
|
import { listingElement } from './nodes/listing_element';
|
|
55
58
|
import { manuscript } from './nodes/manuscript';
|
|
56
|
-
import { metaSection } from './nodes/meta_section';
|
|
57
59
|
import { missingFigure } from './nodes/missing_figure';
|
|
58
60
|
import { paragraph } from './nodes/paragraph';
|
|
59
61
|
import { placeholder } from './nodes/placeholder';
|
|
@@ -74,7 +76,7 @@ import { tocSection } from './nodes/toc_section';
|
|
|
74
76
|
export * from './groups';
|
|
75
77
|
export * from './types';
|
|
76
78
|
export * from './nodes/comment';
|
|
77
|
-
export * from './nodes/
|
|
79
|
+
export * from './nodes/comments';
|
|
78
80
|
export * from './nodes/attribution';
|
|
79
81
|
export * from './nodes/bibliography_item';
|
|
80
82
|
export * from './nodes/bibliography_element';
|
|
@@ -100,7 +102,7 @@ export * from './nodes/inline_equation';
|
|
|
100
102
|
export * from './nodes/inline_footnote';
|
|
101
103
|
export * from './nodes/keyword';
|
|
102
104
|
export * from './nodes/keywords_element';
|
|
103
|
-
export * from './nodes/
|
|
105
|
+
export * from './nodes/keywords';
|
|
104
106
|
export * from './nodes/link';
|
|
105
107
|
export * from './nodes/list';
|
|
106
108
|
export * from './nodes/listing';
|
|
@@ -121,12 +123,11 @@ export * from './nodes/text';
|
|
|
121
123
|
export * from './nodes/toc_element';
|
|
122
124
|
export * from './nodes/toc_section';
|
|
123
125
|
export * from './nodes/affiliation';
|
|
124
|
-
export * from './nodes/meta_section';
|
|
125
126
|
export * from './nodes/contributor';
|
|
126
127
|
export * from './nodes/table_element_footer';
|
|
127
128
|
export * from './nodes/title';
|
|
128
|
-
export * from './nodes/
|
|
129
|
-
export * from './nodes/
|
|
129
|
+
export * from './nodes/affiliations';
|
|
130
|
+
export * from './nodes/contributors';
|
|
130
131
|
export const schema = new Schema({
|
|
131
132
|
marks: {
|
|
132
133
|
bold,
|
|
@@ -143,7 +144,7 @@ export const schema = new Schema({
|
|
|
143
144
|
},
|
|
144
145
|
nodes: {
|
|
145
146
|
comment,
|
|
146
|
-
|
|
147
|
+
comments,
|
|
147
148
|
attribution,
|
|
148
149
|
bibliography_item: bibliographyItem,
|
|
149
150
|
bibliography_element: bibliographyElement,
|
|
@@ -153,6 +154,9 @@ export const schema = new Schema({
|
|
|
153
154
|
caption,
|
|
154
155
|
caption_title: captionTitle,
|
|
155
156
|
citation,
|
|
157
|
+
abstracts,
|
|
158
|
+
body,
|
|
159
|
+
backmatter,
|
|
156
160
|
cross_reference: crossReference,
|
|
157
161
|
doc,
|
|
158
162
|
equation,
|
|
@@ -170,8 +174,8 @@ export const schema = new Schema({
|
|
|
170
174
|
inline_footnote: inlineFootnote,
|
|
171
175
|
keyword,
|
|
172
176
|
keywords_element: keywordsElement,
|
|
173
|
-
|
|
174
|
-
|
|
177
|
+
keywords: keywords,
|
|
178
|
+
keyword_group: keywordGroup,
|
|
175
179
|
link,
|
|
176
180
|
list_item: listItem,
|
|
177
181
|
listing,
|
|
@@ -198,11 +202,10 @@ export const schema = new Schema({
|
|
|
198
202
|
toc_element: tocElement,
|
|
199
203
|
toc_section: tocSection,
|
|
200
204
|
affiliation,
|
|
201
|
-
meta_section: metaSection,
|
|
202
205
|
contributor: contributor,
|
|
203
206
|
table_element_footer: tableElementFooter,
|
|
204
|
-
title
|
|
205
|
-
|
|
206
|
-
|
|
207
|
+
title,
|
|
208
|
+
affiliations,
|
|
209
|
+
contributors,
|
|
207
210
|
},
|
|
208
211
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const abstracts = {
|
|
17
|
+
content: 'sections*',
|
|
18
|
+
atom: true,
|
|
19
|
+
attrs: {
|
|
20
|
+
id: { default: '' },
|
|
21
|
+
},
|
|
22
|
+
group: 'block',
|
|
23
|
+
toDOM: () => ['div', { class: 'abstracts' }, 0],
|
|
24
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
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 const affiliations = {
|
|
17
|
+
content: 'affiliation*',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
},
|
|
21
|
+
group: 'block',
|
|
22
|
+
selectable: false,
|
|
23
|
+
toDOM: () => ['div', { class: 'affiliations' }, 0],
|
|
24
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const backmatter = {
|
|
17
|
+
content: 'sections*',
|
|
18
|
+
atom: true,
|
|
19
|
+
attrs: {
|
|
20
|
+
id: { default: '' },
|
|
21
|
+
},
|
|
22
|
+
group: 'block',
|
|
23
|
+
toDOM: () => ['div', { class: 'backmatter' }, 0],
|
|
24
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* © 2019 Atypon Systems LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export const body = {
|
|
17
|
+
content: 'sections*',
|
|
18
|
+
atom: true,
|
|
19
|
+
attrs: {
|
|
20
|
+
id: { default: '' },
|
|
21
|
+
},
|
|
22
|
+
group: 'block',
|
|
23
|
+
toDOM: () => ['div', { class: 'body' }, 0],
|
|
24
|
+
};
|
|
@@ -19,38 +19,33 @@ export const citation = {
|
|
|
19
19
|
draggable: true,
|
|
20
20
|
atom: true,
|
|
21
21
|
attrs: {
|
|
22
|
-
|
|
22
|
+
id: { default: '' },
|
|
23
|
+
rids: { default: [] },
|
|
23
24
|
contents: { default: '' },
|
|
24
25
|
selectedText: { default: '' },
|
|
25
26
|
dataTracked: { default: null },
|
|
26
|
-
embeddedCitationItems: { default: [] },
|
|
27
27
|
},
|
|
28
28
|
parseDOM: [
|
|
29
29
|
{
|
|
30
30
|
tag: 'span.citation[data-reference-id]',
|
|
31
31
|
getAttrs: (p) => {
|
|
32
|
+
var _a;
|
|
32
33
|
const dom = p;
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
return {
|
|
35
|
+
id: dom.getAttribute('data-id'),
|
|
36
|
+
rids: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
|
|
35
37
|
contents: dom.innerHTML,
|
|
36
38
|
};
|
|
37
|
-
const embeddedCitationAttr = dom.getAttribute('data-reference-embedded-citation');
|
|
38
|
-
if (embeddedCitationAttr) {
|
|
39
|
-
attr['embeddedCitationItems'] = JSON.parse(embeddedCitationAttr);
|
|
40
|
-
}
|
|
41
|
-
return attr;
|
|
42
39
|
},
|
|
43
40
|
},
|
|
44
41
|
],
|
|
45
42
|
toDOM: (node) => {
|
|
46
|
-
const
|
|
43
|
+
const citation = node;
|
|
47
44
|
const dom = document.createElement('span');
|
|
48
45
|
dom.className = 'citation';
|
|
49
|
-
dom.setAttribute('data-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
dom.innerHTML = citationNode.attrs.contents;
|
|
46
|
+
dom.setAttribute('data-id', citation.attrs.id);
|
|
47
|
+
dom.setAttribute('data-reference-id', citation.attrs.rids.join(' '));
|
|
48
|
+
dom.innerHTML = node.attrs.contents;
|
|
54
49
|
return dom;
|
|
55
50
|
},
|
|
56
51
|
};
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export const
|
|
16
|
+
export const comments = {
|
|
17
17
|
content: 'comment*',
|
|
18
18
|
attrs: {
|
|
19
|
-
id: { default: '
|
|
19
|
+
id: { default: '' },
|
|
20
20
|
},
|
|
21
|
-
toDOM: () => ['
|
|
21
|
+
toDOM: () => ['div', { class: 'comments' }, 0],
|
|
22
22
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
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 const contributors = {
|
|
17
|
+
content: 'contributor*',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
},
|
|
21
|
+
group: 'block',
|
|
22
|
+
selectable: false,
|
|
23
|
+
toDOM: () => ['div', { class: 'contributors' }, 0],
|
|
24
|
+
};
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export const
|
|
17
|
-
content: '
|
|
16
|
+
export const coreSection = {
|
|
17
|
+
content: 'sections*',
|
|
18
|
+
atom: true,
|
|
18
19
|
attrs: {
|
|
19
|
-
id: { default: '
|
|
20
|
+
id: { default: '' },
|
|
20
21
|
},
|
|
21
|
-
group: 'block
|
|
22
|
+
group: 'block',
|
|
22
23
|
toDOM: () => ['section', 0],
|
|
23
24
|
};
|
|
@@ -19,7 +19,7 @@ export const crossReference = {
|
|
|
19
19
|
draggable: true,
|
|
20
20
|
atom: true,
|
|
21
21
|
attrs: {
|
|
22
|
-
|
|
22
|
+
rids: { default: [] },
|
|
23
23
|
label: { default: '' },
|
|
24
24
|
customLabel: { default: '' },
|
|
25
25
|
dataTracked: { default: null },
|
|
@@ -28,9 +28,10 @@ export const crossReference = {
|
|
|
28
28
|
{
|
|
29
29
|
tag: 'span.cross-reference',
|
|
30
30
|
getAttrs: (p) => {
|
|
31
|
+
var _a;
|
|
31
32
|
const dom = p;
|
|
32
33
|
return {
|
|
33
|
-
|
|
34
|
+
rids: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
|
|
34
35
|
label: dom.textContent,
|
|
35
36
|
};
|
|
36
37
|
},
|
|
@@ -42,7 +43,7 @@ export const crossReference = {
|
|
|
42
43
|
'span',
|
|
43
44
|
{
|
|
44
45
|
class: 'cross-reference',
|
|
45
|
-
'data-reference-id': crossReferenceNode.attrs.
|
|
46
|
+
'data-reference-id': crossReferenceNode.attrs.rids.join(' '),
|
|
46
47
|
},
|
|
47
48
|
[
|
|
48
49
|
'span',
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export const inlineFootnote = {
|
|
17
17
|
attrs: {
|
|
18
|
-
|
|
18
|
+
rids: { default: [] },
|
|
19
19
|
contents: { default: '' },
|
|
20
20
|
dataTracked: { default: null },
|
|
21
21
|
},
|
|
@@ -27,20 +27,21 @@ export const inlineFootnote = {
|
|
|
27
27
|
{
|
|
28
28
|
tag: 'span.footnote',
|
|
29
29
|
getAttrs: (p) => {
|
|
30
|
+
var _a;
|
|
30
31
|
const dom = p;
|
|
31
32
|
return {
|
|
32
|
-
|
|
33
|
+
rids: ((_a = dom.getAttribute('data-reference-id')) === null || _a === void 0 ? void 0 : _a.split(/\s+/)) || [],
|
|
33
34
|
contents: dom.textContent,
|
|
34
35
|
};
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
],
|
|
38
39
|
toDOM: (node) => {
|
|
39
|
-
const
|
|
40
|
+
const footnoteNode = node;
|
|
40
41
|
const dom = document.createElement('span');
|
|
41
42
|
dom.className = 'footnote';
|
|
42
|
-
dom.setAttribute('data-reference-id',
|
|
43
|
-
dom.textContent =
|
|
43
|
+
dom.setAttribute('data-reference-id', footnoteNode.attrs.rids.join(''));
|
|
44
|
+
dom.textContent = footnoteNode.attrs.contents;
|
|
44
45
|
return dom;
|
|
45
46
|
},
|
|
46
47
|
};
|
|
@@ -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
|
-
export const
|
|
16
|
+
export const keywordGroup = {
|
|
17
17
|
content: 'keyword*',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
@@ -28,11 +28,11 @@ export const keywordsGroup = {
|
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
30
|
toDOM: (node) => {
|
|
31
|
-
const
|
|
31
|
+
const keywordGroupNode = node;
|
|
32
32
|
return [
|
|
33
33
|
'div',
|
|
34
34
|
{
|
|
35
|
-
id:
|
|
35
|
+
id: keywordGroupNode.attrs.id,
|
|
36
36
|
class: 'keywords',
|
|
37
37
|
spellcheck: 'false',
|
|
38
38
|
contenteditable: false,
|
|
@@ -41,4 +41,4 @@ export const keywordsGroup = {
|
|
|
41
41
|
];
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
|
-
export const
|
|
44
|
+
export const isKeywordGroupNode = (node) => node.type === node.type.schema.nodes.keywords_group;
|