@manuscripts/transform 2.3.5-LEAN-3519.0 → 2.3.5-LEAN-3608.2
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 +2 -31
- package/dist/cjs/jats/importer/jats-body-transformations.js +0 -12
- package/dist/cjs/jats/importer/jats-parser-utils.js +0 -4
- package/dist/cjs/jats/jats-exporter.js +5 -13
- package/dist/cjs/schema/index.js +1 -5
- package/dist/cjs/schema/nodes/list.js +28 -37
- package/dist/cjs/schema/nodes/table_element_footer.js +1 -1
- package/dist/cjs/transformer/decode.js +4 -25
- package/dist/cjs/transformer/encode.js +3 -22
- package/dist/cjs/transformer/node-names.js +1 -2
- package/dist/cjs/transformer/node-title.js +1 -2
- package/dist/cjs/transformer/node-types.js +1 -2
- package/dist/cjs/transformer/object-types.js +0 -1
- package/dist/es/jats/importer/jats-body-dom-parser.js +2 -31
- package/dist/es/jats/importer/jats-body-transformations.js +0 -12
- package/dist/es/jats/importer/jats-parser-utils.js +0 -4
- package/dist/es/jats/jats-exporter.js +5 -13
- package/dist/es/schema/index.js +2 -6
- package/dist/es/schema/nodes/list.js +27 -36
- package/dist/es/schema/nodes/table_element_footer.js +1 -1
- package/dist/es/transformer/decode.js +4 -25
- package/dist/es/transformer/encode.js +4 -23
- package/dist/es/transformer/node-names.js +1 -2
- package/dist/es/transformer/node-title.js +1 -2
- package/dist/es/transformer/node-types.js +1 -2
- package/dist/es/transformer/object-types.js +0 -1
- package/dist/types/schema/index.d.ts +0 -1
- package/dist/types/schema/nodes/list.d.ts +10 -11
- package/dist/types/schema/types.d.ts +1 -1
- package/dist/types/transformer/object-types.d.ts +1 -2
- package/package.json +1 -1
- package/dist/cjs/schema/nodes/general_table_footnote.js +0 -27
- package/dist/es/schema/nodes/general_table_footnote.js +0 -24
- package/dist/types/schema/nodes/general_table_footnote.d.ts +0 -25
|
@@ -315,24 +315,6 @@ const nodes = [
|
|
|
315
315
|
};
|
|
316
316
|
},
|
|
317
317
|
},
|
|
318
|
-
{
|
|
319
|
-
tag: 'general-table-footnote',
|
|
320
|
-
node: 'general_table_footnote',
|
|
321
|
-
context: 'table_element_footer/',
|
|
322
|
-
getAttrs: (node) => {
|
|
323
|
-
const element = node;
|
|
324
|
-
return {
|
|
325
|
-
id: element.getAttribute('id'),
|
|
326
|
-
};
|
|
327
|
-
},
|
|
328
|
-
getContent: (node) => {
|
|
329
|
-
const generalTableFootnote = schema_1.schema.nodes.paragraph.create();
|
|
330
|
-
const content = exports.jatsBodyDOMParser.parse(node, {
|
|
331
|
-
topNode: generalTableFootnote,
|
|
332
|
-
});
|
|
333
|
-
return prosemirror_model_1.Fragment.from([content]);
|
|
334
|
-
},
|
|
335
|
-
},
|
|
336
318
|
{
|
|
337
319
|
tag: 'fn',
|
|
338
320
|
node: 'footnote',
|
|
@@ -350,19 +332,8 @@ const nodes = [
|
|
|
350
332
|
ignore: true,
|
|
351
333
|
},
|
|
352
334
|
{
|
|
353
|
-
tag: 'list
|
|
354
|
-
node: '
|
|
355
|
-
getAttrs: (node) => {
|
|
356
|
-
const element = node;
|
|
357
|
-
return {
|
|
358
|
-
id: element.getAttribute('id'),
|
|
359
|
-
listStyleType: element.getAttribute('list-type'),
|
|
360
|
-
};
|
|
361
|
-
},
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
tag: 'list[list-type]',
|
|
365
|
-
node: 'ordered_list',
|
|
335
|
+
tag: 'list',
|
|
336
|
+
node: 'list',
|
|
366
337
|
getAttrs: (node) => {
|
|
367
338
|
const element = node;
|
|
368
339
|
return {
|
|
@@ -242,18 +242,6 @@ exports.jatsBodyTransformations = {
|
|
|
242
242
|
}
|
|
243
243
|
tableWrap.insertBefore(colgroup, table.nextSibling);
|
|
244
244
|
}
|
|
245
|
-
const tableFootWrap = tableWrap.querySelector('table-wrap-foot');
|
|
246
|
-
if (tableFootWrap) {
|
|
247
|
-
const paragraphs = tableFootWrap.querySelectorAll(':scope > p');
|
|
248
|
-
if (paragraphs.length) {
|
|
249
|
-
const generalTableFootnote = createElement('general-table-footnote');
|
|
250
|
-
for (const paragraph of paragraphs) {
|
|
251
|
-
removeNodeFromParent(paragraph);
|
|
252
|
-
generalTableFootnote.append(paragraph);
|
|
253
|
-
}
|
|
254
|
-
tableFootWrap.prepend(generalTableFootnote);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
245
|
});
|
|
258
246
|
},
|
|
259
247
|
orderTableFootnote(doc, body) {
|
|
@@ -36,10 +36,6 @@ const updateNodeID = (node, replacements, warnings) => {
|
|
|
36
36
|
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `InlineMathFragment:${(0, uuid_1.v4)()}` });
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
if (node.type === schema_1.schema.nodes.general_table_footnote) {
|
|
40
|
-
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `GeneralTableFootnote:${(0, uuid_1.v4)()}` });
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
39
|
if (!('id' in node.attrs)) {
|
|
44
40
|
return;
|
|
45
41
|
}
|
|
@@ -620,11 +620,14 @@ class JATSExporter {
|
|
|
620
620
|
0,
|
|
621
621
|
],
|
|
622
622
|
blockquote_element: () => ['disp-quote', { 'content-type': 'quote' }, 0],
|
|
623
|
-
|
|
623
|
+
list: (node) => {
|
|
624
624
|
var _a;
|
|
625
625
|
return [
|
|
626
626
|
'list',
|
|
627
|
-
{
|
|
627
|
+
{
|
|
628
|
+
'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'bullet',
|
|
629
|
+
type: node.attrs.type,
|
|
630
|
+
},
|
|
628
631
|
0,
|
|
629
632
|
];
|
|
630
633
|
},
|
|
@@ -679,9 +682,6 @@ class JATSExporter {
|
|
|
679
682
|
equation: (node) => {
|
|
680
683
|
return this.createEquation(node);
|
|
681
684
|
},
|
|
682
|
-
general_table_footnote: (node) => {
|
|
683
|
-
return this.serializeNode(node.child(0));
|
|
684
|
-
},
|
|
685
685
|
inline_equation: (node) => {
|
|
686
686
|
const eqElement = this.document.createElement('inline-formula');
|
|
687
687
|
const equation = this.createEquation(node, true);
|
|
@@ -784,14 +784,6 @@ class JATSExporter {
|
|
|
784
784
|
graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', '');
|
|
785
785
|
return graphic;
|
|
786
786
|
},
|
|
787
|
-
ordered_list: (node) => {
|
|
788
|
-
var _a;
|
|
789
|
-
return [
|
|
790
|
-
'list',
|
|
791
|
-
{ 'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'order' },
|
|
792
|
-
0,
|
|
793
|
-
];
|
|
794
|
-
},
|
|
795
787
|
paragraph: (node) => {
|
|
796
788
|
if (!node.childCount) {
|
|
797
789
|
return '';
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -61,7 +61,6 @@ const figure_element_1 = require("./nodes/figure_element");
|
|
|
61
61
|
const footnote_1 = require("./nodes/footnote");
|
|
62
62
|
const footnotes_element_1 = require("./nodes/footnotes_element");
|
|
63
63
|
const footnotes_section_1 = require("./nodes/footnotes_section");
|
|
64
|
-
const general_table_footnote_1 = require("./nodes/general_table_footnote");
|
|
65
64
|
const graphical_abstract_section_1 = require("./nodes/graphical_abstract_section");
|
|
66
65
|
const hard_break_1 = require("./nodes/hard_break");
|
|
67
66
|
const highlight_marker_1 = require("./nodes/highlight_marker");
|
|
@@ -113,7 +112,6 @@ __exportStar(require("./nodes/equation_element"), exports);
|
|
|
113
112
|
__exportStar(require("./nodes/figcaption"), exports);
|
|
114
113
|
__exportStar(require("./nodes/figure"), exports);
|
|
115
114
|
__exportStar(require("./nodes/figure_element"), exports);
|
|
116
|
-
__exportStar(require("./nodes/general_table_footnote"), exports);
|
|
117
115
|
__exportStar(require("./nodes/footnote"), exports);
|
|
118
116
|
__exportStar(require("./nodes/footnotes_element"), exports);
|
|
119
117
|
__exportStar(require("./nodes/footnotes_section"), exports);
|
|
@@ -172,7 +170,7 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
172
170
|
bibliography_element: bibliography_element_1.bibliographyElement,
|
|
173
171
|
bibliography_section: bibliography_section_1.bibliographySection,
|
|
174
172
|
blockquote_element: blockquote_element_1.blockquoteElement,
|
|
175
|
-
|
|
173
|
+
list: list_1.list,
|
|
176
174
|
caption: caption_1.caption,
|
|
177
175
|
caption_title: caption_title_1.captionTitle,
|
|
178
176
|
citation: citation_1.citation,
|
|
@@ -189,7 +187,6 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
189
187
|
footnote: footnote_1.footnote,
|
|
190
188
|
footnotes_element: footnotes_element_1.footnotesElement,
|
|
191
189
|
footnotes_section: footnotes_section_1.footnotesSection,
|
|
192
|
-
general_table_footnote: general_table_footnote_1.generalTableFootnote,
|
|
193
190
|
graphical_abstract_section: graphical_abstract_section_1.graphicalAbstractSection,
|
|
194
191
|
hard_break: hard_break_1.hardBreak,
|
|
195
192
|
highlight_marker: highlight_marker_1.highlightMarker,
|
|
@@ -205,7 +202,6 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
205
202
|
listing_element: listing_element_1.listingElement,
|
|
206
203
|
manuscript: manuscript_1.manuscript,
|
|
207
204
|
missing_figure: missing_figure_1.missingFigure,
|
|
208
|
-
ordered_list: list_1.orderedList,
|
|
209
205
|
paragraph: paragraph_1.paragraph,
|
|
210
206
|
placeholder: placeholder_1.placeholder,
|
|
211
207
|
placeholder_element: placeholder_element_1.placeholderElement,
|
|
@@ -15,10 +15,19 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.isListNode = exports.listItem = exports.
|
|
18
|
+
exports.isListNode = exports.listItem = exports.list = exports.JATS_HTML_LIST_STYLE_MAPPING = void 0;
|
|
19
19
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
20
20
|
const attributes_1 = require("../../lib/attributes");
|
|
21
|
-
exports.
|
|
21
|
+
exports.JATS_HTML_LIST_STYLE_MAPPING = {
|
|
22
|
+
simple: { style: 'none', type: 'ul' },
|
|
23
|
+
bullet: { style: 'disc', type: 'ul' },
|
|
24
|
+
order: { style: 'decimal', type: 'ol' },
|
|
25
|
+
'alpha-lower': { style: 'lower-alpha', type: 'ol' },
|
|
26
|
+
'alpha-upper': { style: 'upper-alpha', type: 'ol' },
|
|
27
|
+
'roman-lower': { style: 'lower-roman', type: 'ol' },
|
|
28
|
+
'roman-upper': { style: 'upper-roman', type: 'ol' },
|
|
29
|
+
};
|
|
30
|
+
exports.list = {
|
|
22
31
|
content: 'list_item+',
|
|
23
32
|
group: 'block list element',
|
|
24
33
|
attrs: {
|
|
@@ -38,33 +47,6 @@ exports.bulletList = {
|
|
|
38
47
|
};
|
|
39
48
|
},
|
|
40
49
|
},
|
|
41
|
-
],
|
|
42
|
-
toDOM: (node) => {
|
|
43
|
-
const bulletListNode = node;
|
|
44
|
-
return bulletListNode.attrs.id
|
|
45
|
-
? [
|
|
46
|
-
'ul',
|
|
47
|
-
{
|
|
48
|
-
id: bulletListNode.attrs.id,
|
|
49
|
-
'list-type': bulletListNode.attrs.listStyleType,
|
|
50
|
-
class: (0, attributes_1.buildElementClass)(bulletListNode.attrs),
|
|
51
|
-
'data-object-type': json_schema_1.ObjectTypes.ListElement,
|
|
52
|
-
},
|
|
53
|
-
0,
|
|
54
|
-
]
|
|
55
|
-
: ['ul', 0];
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
exports.orderedList = {
|
|
59
|
-
content: 'list_item+',
|
|
60
|
-
group: 'block list element',
|
|
61
|
-
attrs: {
|
|
62
|
-
id: { default: '' },
|
|
63
|
-
listStyleType: { default: null },
|
|
64
|
-
paragraphStyle: { default: '' },
|
|
65
|
-
dataTracked: { default: null },
|
|
66
|
-
},
|
|
67
|
-
parseDOM: [
|
|
68
50
|
{
|
|
69
51
|
tag: 'ol',
|
|
70
52
|
getAttrs: (p) => {
|
|
@@ -77,19 +59,28 @@ exports.orderedList = {
|
|
|
77
59
|
},
|
|
78
60
|
],
|
|
79
61
|
toDOM: (node) => {
|
|
80
|
-
const
|
|
81
|
-
return
|
|
62
|
+
const ListNode = node;
|
|
63
|
+
return exports.JATS_HTML_LIST_STYLE_MAPPING[ListNode.attrs.listStyleType].type === 'ul'
|
|
82
64
|
? [
|
|
83
|
-
'
|
|
65
|
+
'ul',
|
|
84
66
|
{
|
|
85
|
-
id:
|
|
86
|
-
'list-type':
|
|
87
|
-
class: (0, attributes_1.buildElementClass)(
|
|
67
|
+
id: ListNode.attrs.id,
|
|
68
|
+
'list-type': ListNode.attrs.listStyleType,
|
|
69
|
+
class: (0, attributes_1.buildElementClass)(ListNode.attrs),
|
|
88
70
|
'data-object-type': json_schema_1.ObjectTypes.ListElement,
|
|
89
71
|
},
|
|
90
72
|
0,
|
|
91
73
|
]
|
|
92
|
-
: [
|
|
74
|
+
: [
|
|
75
|
+
'ol',
|
|
76
|
+
{
|
|
77
|
+
id: ListNode.attrs.id,
|
|
78
|
+
'list-type': ListNode.attrs.listStyleType,
|
|
79
|
+
class: (0, attributes_1.buildElementClass)(ListNode.attrs),
|
|
80
|
+
'data-object-type': json_schema_1.ObjectTypes.ListElement,
|
|
81
|
+
},
|
|
82
|
+
0,
|
|
83
|
+
];
|
|
93
84
|
},
|
|
94
85
|
};
|
|
95
86
|
exports.listItem = {
|
|
@@ -122,6 +113,6 @@ exports.listItem = {
|
|
|
122
113
|
};
|
|
123
114
|
const isListNode = (node) => {
|
|
124
115
|
const { nodes } = node.type.schema;
|
|
125
|
-
return node.type === nodes.
|
|
116
|
+
return node.type === nodes.list;
|
|
126
117
|
};
|
|
127
118
|
exports.isListNode = isListNode;
|
|
@@ -21,7 +21,7 @@ exports.tableElementFooter = {
|
|
|
21
21
|
id: { default: '' },
|
|
22
22
|
dataTracked: { default: null },
|
|
23
23
|
},
|
|
24
|
-
content: '
|
|
24
|
+
content: '(paragraph | footnotes_element)*',
|
|
25
25
|
group: 'block element',
|
|
26
26
|
toDOM: () => ['table-wrap-foot', 0],
|
|
27
27
|
};
|
|
@@ -38,7 +38,6 @@ const section_group_type_1 = require("../lib/section-group-type");
|
|
|
38
38
|
const schema_1 = require("../schema");
|
|
39
39
|
const builders_1 = require("./builders");
|
|
40
40
|
const highlight_markers_1 = require("./highlight-markers");
|
|
41
|
-
const id_1 = require("./id");
|
|
42
41
|
const object_types_1 = require("./object-types");
|
|
43
42
|
const section_category_1 = require("./section-category");
|
|
44
43
|
const timestamp_1 = require("./timestamp");
|
|
@@ -391,7 +390,7 @@ class Decoder {
|
|
|
391
390
|
switch (model.elementType) {
|
|
392
391
|
case 'ol':
|
|
393
392
|
return this.parseContents(model.contents || '<ol></ol>', undefined, this.getComments(model), {
|
|
394
|
-
topNode: schema_1.schema.nodes.
|
|
393
|
+
topNode: schema_1.schema.nodes.list.create({
|
|
395
394
|
id: model._id,
|
|
396
395
|
listStyleType: model.listStyleType,
|
|
397
396
|
paragraphStyle: model.paragraphStyle,
|
|
@@ -400,7 +399,7 @@ class Decoder {
|
|
|
400
399
|
});
|
|
401
400
|
case 'ul':
|
|
402
401
|
return this.parseContents(model.contents || '<ul></ul>', undefined, this.getComments(model), {
|
|
403
|
-
topNode: schema_1.schema.nodes.
|
|
402
|
+
topNode: schema_1.schema.nodes.list.create({
|
|
404
403
|
id: model._id,
|
|
405
404
|
listStyleType: model.listStyleType,
|
|
406
405
|
paragraphStyle: model.paragraphStyle,
|
|
@@ -493,30 +492,10 @@ class Decoder {
|
|
|
493
492
|
},
|
|
494
493
|
[json_schema_1.ObjectTypes.TableElementFooter]: (data) => {
|
|
495
494
|
const model = data;
|
|
496
|
-
const
|
|
497
|
-
const generalTableFootnotes = [];
|
|
498
|
-
const footnotesElements = [];
|
|
499
|
-
for (const containedObjectID of model.containedObjectIDs) {
|
|
500
|
-
const model = this.modelMap.get(containedObjectID);
|
|
501
|
-
if (model.objectType === json_schema_1.ObjectTypes.ParagraphElement) {
|
|
502
|
-
const paragraph = this.decode(model);
|
|
503
|
-
if (paragraph) {
|
|
504
|
-
generalTableFootnotes.push(paragraph);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
else {
|
|
508
|
-
footnotesElements.push(this.decode(model));
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
if (generalTableFootnotes && generalTableFootnotes.length) {
|
|
512
|
-
contents.push(schema_1.schema.nodes.general_table_footnote.create({ id: (0, id_1.generateID)(object_types_1.ExtraObjectTypes.GeneralTableFootnote) }, [...generalTableFootnotes]));
|
|
513
|
-
}
|
|
514
|
-
if (footnotesElements && footnotesElements.length) {
|
|
515
|
-
contents.push(...footnotesElements);
|
|
516
|
-
}
|
|
495
|
+
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
517
496
|
return schema_1.schema.nodes.table_element_footer.create({
|
|
518
497
|
id: model._id,
|
|
519
|
-
},
|
|
498
|
+
}, content);
|
|
520
499
|
},
|
|
521
500
|
[json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
|
|
522
501
|
const model = data;
|
|
@@ -210,18 +210,6 @@ const containedBibliographyItemIDs = (node) => {
|
|
|
210
210
|
const bibliographyItemNodeType = node.type.schema.nodes.bibliography_item;
|
|
211
211
|
return containedObjectIDs(node, [bibliographyItemNodeType]);
|
|
212
212
|
};
|
|
213
|
-
const tableElementFooterContainedIDs = (node) => {
|
|
214
|
-
const containedGeneralTableFootnoteIDs = containedObjectIDs(node, [
|
|
215
|
-
schema_1.schema.nodes.footnotes_element,
|
|
216
|
-
]);
|
|
217
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
218
|
-
const childNode = node.child(i);
|
|
219
|
-
if (childNode.type === schema_1.schema.nodes.general_table_footnote) {
|
|
220
|
-
containedGeneralTableFootnoteIDs.push(...containedObjectIDs(childNode));
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return containedGeneralTableFootnoteIDs;
|
|
224
|
-
};
|
|
225
213
|
const containedObjectIDs = (node, nodeTypes) => {
|
|
226
214
|
const ids = [];
|
|
227
215
|
for (let i = 0; i < node.childCount; i++) {
|
|
@@ -338,8 +326,8 @@ const encoders = {
|
|
|
338
326
|
placeholderInnerHTML: node.attrs.placeholder || '',
|
|
339
327
|
quoteType: 'block',
|
|
340
328
|
}),
|
|
341
|
-
|
|
342
|
-
elementType:
|
|
329
|
+
list: (node) => ({
|
|
330
|
+
elementType: schema_1.JATS_HTML_LIST_STYLE_MAPPING[node.attrs.listStyleType].type,
|
|
343
331
|
contents: listContents(node),
|
|
344
332
|
listStyleType: node.attrs.listStyleType,
|
|
345
333
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
@@ -394,7 +382,7 @@ const encoders = {
|
|
|
394
382
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
395
383
|
}),
|
|
396
384
|
table_element_footer: (node) => ({
|
|
397
|
-
containedObjectIDs:
|
|
385
|
+
containedObjectIDs: containedObjectIDs(node),
|
|
398
386
|
}),
|
|
399
387
|
author_notes: (node) => ({
|
|
400
388
|
containedObjectIDs: containedObjectIDs(node),
|
|
@@ -432,12 +420,6 @@ const encoders = {
|
|
|
432
420
|
missing_figure: (node) => ({
|
|
433
421
|
position: node.attrs.position || undefined,
|
|
434
422
|
}),
|
|
435
|
-
ordered_list: (node) => ({
|
|
436
|
-
elementType: 'ol',
|
|
437
|
-
contents: listContents(node),
|
|
438
|
-
listStyleType: node.attrs.listStyleType,
|
|
439
|
-
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
440
|
-
}),
|
|
441
423
|
paragraph: (node) => ({
|
|
442
424
|
elementType: 'p',
|
|
443
425
|
contents: contents(node),
|
|
@@ -570,7 +552,6 @@ const containerTypes = [
|
|
|
570
552
|
schema_1.schema.nodes.abstracts,
|
|
571
553
|
schema_1.schema.nodes.body,
|
|
572
554
|
schema_1.schema.nodes.backmatter,
|
|
573
|
-
schema_1.schema.nodes.general_table_footnote,
|
|
574
555
|
];
|
|
575
556
|
const placeholderTypes = [
|
|
576
557
|
schema_1.schema.nodes.placeholder,
|
|
@@ -27,8 +27,7 @@ exports.nodeNames = new Map([
|
|
|
27
27
|
[schema_1.schema.nodes.figure_element, 'Figure'],
|
|
28
28
|
[schema_1.schema.nodes.footnote, 'Footnote'],
|
|
29
29
|
[schema_1.schema.nodes.footnotes_element, 'Notes'],
|
|
30
|
-
[schema_1.schema.nodes.
|
|
31
|
-
[schema_1.schema.nodes.ordered_list, 'Ordered List'],
|
|
30
|
+
[schema_1.schema.nodes.list, 'List'],
|
|
32
31
|
[schema_1.schema.nodes.manuscript, 'Manuscript'],
|
|
33
32
|
[schema_1.schema.nodes.paragraph, 'Paragraph'],
|
|
34
33
|
[schema_1.schema.nodes.section, 'Section'],
|
|
@@ -56,8 +56,7 @@ const nodeTitle = (node) => {
|
|
|
56
56
|
return snippetOfNodeType(node, nodes.section_title);
|
|
57
57
|
case nodes.footnotes_element:
|
|
58
58
|
return node.attrs.collateByKind === 'footnote' ? 'Footnotes' : 'Endnotes';
|
|
59
|
-
case nodes.
|
|
60
|
-
case nodes.bullet_list:
|
|
59
|
+
case nodes.list:
|
|
61
60
|
case nodes.blockquote_element:
|
|
62
61
|
case nodes.footnote:
|
|
63
62
|
case nodes.pullquote_element:
|
|
@@ -27,7 +27,7 @@ exports.nodeTypesMap = new Map([
|
|
|
27
27
|
[schema_1.schema.nodes.bibliography_element, json_schema_1.ObjectTypes.BibliographyElement],
|
|
28
28
|
[schema_1.schema.nodes.bibliography_section, json_schema_1.ObjectTypes.Section],
|
|
29
29
|
[schema_1.schema.nodes.blockquote_element, json_schema_1.ObjectTypes.QuoteElement],
|
|
30
|
-
[schema_1.schema.nodes.
|
|
30
|
+
[schema_1.schema.nodes.list, json_schema_1.ObjectTypes.ListElement],
|
|
31
31
|
[schema_1.schema.nodes.citation, json_schema_1.ObjectTypes.Citation],
|
|
32
32
|
[schema_1.schema.nodes.equation, json_schema_1.ObjectTypes.Equation],
|
|
33
33
|
[schema_1.schema.nodes.equation_element, json_schema_1.ObjectTypes.EquationElement],
|
|
@@ -46,7 +46,6 @@ exports.nodeTypesMap = new Map([
|
|
|
46
46
|
[schema_1.schema.nodes.listing, json_schema_1.ObjectTypes.Listing],
|
|
47
47
|
[schema_1.schema.nodes.listing_element, json_schema_1.ObjectTypes.ListingElement],
|
|
48
48
|
[schema_1.schema.nodes.manuscript, json_schema_1.ObjectTypes.Manuscript],
|
|
49
|
-
[schema_1.schema.nodes.ordered_list, json_schema_1.ObjectTypes.ListElement],
|
|
50
49
|
[schema_1.schema.nodes.paragraph, json_schema_1.ObjectTypes.ParagraphElement],
|
|
51
50
|
[schema_1.schema.nodes.pullquote_element, json_schema_1.ObjectTypes.QuoteElement],
|
|
52
51
|
[schema_1.schema.nodes.section, json_schema_1.ObjectTypes.Section],
|
|
@@ -20,7 +20,6 @@ const json_schema_1 = require("@manuscripts/json-schema");
|
|
|
20
20
|
var ExtraObjectTypes;
|
|
21
21
|
(function (ExtraObjectTypes) {
|
|
22
22
|
ExtraObjectTypes["PlaceholderElement"] = "MPPlaceholderElement";
|
|
23
|
-
ExtraObjectTypes["GeneralTableFootnote"] = "MPGeneralTableFootnote";
|
|
24
23
|
})(ExtraObjectTypes = exports.ExtraObjectTypes || (exports.ExtraObjectTypes = {}));
|
|
25
24
|
exports.elementObjects = [
|
|
26
25
|
json_schema_1.ObjectTypes.BibliographyElement,
|
|
@@ -309,24 +309,6 @@ const nodes = [
|
|
|
309
309
|
};
|
|
310
310
|
},
|
|
311
311
|
},
|
|
312
|
-
{
|
|
313
|
-
tag: 'general-table-footnote',
|
|
314
|
-
node: 'general_table_footnote',
|
|
315
|
-
context: 'table_element_footer/',
|
|
316
|
-
getAttrs: (node) => {
|
|
317
|
-
const element = node;
|
|
318
|
-
return {
|
|
319
|
-
id: element.getAttribute('id'),
|
|
320
|
-
};
|
|
321
|
-
},
|
|
322
|
-
getContent: (node) => {
|
|
323
|
-
const generalTableFootnote = schema.nodes.paragraph.create();
|
|
324
|
-
const content = jatsBodyDOMParser.parse(node, {
|
|
325
|
-
topNode: generalTableFootnote,
|
|
326
|
-
});
|
|
327
|
-
return Fragment.from([content]);
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
312
|
{
|
|
331
313
|
tag: 'fn',
|
|
332
314
|
node: 'footnote',
|
|
@@ -344,19 +326,8 @@ const nodes = [
|
|
|
344
326
|
ignore: true,
|
|
345
327
|
},
|
|
346
328
|
{
|
|
347
|
-
tag: 'list
|
|
348
|
-
node: '
|
|
349
|
-
getAttrs: (node) => {
|
|
350
|
-
const element = node;
|
|
351
|
-
return {
|
|
352
|
-
id: element.getAttribute('id'),
|
|
353
|
-
listStyleType: element.getAttribute('list-type'),
|
|
354
|
-
};
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
tag: 'list[list-type]',
|
|
359
|
-
node: 'ordered_list',
|
|
329
|
+
tag: 'list',
|
|
330
|
+
node: 'list',
|
|
360
331
|
getAttrs: (node) => {
|
|
361
332
|
const element = node;
|
|
362
333
|
return {
|
|
@@ -239,18 +239,6 @@ export const jatsBodyTransformations = {
|
|
|
239
239
|
}
|
|
240
240
|
tableWrap.insertBefore(colgroup, table.nextSibling);
|
|
241
241
|
}
|
|
242
|
-
const tableFootWrap = tableWrap.querySelector('table-wrap-foot');
|
|
243
|
-
if (tableFootWrap) {
|
|
244
|
-
const paragraphs = tableFootWrap.querySelectorAll(':scope > p');
|
|
245
|
-
if (paragraphs.length) {
|
|
246
|
-
const generalTableFootnote = createElement('general-table-footnote');
|
|
247
|
-
for (const paragraph of paragraphs) {
|
|
248
|
-
removeNodeFromParent(paragraph);
|
|
249
|
-
generalTableFootnote.append(paragraph);
|
|
250
|
-
}
|
|
251
|
-
tableFootWrap.prepend(generalTableFootnote);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
242
|
});
|
|
255
243
|
},
|
|
256
244
|
orderTableFootnote(doc, body) {
|
|
@@ -32,10 +32,6 @@ const updateNodeID = (node, replacements, warnings) => {
|
|
|
32
32
|
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `InlineMathFragment:${uuidv4()}` });
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
if (node.type === schema.nodes.general_table_footnote) {
|
|
36
|
-
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `GeneralTableFootnote:${uuidv4()}` });
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
35
|
if (!('id' in node.attrs)) {
|
|
40
36
|
return;
|
|
41
37
|
}
|
|
@@ -612,11 +612,14 @@ export class JATSExporter {
|
|
|
612
612
|
0,
|
|
613
613
|
],
|
|
614
614
|
blockquote_element: () => ['disp-quote', { 'content-type': 'quote' }, 0],
|
|
615
|
-
|
|
615
|
+
list: (node) => {
|
|
616
616
|
var _a;
|
|
617
617
|
return [
|
|
618
618
|
'list',
|
|
619
|
-
{
|
|
619
|
+
{
|
|
620
|
+
'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'bullet',
|
|
621
|
+
type: node.attrs.type,
|
|
622
|
+
},
|
|
620
623
|
0,
|
|
621
624
|
];
|
|
622
625
|
},
|
|
@@ -671,9 +674,6 @@ export class JATSExporter {
|
|
|
671
674
|
equation: (node) => {
|
|
672
675
|
return this.createEquation(node);
|
|
673
676
|
},
|
|
674
|
-
general_table_footnote: (node) => {
|
|
675
|
-
return this.serializeNode(node.child(0));
|
|
676
|
-
},
|
|
677
677
|
inline_equation: (node) => {
|
|
678
678
|
const eqElement = this.document.createElement('inline-formula');
|
|
679
679
|
const equation = this.createEquation(node, true);
|
|
@@ -776,14 +776,6 @@ export class JATSExporter {
|
|
|
776
776
|
graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', '');
|
|
777
777
|
return graphic;
|
|
778
778
|
},
|
|
779
|
-
ordered_list: (node) => {
|
|
780
|
-
var _a;
|
|
781
|
-
return [
|
|
782
|
-
'list',
|
|
783
|
-
{ 'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'order' },
|
|
784
|
-
0,
|
|
785
|
-
];
|
|
786
|
-
},
|
|
787
779
|
paragraph: (node) => {
|
|
788
780
|
if (!node.childCount) {
|
|
789
781
|
return '';
|
package/dist/es/schema/index.js
CHANGED
|
@@ -44,7 +44,6 @@ import { figureElement } from './nodes/figure_element';
|
|
|
44
44
|
import { footnote } from './nodes/footnote';
|
|
45
45
|
import { footnotesElement } from './nodes/footnotes_element';
|
|
46
46
|
import { footnotesSection } from './nodes/footnotes_section';
|
|
47
|
-
import { generalTableFootnote } from './nodes/general_table_footnote';
|
|
48
47
|
import { graphicalAbstractSection } from './nodes/graphical_abstract_section';
|
|
49
48
|
import { hardBreak } from './nodes/hard_break';
|
|
50
49
|
import { highlightMarker } from './nodes/highlight_marker';
|
|
@@ -55,7 +54,7 @@ import { keywordGroup } from './nodes/keyword_group';
|
|
|
55
54
|
import { keywords } from './nodes/keywords';
|
|
56
55
|
import { keywordsElement } from './nodes/keywords_element';
|
|
57
56
|
import { link } from './nodes/link';
|
|
58
|
-
import {
|
|
57
|
+
import { list, listItem } from './nodes/list';
|
|
59
58
|
import { listing } from './nodes/listing';
|
|
60
59
|
import { listingElement } from './nodes/listing_element';
|
|
61
60
|
import { manuscript } from './nodes/manuscript';
|
|
@@ -96,7 +95,6 @@ export * from './nodes/equation_element';
|
|
|
96
95
|
export * from './nodes/figcaption';
|
|
97
96
|
export * from './nodes/figure';
|
|
98
97
|
export * from './nodes/figure_element';
|
|
99
|
-
export * from './nodes/general_table_footnote';
|
|
100
98
|
export * from './nodes/footnote';
|
|
101
99
|
export * from './nodes/footnotes_element';
|
|
102
100
|
export * from './nodes/footnotes_section';
|
|
@@ -155,7 +153,7 @@ export const schema = new Schema({
|
|
|
155
153
|
bibliography_element: bibliographyElement,
|
|
156
154
|
bibliography_section: bibliographySection,
|
|
157
155
|
blockquote_element: blockquoteElement,
|
|
158
|
-
|
|
156
|
+
list: list,
|
|
159
157
|
caption,
|
|
160
158
|
caption_title: captionTitle,
|
|
161
159
|
citation,
|
|
@@ -172,7 +170,6 @@ export const schema = new Schema({
|
|
|
172
170
|
footnote,
|
|
173
171
|
footnotes_element: footnotesElement,
|
|
174
172
|
footnotes_section: footnotesSection,
|
|
175
|
-
general_table_footnote: generalTableFootnote,
|
|
176
173
|
graphical_abstract_section: graphicalAbstractSection,
|
|
177
174
|
hard_break: hardBreak,
|
|
178
175
|
highlight_marker: highlightMarker,
|
|
@@ -188,7 +185,6 @@ export const schema = new Schema({
|
|
|
188
185
|
listing_element: listingElement,
|
|
189
186
|
manuscript,
|
|
190
187
|
missing_figure: missingFigure,
|
|
191
|
-
ordered_list: orderedList,
|
|
192
188
|
paragraph,
|
|
193
189
|
placeholder,
|
|
194
190
|
placeholder_element: placeholderElement,
|
|
@@ -15,7 +15,16 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ObjectTypes } from '@manuscripts/json-schema';
|
|
17
17
|
import { buildElementClass } from '../../lib/attributes';
|
|
18
|
-
export const
|
|
18
|
+
export const JATS_HTML_LIST_STYLE_MAPPING = {
|
|
19
|
+
simple: { style: 'none', type: 'ul' },
|
|
20
|
+
bullet: { style: 'disc', type: 'ul' },
|
|
21
|
+
order: { style: 'decimal', type: 'ol' },
|
|
22
|
+
'alpha-lower': { style: 'lower-alpha', type: 'ol' },
|
|
23
|
+
'alpha-upper': { style: 'upper-alpha', type: 'ol' },
|
|
24
|
+
'roman-lower': { style: 'lower-roman', type: 'ol' },
|
|
25
|
+
'roman-upper': { style: 'upper-roman', type: 'ol' },
|
|
26
|
+
};
|
|
27
|
+
export const list = {
|
|
19
28
|
content: 'list_item+',
|
|
20
29
|
group: 'block list element',
|
|
21
30
|
attrs: {
|
|
@@ -35,33 +44,6 @@ export const bulletList = {
|
|
|
35
44
|
};
|
|
36
45
|
},
|
|
37
46
|
},
|
|
38
|
-
],
|
|
39
|
-
toDOM: (node) => {
|
|
40
|
-
const bulletListNode = node;
|
|
41
|
-
return bulletListNode.attrs.id
|
|
42
|
-
? [
|
|
43
|
-
'ul',
|
|
44
|
-
{
|
|
45
|
-
id: bulletListNode.attrs.id,
|
|
46
|
-
'list-type': bulletListNode.attrs.listStyleType,
|
|
47
|
-
class: buildElementClass(bulletListNode.attrs),
|
|
48
|
-
'data-object-type': ObjectTypes.ListElement,
|
|
49
|
-
},
|
|
50
|
-
0,
|
|
51
|
-
]
|
|
52
|
-
: ['ul', 0];
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
export const orderedList = {
|
|
56
|
-
content: 'list_item+',
|
|
57
|
-
group: 'block list element',
|
|
58
|
-
attrs: {
|
|
59
|
-
id: { default: '' },
|
|
60
|
-
listStyleType: { default: null },
|
|
61
|
-
paragraphStyle: { default: '' },
|
|
62
|
-
dataTracked: { default: null },
|
|
63
|
-
},
|
|
64
|
-
parseDOM: [
|
|
65
47
|
{
|
|
66
48
|
tag: 'ol',
|
|
67
49
|
getAttrs: (p) => {
|
|
@@ -74,19 +56,28 @@ export const orderedList = {
|
|
|
74
56
|
},
|
|
75
57
|
],
|
|
76
58
|
toDOM: (node) => {
|
|
77
|
-
const
|
|
78
|
-
return
|
|
59
|
+
const ListNode = node;
|
|
60
|
+
return JATS_HTML_LIST_STYLE_MAPPING[ListNode.attrs.listStyleType].type === 'ul'
|
|
79
61
|
? [
|
|
80
|
-
'
|
|
62
|
+
'ul',
|
|
81
63
|
{
|
|
82
|
-
id:
|
|
83
|
-
'list-type':
|
|
84
|
-
class: buildElementClass(
|
|
64
|
+
id: ListNode.attrs.id,
|
|
65
|
+
'list-type': ListNode.attrs.listStyleType,
|
|
66
|
+
class: buildElementClass(ListNode.attrs),
|
|
85
67
|
'data-object-type': ObjectTypes.ListElement,
|
|
86
68
|
},
|
|
87
69
|
0,
|
|
88
70
|
]
|
|
89
|
-
: [
|
|
71
|
+
: [
|
|
72
|
+
'ol',
|
|
73
|
+
{
|
|
74
|
+
id: ListNode.attrs.id,
|
|
75
|
+
'list-type': ListNode.attrs.listStyleType,
|
|
76
|
+
class: buildElementClass(ListNode.attrs),
|
|
77
|
+
'data-object-type': ObjectTypes.ListElement,
|
|
78
|
+
},
|
|
79
|
+
0,
|
|
80
|
+
];
|
|
90
81
|
},
|
|
91
82
|
};
|
|
92
83
|
export const listItem = {
|
|
@@ -119,5 +110,5 @@ export const listItem = {
|
|
|
119
110
|
};
|
|
120
111
|
export const isListNode = (node) => {
|
|
121
112
|
const { nodes } = node.type.schema;
|
|
122
|
-
return node.type === nodes.
|
|
113
|
+
return node.type === nodes.list;
|
|
123
114
|
};
|
|
@@ -18,7 +18,7 @@ export const tableElementFooter = {
|
|
|
18
18
|
id: { default: '' },
|
|
19
19
|
dataTracked: { default: null },
|
|
20
20
|
},
|
|
21
|
-
content: '
|
|
21
|
+
content: '(paragraph | footnotes_element)*',
|
|
22
22
|
group: 'block element',
|
|
23
23
|
toDOM: () => ['table-wrap-foot', 0],
|
|
24
24
|
};
|
|
@@ -32,7 +32,6 @@ import { abstractsType, backmatterType, bodyType, } from '../lib/section-group-t
|
|
|
32
32
|
import { schema, } from '../schema';
|
|
33
33
|
import { buildTitles } from './builders';
|
|
34
34
|
import { insertHighlightMarkers } from './highlight-markers';
|
|
35
|
-
import { generateID } from './id';
|
|
36
35
|
import { ExtraObjectTypes, isCommentAnnotation, isManuscript, } from './object-types';
|
|
37
36
|
import { chooseSectionLableName, chooseSectionNodeType, chooseSecType, getSectionGroupType, guessSectionCategory, } from './section-category';
|
|
38
37
|
import { timestamp } from './timestamp';
|
|
@@ -382,7 +381,7 @@ export class Decoder {
|
|
|
382
381
|
switch (model.elementType) {
|
|
383
382
|
case 'ol':
|
|
384
383
|
return this.parseContents(model.contents || '<ol></ol>', undefined, this.getComments(model), {
|
|
385
|
-
topNode: schema.nodes.
|
|
384
|
+
topNode: schema.nodes.list.create({
|
|
386
385
|
id: model._id,
|
|
387
386
|
listStyleType: model.listStyleType,
|
|
388
387
|
paragraphStyle: model.paragraphStyle,
|
|
@@ -391,7 +390,7 @@ export class Decoder {
|
|
|
391
390
|
});
|
|
392
391
|
case 'ul':
|
|
393
392
|
return this.parseContents(model.contents || '<ul></ul>', undefined, this.getComments(model), {
|
|
394
|
-
topNode: schema.nodes.
|
|
393
|
+
topNode: schema.nodes.list.create({
|
|
395
394
|
id: model._id,
|
|
396
395
|
listStyleType: model.listStyleType,
|
|
397
396
|
paragraphStyle: model.paragraphStyle,
|
|
@@ -484,30 +483,10 @@ export class Decoder {
|
|
|
484
483
|
},
|
|
485
484
|
[ObjectTypes.TableElementFooter]: (data) => {
|
|
486
485
|
const model = data;
|
|
487
|
-
const
|
|
488
|
-
const generalTableFootnotes = [];
|
|
489
|
-
const footnotesElements = [];
|
|
490
|
-
for (const containedObjectID of model.containedObjectIDs) {
|
|
491
|
-
const model = this.modelMap.get(containedObjectID);
|
|
492
|
-
if (model.objectType === ObjectTypes.ParagraphElement) {
|
|
493
|
-
const paragraph = this.decode(model);
|
|
494
|
-
if (paragraph) {
|
|
495
|
-
generalTableFootnotes.push(paragraph);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
else {
|
|
499
|
-
footnotesElements.push(this.decode(model));
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
if (generalTableFootnotes && generalTableFootnotes.length) {
|
|
503
|
-
contents.push(schema.nodes.general_table_footnote.create({ id: generateID(ExtraObjectTypes.GeneralTableFootnote) }, [...generalTableFootnotes]));
|
|
504
|
-
}
|
|
505
|
-
if (footnotesElements && footnotesElements.length) {
|
|
506
|
-
contents.push(...footnotesElements);
|
|
507
|
-
}
|
|
486
|
+
const content = model.containedObjectIDs.map((id) => this.decode(this.modelMap.get(id)));
|
|
508
487
|
return schema.nodes.table_element_footer.create({
|
|
509
488
|
id: model._id,
|
|
510
|
-
},
|
|
489
|
+
}, content);
|
|
511
490
|
},
|
|
512
491
|
[ObjectTypes.AuthorNotes]: (data) => {
|
|
513
492
|
const model = data;
|
|
@@ -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 { hasGroup, isHighlightMarkerNode, isManuscriptNode, isSectionNode, schema, } from '../schema';
|
|
19
|
+
import { hasGroup, isHighlightMarkerNode, isManuscriptNode, isSectionNode, JATS_HTML_LIST_STYLE_MAPPING, schema, } from '../schema';
|
|
20
20
|
import { auxiliaryObjectTypes, buildAttribution, buildElementsOrder, buildFootnotesOrder, } from './builders';
|
|
21
21
|
import { extractCommentMarkers } from './highlight-markers';
|
|
22
22
|
import { nodeTypesMap } from './node-types';
|
|
@@ -202,18 +202,6 @@ const containedBibliographyItemIDs = (node) => {
|
|
|
202
202
|
const bibliographyItemNodeType = node.type.schema.nodes.bibliography_item;
|
|
203
203
|
return containedObjectIDs(node, [bibliographyItemNodeType]);
|
|
204
204
|
};
|
|
205
|
-
const tableElementFooterContainedIDs = (node) => {
|
|
206
|
-
const containedGeneralTableFootnoteIDs = containedObjectIDs(node, [
|
|
207
|
-
schema.nodes.footnotes_element,
|
|
208
|
-
]);
|
|
209
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
210
|
-
const childNode = node.child(i);
|
|
211
|
-
if (childNode.type === schema.nodes.general_table_footnote) {
|
|
212
|
-
containedGeneralTableFootnoteIDs.push(...containedObjectIDs(childNode));
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return containedGeneralTableFootnoteIDs;
|
|
216
|
-
};
|
|
217
205
|
const containedObjectIDs = (node, nodeTypes) => {
|
|
218
206
|
const ids = [];
|
|
219
207
|
for (let i = 0; i < node.childCount; i++) {
|
|
@@ -330,8 +318,8 @@ const encoders = {
|
|
|
330
318
|
placeholderInnerHTML: node.attrs.placeholder || '',
|
|
331
319
|
quoteType: 'block',
|
|
332
320
|
}),
|
|
333
|
-
|
|
334
|
-
elementType:
|
|
321
|
+
list: (node) => ({
|
|
322
|
+
elementType: JATS_HTML_LIST_STYLE_MAPPING[node.attrs.listStyleType].type,
|
|
335
323
|
contents: listContents(node),
|
|
336
324
|
listStyleType: node.attrs.listStyleType,
|
|
337
325
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
@@ -386,7 +374,7 @@ const encoders = {
|
|
|
386
374
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
387
375
|
}),
|
|
388
376
|
table_element_footer: (node) => ({
|
|
389
|
-
containedObjectIDs:
|
|
377
|
+
containedObjectIDs: containedObjectIDs(node),
|
|
390
378
|
}),
|
|
391
379
|
author_notes: (node) => ({
|
|
392
380
|
containedObjectIDs: containedObjectIDs(node),
|
|
@@ -424,12 +412,6 @@ const encoders = {
|
|
|
424
412
|
missing_figure: (node) => ({
|
|
425
413
|
position: node.attrs.position || undefined,
|
|
426
414
|
}),
|
|
427
|
-
ordered_list: (node) => ({
|
|
428
|
-
elementType: 'ol',
|
|
429
|
-
contents: listContents(node),
|
|
430
|
-
listStyleType: node.attrs.listStyleType,
|
|
431
|
-
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
432
|
-
}),
|
|
433
415
|
paragraph: (node) => ({
|
|
434
416
|
elementType: 'p',
|
|
435
417
|
contents: contents(node),
|
|
@@ -561,7 +543,6 @@ const containerTypes = [
|
|
|
561
543
|
schema.nodes.abstracts,
|
|
562
544
|
schema.nodes.body,
|
|
563
545
|
schema.nodes.backmatter,
|
|
564
|
-
schema.nodes.general_table_footnote,
|
|
565
546
|
];
|
|
566
547
|
const placeholderTypes = [
|
|
567
548
|
schema.nodes.placeholder,
|
|
@@ -24,8 +24,7 @@ export const nodeNames = new Map([
|
|
|
24
24
|
[schema.nodes.figure_element, 'Figure'],
|
|
25
25
|
[schema.nodes.footnote, 'Footnote'],
|
|
26
26
|
[schema.nodes.footnotes_element, 'Notes'],
|
|
27
|
-
[schema.nodes.
|
|
28
|
-
[schema.nodes.ordered_list, 'Ordered List'],
|
|
27
|
+
[schema.nodes.list, 'List'],
|
|
29
28
|
[schema.nodes.manuscript, 'Manuscript'],
|
|
30
29
|
[schema.nodes.paragraph, 'Paragraph'],
|
|
31
30
|
[schema.nodes.section, 'Section'],
|
|
@@ -53,8 +53,7 @@ export const nodeTitle = (node) => {
|
|
|
53
53
|
return snippetOfNodeType(node, nodes.section_title);
|
|
54
54
|
case nodes.footnotes_element:
|
|
55
55
|
return node.attrs.collateByKind === 'footnote' ? 'Footnotes' : 'Endnotes';
|
|
56
|
-
case nodes.
|
|
57
|
-
case nodes.bullet_list:
|
|
56
|
+
case nodes.list:
|
|
58
57
|
case nodes.blockquote_element:
|
|
59
58
|
case nodes.footnote:
|
|
60
59
|
case nodes.pullquote_element:
|
|
@@ -24,7 +24,7 @@ export const nodeTypesMap = new Map([
|
|
|
24
24
|
[schema.nodes.bibliography_element, ObjectTypes.BibliographyElement],
|
|
25
25
|
[schema.nodes.bibliography_section, ObjectTypes.Section],
|
|
26
26
|
[schema.nodes.blockquote_element, ObjectTypes.QuoteElement],
|
|
27
|
-
[schema.nodes.
|
|
27
|
+
[schema.nodes.list, ObjectTypes.ListElement],
|
|
28
28
|
[schema.nodes.citation, ObjectTypes.Citation],
|
|
29
29
|
[schema.nodes.equation, ObjectTypes.Equation],
|
|
30
30
|
[schema.nodes.equation_element, ObjectTypes.EquationElement],
|
|
@@ -43,7 +43,6 @@ export const nodeTypesMap = new Map([
|
|
|
43
43
|
[schema.nodes.listing, ObjectTypes.Listing],
|
|
44
44
|
[schema.nodes.listing_element, ObjectTypes.ListingElement],
|
|
45
45
|
[schema.nodes.manuscript, ObjectTypes.Manuscript],
|
|
46
|
-
[schema.nodes.ordered_list, ObjectTypes.ListElement],
|
|
47
46
|
[schema.nodes.paragraph, ObjectTypes.ParagraphElement],
|
|
48
47
|
[schema.nodes.pullquote_element, ObjectTypes.QuoteElement],
|
|
49
48
|
[schema.nodes.section, ObjectTypes.Section],
|
|
@@ -17,7 +17,6 @@ import { manuscriptIDTypes, ObjectTypes, } from '@manuscripts/json-schema';
|
|
|
17
17
|
export var ExtraObjectTypes;
|
|
18
18
|
(function (ExtraObjectTypes) {
|
|
19
19
|
ExtraObjectTypes["PlaceholderElement"] = "MPPlaceholderElement";
|
|
20
|
-
ExtraObjectTypes["GeneralTableFootnote"] = "MPGeneralTableFootnote";
|
|
21
20
|
})(ExtraObjectTypes || (ExtraObjectTypes = {}));
|
|
22
21
|
export const elementObjects = [
|
|
23
22
|
ObjectTypes.BibliographyElement,
|
|
@@ -34,7 +34,6 @@ export * from './nodes/equation_element';
|
|
|
34
34
|
export * from './nodes/figcaption';
|
|
35
35
|
export * from './nodes/figure';
|
|
36
36
|
export * from './nodes/figure_element';
|
|
37
|
-
export * from './nodes/general_table_footnote';
|
|
38
37
|
export * from './nodes/footnote';
|
|
39
38
|
export * from './nodes/footnotes_element';
|
|
40
39
|
export * from './nodes/footnotes_section';
|
|
@@ -13,29 +13,28 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { ListElement } from '@manuscripts/json-schema';
|
|
16
17
|
import { NodeSpec } from 'prosemirror-model';
|
|
17
18
|
import { ManuscriptNode } from '../types';
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
export type JatsStyleType = NonNullable<ListElement['listStyleType']>;
|
|
20
|
+
export declare const JATS_HTML_LIST_STYLE_MAPPING: {
|
|
21
|
+
[key in JatsStyleType]: {
|
|
22
|
+
style: string;
|
|
23
|
+
type: string;
|
|
23
24
|
};
|
|
24
|
-
}
|
|
25
|
-
export
|
|
26
|
-
export interface OrderedListNode extends ManuscriptNode {
|
|
25
|
+
};
|
|
26
|
+
export interface ListNode extends ManuscriptNode {
|
|
27
27
|
attrs: {
|
|
28
28
|
id: string;
|
|
29
|
-
listStyleType: string;
|
|
30
29
|
paragraphStyle: string;
|
|
30
|
+
listStyleType: string;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
export declare const
|
|
33
|
+
export declare const list: NodeSpec;
|
|
34
34
|
export interface ListItemNode extends ManuscriptNode {
|
|
35
35
|
attrs: {
|
|
36
36
|
placeholder: string;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
export declare const listItem: NodeSpec;
|
|
40
|
-
export type ListNode = BulletListNode | OrderedListNode;
|
|
41
40
|
export declare const isListNode: (node: ManuscriptNode) => node is ListNode;
|
|
@@ -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' | '
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'list' | 'caption' | 'caption_title' | 'comment' | 'comments' | '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' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | 'missing_figure' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'table_header' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations' | 'contributors' | 'supplements' | 'supplement' | 'author_notes' | 'corresp';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
import { CommentAnnotation, Figure, Keyword, Manuscript, Model, ObjectTypes, Table } from '@manuscripts/json-schema';
|
|
17
17
|
import { ManuscriptModel } from './models';
|
|
18
18
|
export declare enum ExtraObjectTypes {
|
|
19
|
-
PlaceholderElement = "MPPlaceholderElement"
|
|
20
|
-
GeneralTableFootnote = "MPGeneralTableFootnote"
|
|
19
|
+
PlaceholderElement = "MPPlaceholderElement"
|
|
21
20
|
}
|
|
22
21
|
export declare const elementObjects: ObjectTypes[];
|
|
23
22
|
export declare const manuscriptObjects: ObjectTypes[];
|
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": "2.3.5-LEAN-
|
|
4
|
+
"version": "2.3.5-LEAN-3608.2",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* © 2019 Atypon Systems LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.generalTableFootnote = void 0;
|
|
19
|
-
exports.generalTableFootnote = {
|
|
20
|
-
content: 'paragraph*',
|
|
21
|
-
attrs: {
|
|
22
|
-
id: { default: '' },
|
|
23
|
-
dataTracked: { default: null },
|
|
24
|
-
},
|
|
25
|
-
group: 'block',
|
|
26
|
-
toDOM: () => ['div', { class: 'general-table-footnote' }, 0],
|
|
27
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
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 generalTableFootnote = {
|
|
17
|
-
content: 'paragraph*',
|
|
18
|
-
attrs: {
|
|
19
|
-
id: { default: '' },
|
|
20
|
-
dataTracked: { default: null },
|
|
21
|
-
},
|
|
22
|
-
group: 'block',
|
|
23
|
-
toDOM: () => ['div', { class: 'general-table-footnote' }, 0],
|
|
24
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
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 GeneralTableFootnote extends ManuscriptNode {
|
|
22
|
-
attrs: Attrs;
|
|
23
|
-
}
|
|
24
|
-
export declare const generalTableFootnote: NodeSpec;
|
|
25
|
-
export {};
|