@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
|
@@ -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,8 +595,8 @@ 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: () => '',
|
|
@@ -603,7 +605,10 @@ export class JATSExporter {
|
|
|
603
605
|
bibliography_element: () => '',
|
|
604
606
|
bibliography_item: () => '',
|
|
605
607
|
comment_list: () => '',
|
|
606
|
-
|
|
608
|
+
keyword_group: () => '',
|
|
609
|
+
body: () => ['body', 0],
|
|
610
|
+
abstracts: () => ['abstract', 0],
|
|
611
|
+
backmatter: () => ['backmatter', 0],
|
|
607
612
|
bibliography_section: (node) => [
|
|
608
613
|
'ref-list',
|
|
609
614
|
{ id: normalizeID(node.attrs.id) },
|
|
@@ -619,26 +624,15 @@ export class JATSExporter {
|
|
|
619
624
|
return ['title', 0];
|
|
620
625
|
},
|
|
621
626
|
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
|
-
});
|
|
627
|
+
const citation = node;
|
|
628
|
+
const rids = citation.attrs.rids;
|
|
634
629
|
if (!rids.length) {
|
|
635
|
-
warn(`${node.attrs.rid} has no confirmed rids`);
|
|
636
630
|
return '';
|
|
637
631
|
}
|
|
638
632
|
const xref = this.document.createElement('xref');
|
|
639
633
|
xref.setAttribute('ref-type', 'bibr');
|
|
640
|
-
xref.setAttribute('rid',
|
|
641
|
-
if (
|
|
634
|
+
xref.setAttribute('rid', normalizeID(rids.join(' ')));
|
|
635
|
+
if (citation.attrs.contents) {
|
|
642
636
|
const text = textFromHTML(node.attrs.contents);
|
|
643
637
|
if (text !== null && text.length) {
|
|
644
638
|
xref.textContent = text;
|
|
@@ -647,41 +641,27 @@ export class JATSExporter {
|
|
|
647
641
|
return xref;
|
|
648
642
|
},
|
|
649
643
|
cross_reference: (node) => {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
return
|
|
644
|
+
const cross = node;
|
|
645
|
+
const rids = cross.attrs.rids;
|
|
646
|
+
if (!rids.length) {
|
|
647
|
+
return cross.attrs.label;
|
|
654
648
|
}
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
649
|
+
const text = cross.attrs.customLabel || cross.attrs.label;
|
|
650
|
+
const model = getModel(rids[0]);
|
|
651
|
+
if (!model) {
|
|
652
|
+
warn('');
|
|
653
|
+
return text;
|
|
659
654
|
}
|
|
660
655
|
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
|
-
}
|
|
656
|
+
const type = chooseRefType(model.objectType);
|
|
657
|
+
if (type) {
|
|
658
|
+
xref.setAttribute('ref-type', type);
|
|
672
659
|
}
|
|
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);
|
|
660
|
+
else {
|
|
661
|
+
warn(`Unset ref-type for objectType ${model.objectType}`);
|
|
683
662
|
}
|
|
684
|
-
xref.
|
|
663
|
+
xref.setAttribute('rid', normalizeID(rids.join(' ')));
|
|
664
|
+
xref.textContent = text;
|
|
685
665
|
return xref;
|
|
686
666
|
},
|
|
687
667
|
doc: () => '',
|
|
@@ -776,13 +756,13 @@ export class JATSExporter {
|
|
|
776
756
|
inline_footnote: (node) => {
|
|
777
757
|
const xref = this.document.createElement('xref');
|
|
778
758
|
xref.setAttribute('ref-type', 'fn');
|
|
779
|
-
xref.setAttribute('rid', normalizeID(node.attrs.
|
|
759
|
+
xref.setAttribute('rid', normalizeID(node.attrs.rids.join(' ')));
|
|
780
760
|
xref.textContent = node.attrs.contents;
|
|
781
761
|
return xref;
|
|
782
762
|
},
|
|
783
763
|
keyword: () => '',
|
|
784
764
|
keywords_element: () => '',
|
|
785
|
-
|
|
765
|
+
keywords: () => '',
|
|
786
766
|
link: (node) => {
|
|
787
767
|
const text = node.textContent;
|
|
788
768
|
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
|
@@ -84,3 +84,11 @@ export const getTrimmedTextContent = (node, querySelector) => {
|
|
|
84
84
|
}
|
|
85
85
|
return (_b = (_a = node.querySelector(querySelector)) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
86
86
|
};
|
|
87
|
+
export const groupBy = (list, getKey) => list.reduce((previous, currentItem) => {
|
|
88
|
+
const group = getKey(currentItem);
|
|
89
|
+
if (!previous[group]) {
|
|
90
|
+
previous[group] = [];
|
|
91
|
+
}
|
|
92
|
+
previous[group].push(currentItem);
|
|
93
|
+
return previous;
|
|
94
|
+
}, {});
|
package/dist/es/schema/index.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
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
18
|
import { affiliation } from './nodes/affiliation';
|
|
19
|
-
import {
|
|
19
|
+
import { affiliations } from './nodes/affiliations';
|
|
20
20
|
import { attribution } from './nodes/attribution';
|
|
21
21
|
import { bibliographyElement } from './nodes/bibliography_element';
|
|
22
22
|
import { bibliographyItem } from './nodes/bibliography_item';
|
|
@@ -28,7 +28,8 @@ import { citation } from './nodes/citation';
|
|
|
28
28
|
import { comment } from './nodes/comment';
|
|
29
29
|
import { commentList } from './nodes/comment_list';
|
|
30
30
|
import { contributor } from './nodes/contributor';
|
|
31
|
-
import {
|
|
31
|
+
import { contributors } from './nodes/contributors';
|
|
32
|
+
import { coreSection } from './nodes/core_section';
|
|
32
33
|
import { crossReference } from './nodes/cross_reference';
|
|
33
34
|
import { doc } from './nodes/doc';
|
|
34
35
|
import { equation } from './nodes/equation';
|
|
@@ -45,9 +46,9 @@ import { highlightMarker } from './nodes/highlight_marker';
|
|
|
45
46
|
import { inlineEquation } from './nodes/inline_equation';
|
|
46
47
|
import { inlineFootnote } from './nodes/inline_footnote';
|
|
47
48
|
import { keyword } from './nodes/keyword';
|
|
49
|
+
import { keywordGroup } from './nodes/keyword_group';
|
|
50
|
+
import { keywords } from './nodes/keywords';
|
|
48
51
|
import { keywordsElement } from './nodes/keywords_element';
|
|
49
|
-
import { keywordsGroup } from './nodes/keywords_group';
|
|
50
|
-
import { keywordsSection } from './nodes/keywords_section';
|
|
51
52
|
import { link } from './nodes/link';
|
|
52
53
|
import { bulletList, listItem, orderedList } from './nodes/list';
|
|
53
54
|
import { listing } from './nodes/listing';
|
|
@@ -100,7 +101,7 @@ export * from './nodes/inline_equation';
|
|
|
100
101
|
export * from './nodes/inline_footnote';
|
|
101
102
|
export * from './nodes/keyword';
|
|
102
103
|
export * from './nodes/keywords_element';
|
|
103
|
-
export * from './nodes/
|
|
104
|
+
export * from './nodes/keywords';
|
|
104
105
|
export * from './nodes/link';
|
|
105
106
|
export * from './nodes/list';
|
|
106
107
|
export * from './nodes/listing';
|
|
@@ -125,8 +126,8 @@ 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,
|
|
@@ -153,6 +154,9 @@ export const schema = new Schema({
|
|
|
153
154
|
caption,
|
|
154
155
|
caption_title: captionTitle,
|
|
155
156
|
citation,
|
|
157
|
+
abstracts: coreSection,
|
|
158
|
+
body: coreSection,
|
|
159
|
+
backmatter: coreSection,
|
|
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,
|
|
@@ -202,7 +206,7 @@ export const schema = new Schema({
|
|
|
202
206
|
contributor: contributor,
|
|
203
207
|
table_element_footer: tableElementFooter,
|
|
204
208
|
title: title,
|
|
205
|
-
|
|
206
|
-
|
|
209
|
+
affiliations: affiliations,
|
|
210
|
+
contributors: contributors,
|
|
207
211
|
},
|
|
208
212
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { schema } from '../index';
|
|
2
|
+
export const affiliations = {
|
|
2
3
|
content: 'section_title? affiliation*',
|
|
3
4
|
attrs: {
|
|
4
5
|
id: { default: 'META_SECTION_AFFILLIATIONS' },
|
|
5
6
|
dataTracked: { default: null },
|
|
6
7
|
},
|
|
7
|
-
group: 'block
|
|
8
|
+
group: 'block',
|
|
8
9
|
selectable: false,
|
|
9
10
|
parseDOM: [
|
|
10
11
|
{
|
|
@@ -18,15 +19,15 @@ export const affiliationsSection = {
|
|
|
18
19
|
},
|
|
19
20
|
],
|
|
20
21
|
toDOM: (node) => {
|
|
21
|
-
const
|
|
22
|
+
const affiliations = node;
|
|
22
23
|
return [
|
|
23
24
|
'section',
|
|
24
25
|
{
|
|
25
26
|
class: 'affiliations',
|
|
26
|
-
id:
|
|
27
|
+
id: affiliations.attrs.id,
|
|
27
28
|
},
|
|
28
|
-
0
|
|
29
|
+
0,
|
|
29
30
|
];
|
|
30
31
|
},
|
|
31
32
|
};
|
|
32
|
-
export const
|
|
33
|
+
export const isAffiliationsNode = (node) => node.type === schema.nodes.affiliations;
|
|
@@ -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
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { schema } from '../index';
|
|
2
|
+
export const contributors = {
|
|
2
3
|
content: 'section_title? contributor*',
|
|
3
4
|
attrs: {
|
|
4
5
|
id: { default: 'META_SECTION_CONTRIBUTORS' },
|
|
5
6
|
dataTracked: { default: null },
|
|
6
7
|
contents: { default: '' },
|
|
7
8
|
},
|
|
8
|
-
group: 'block
|
|
9
|
+
group: 'block',
|
|
9
10
|
selectable: false,
|
|
10
11
|
parseDOM: [
|
|
11
12
|
{
|
|
@@ -18,15 +19,15 @@ export const contributorsSection = {
|
|
|
18
19
|
},
|
|
19
20
|
],
|
|
20
21
|
toDOM: (node) => {
|
|
21
|
-
const
|
|
22
|
+
const contributors = node;
|
|
22
23
|
return [
|
|
23
24
|
'section',
|
|
24
25
|
{
|
|
25
26
|
class: 'contributors',
|
|
26
|
-
id:
|
|
27
|
+
id: contributors.attrs.id,
|
|
27
28
|
},
|
|
28
29
|
0,
|
|
29
30
|
];
|
|
30
31
|
},
|
|
31
32
|
};
|
|
32
|
-
export const
|
|
33
|
+
export const isContributorsNode = (node) => node.type === schema.nodes.contributors;
|
|
@@ -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 coreSection = {
|
|
17
|
+
content: 'sections*',
|
|
18
|
+
atom: true,
|
|
19
|
+
attrs: {
|
|
20
|
+
id: { default: '' },
|
|
21
|
+
},
|
|
22
|
+
group: 'block',
|
|
23
|
+
toDOM: () => ['section', 0],
|
|
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
|
-
rid: dom.getAttribute('data-reference-id'),
|
|
34
|
+
rid: ((_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;
|
|
@@ -13,13 +13,13 @@
|
|
|
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 keywords = {
|
|
17
17
|
content: 'section_title (keywords_element | placeholder_element)',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
dataTracked: { default: null },
|
|
21
21
|
},
|
|
22
|
-
group: 'block
|
|
22
|
+
group: 'block',
|
|
23
23
|
selectable: false,
|
|
24
24
|
parseDOM: [
|
|
25
25
|
{
|
|
@@ -27,11 +27,11 @@ export const keywordsSection = {
|
|
|
27
27
|
},
|
|
28
28
|
],
|
|
29
29
|
toDOM: (node) => {
|
|
30
|
-
const
|
|
30
|
+
const keywords = node;
|
|
31
31
|
return [
|
|
32
32
|
'div',
|
|
33
33
|
{
|
|
34
|
-
id:
|
|
34
|
+
id: keywords.attrs.id,
|
|
35
35
|
class: 'keywords',
|
|
36
36
|
spellcheck: 'false',
|
|
37
37
|
contenteditable: false,
|
|
@@ -40,4 +40,4 @@ export const keywordsSection = {
|
|
|
40
40
|
];
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
|
-
export const
|
|
43
|
+
export const isKeywordsNode = (node) => node.type === node.type.schema.nodes.keywords;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const manuscript = {
|
|
17
|
-
content: 'title
|
|
17
|
+
content: 'title? contributors? affiliations? keywords? abstracts body backmatter meta_section',
|
|
18
18
|
attrs: {
|
|
19
19
|
id: { default: '' },
|
|
20
20
|
},
|