@manuscripts/transform 2.3.2 → 2.3.3-LEAN-3519-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/jats/importer/jats-body-dom-parser.js +18 -0
- package/dist/cjs/jats/importer/jats-body-transformations.js +12 -0
- package/dist/cjs/jats/importer/jats-parser-utils.js +4 -0
- package/dist/cjs/jats/jats-exporter.js +3 -0
- package/dist/cjs/schema/index.js +3 -0
- package/dist/cjs/schema/nodes/general_table_footnote.js +27 -0
- package/dist/cjs/schema/nodes/table_element_footer.js +1 -1
- package/dist/cjs/schema/nodes/title.js +1 -2
- package/dist/cjs/transformer/decode.js +27 -3
- package/dist/cjs/transformer/encode.js +14 -1
- package/dist/es/jats/importer/jats-body-dom-parser.js +18 -0
- package/dist/es/jats/importer/jats-body-transformations.js +12 -0
- package/dist/es/jats/importer/jats-parser-utils.js +4 -0
- package/dist/es/jats/jats-exporter.js +3 -0
- package/dist/es/schema/index.js +3 -0
- package/dist/es/schema/nodes/general_table_footnote.js +24 -0
- package/dist/es/schema/nodes/table_element_footer.js +1 -1
- package/dist/es/schema/nodes/title.js +1 -2
- package/dist/es/transformer/decode.js +27 -3
- package/dist/es/transformer/encode.js +14 -1
- package/dist/types/schema/index.d.ts +1 -0
- package/dist/types/schema/nodes/general_table_footnote.d.ts +25 -0
- package/dist/types/schema/types.d.ts +1 -1
- package/package.json +2 -2
|
@@ -315,6 +315,24 @@ 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
|
+
},
|
|
318
336
|
{
|
|
319
337
|
tag: 'fn',
|
|
320
338
|
node: 'footnote',
|
|
@@ -242,6 +242,18 @@ 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
|
+
}
|
|
245
257
|
});
|
|
246
258
|
},
|
|
247
259
|
orderTableFootnote(doc, body) {
|
|
@@ -36,6 +36,10 @@ 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
|
+
}
|
|
39
43
|
if (!('id' in node.attrs)) {
|
|
40
44
|
return;
|
|
41
45
|
}
|
|
@@ -676,6 +676,9 @@ class JATSExporter {
|
|
|
676
676
|
equation: (node) => {
|
|
677
677
|
return this.createEquation(node);
|
|
678
678
|
},
|
|
679
|
+
general_table_footnote: (node) => {
|
|
680
|
+
return this.serializeNode(node.child(0));
|
|
681
|
+
},
|
|
679
682
|
inline_equation: (node) => {
|
|
680
683
|
const eqElement = this.document.createElement('inline-formula');
|
|
681
684
|
const equation = this.createEquation(node, true);
|
package/dist/cjs/schema/index.js
CHANGED
|
@@ -61,6 +61,7 @@ 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");
|
|
64
65
|
const graphical_abstract_section_1 = require("./nodes/graphical_abstract_section");
|
|
65
66
|
const hard_break_1 = require("./nodes/hard_break");
|
|
66
67
|
const highlight_marker_1 = require("./nodes/highlight_marker");
|
|
@@ -112,6 +113,7 @@ __exportStar(require("./nodes/equation_element"), exports);
|
|
|
112
113
|
__exportStar(require("./nodes/figcaption"), exports);
|
|
113
114
|
__exportStar(require("./nodes/figure"), exports);
|
|
114
115
|
__exportStar(require("./nodes/figure_element"), exports);
|
|
116
|
+
__exportStar(require("./nodes/general_table_footnote"), exports);
|
|
115
117
|
__exportStar(require("./nodes/footnote"), exports);
|
|
116
118
|
__exportStar(require("./nodes/footnotes_element"), exports);
|
|
117
119
|
__exportStar(require("./nodes/footnotes_section"), exports);
|
|
@@ -187,6 +189,7 @@ exports.schema = new prosemirror_model_1.Schema({
|
|
|
187
189
|
footnote: footnote_1.footnote,
|
|
188
190
|
footnotes_element: footnotes_element_1.footnotesElement,
|
|
189
191
|
footnotes_section: footnotes_section_1.footnotesSection,
|
|
192
|
+
general_table_footnote: general_table_footnote_1.generalTableFootnote,
|
|
190
193
|
graphical_abstract_section: graphical_abstract_section_1.graphicalAbstractSection,
|
|
191
194
|
hard_break: hard_break_1.hardBreak,
|
|
192
195
|
highlight_marker: highlight_marker_1.highlightMarker,
|
|
@@ -0,0 +1,27 @@
|
|
|
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: () => ['general-table-footnote', 0],
|
|
27
|
+
};
|
|
@@ -21,7 +21,7 @@ exports.tableElementFooter = {
|
|
|
21
21
|
id: { default: '' },
|
|
22
22
|
dataTracked: { default: null },
|
|
23
23
|
},
|
|
24
|
-
content: '
|
|
24
|
+
content: 'general_table_footnote? footnotes_element?',
|
|
25
25
|
group: 'block element',
|
|
26
26
|
toDOM: () => ['table-wrap-foot', 0],
|
|
27
27
|
};
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.title = void 0;
|
|
19
19
|
exports.title = {
|
|
20
|
-
content: 'text*',
|
|
21
|
-
marks: 'italic smallcaps subscript superscript tracked_insert tracked_delete',
|
|
20
|
+
content: '(text | highlight_marker)*',
|
|
22
21
|
attrs: {
|
|
23
22
|
id: { default: '' },
|
|
24
23
|
dataTracked: { default: null },
|
|
@@ -169,7 +169,9 @@ class Decoder {
|
|
|
169
169
|
this.creators = {
|
|
170
170
|
[json_schema_1.ObjectTypes.Titles]: (data) => {
|
|
171
171
|
const model = data;
|
|
172
|
-
|
|
172
|
+
const comments = this.createCommentNodes(model);
|
|
173
|
+
comments.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
174
|
+
return this.parseContents(model.title, 'div', this.getComments(model), {
|
|
173
175
|
topNode: schema_1.schema.nodes.title.create({
|
|
174
176
|
id: model._id,
|
|
175
177
|
}),
|
|
@@ -490,10 +492,32 @@ class Decoder {
|
|
|
490
492
|
},
|
|
491
493
|
[json_schema_1.ObjectTypes.TableElementFooter]: (data) => {
|
|
492
494
|
const model = data;
|
|
493
|
-
const
|
|
495
|
+
const contents = [];
|
|
496
|
+
const generalTableFootnotes = [];
|
|
497
|
+
const footnotesElements = [];
|
|
498
|
+
for (const containedObjectID of model.containedObjectIDs) {
|
|
499
|
+
const model = this.modelMap.get(containedObjectID);
|
|
500
|
+
if (model.objectType === json_schema_1.ObjectTypes.ParagraphElement) {
|
|
501
|
+
const paragraph = this.decode(model);
|
|
502
|
+
if (paragraph) {
|
|
503
|
+
generalTableFootnotes.push(paragraph);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
footnotesElements.push(this.decode(model));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
if (generalTableFootnotes && generalTableFootnotes.length) {
|
|
511
|
+
contents.push(schema_1.schema.nodes.general_table_footnote.create({}, [
|
|
512
|
+
...generalTableFootnotes,
|
|
513
|
+
]));
|
|
514
|
+
}
|
|
515
|
+
if (footnotesElements && footnotesElements.length) {
|
|
516
|
+
contents.push(...footnotesElements);
|
|
517
|
+
}
|
|
494
518
|
return schema_1.schema.nodes.table_element_footer.create({
|
|
495
519
|
id: model._id,
|
|
496
|
-
},
|
|
520
|
+
}, contents);
|
|
497
521
|
},
|
|
498
522
|
[json_schema_1.ObjectTypes.AuthorNotes]: (data) => {
|
|
499
523
|
const model = data;
|
|
@@ -210,6 +210,18 @@ 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
|
+
};
|
|
213
225
|
const containedObjectIDs = (node, nodeTypes) => {
|
|
214
226
|
const ids = [];
|
|
215
227
|
for (let i = 0; i < node.childCount; i++) {
|
|
@@ -382,7 +394,7 @@ const encoders = {
|
|
|
382
394
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
383
395
|
}),
|
|
384
396
|
table_element_footer: (node) => ({
|
|
385
|
-
containedObjectIDs:
|
|
397
|
+
containedObjectIDs: tableElementFooterContainedIDs(node),
|
|
386
398
|
}),
|
|
387
399
|
author_notes: (node) => ({
|
|
388
400
|
containedObjectIDs: containedObjectIDs(node),
|
|
@@ -558,6 +570,7 @@ const containerTypes = [
|
|
|
558
570
|
schema_1.schema.nodes.abstracts,
|
|
559
571
|
schema_1.schema.nodes.body,
|
|
560
572
|
schema_1.schema.nodes.backmatter,
|
|
573
|
+
schema_1.schema.nodes.general_table_footnote,
|
|
561
574
|
];
|
|
562
575
|
const placeholderTypes = [
|
|
563
576
|
schema_1.schema.nodes.placeholder,
|
|
@@ -309,6 +309,24 @@ 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
|
+
},
|
|
312
330
|
{
|
|
313
331
|
tag: 'fn',
|
|
314
332
|
node: 'footnote',
|
|
@@ -239,6 +239,18 @@ 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
|
+
}
|
|
242
254
|
});
|
|
243
255
|
},
|
|
244
256
|
orderTableFootnote(doc, body) {
|
|
@@ -32,6 +32,10 @@ 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
|
+
}
|
|
35
39
|
if (!('id' in node.attrs)) {
|
|
36
40
|
return;
|
|
37
41
|
}
|
|
@@ -668,6 +668,9 @@ export class JATSExporter {
|
|
|
668
668
|
equation: (node) => {
|
|
669
669
|
return this.createEquation(node);
|
|
670
670
|
},
|
|
671
|
+
general_table_footnote: (node) => {
|
|
672
|
+
return this.serializeNode(node.child(0));
|
|
673
|
+
},
|
|
671
674
|
inline_equation: (node) => {
|
|
672
675
|
const eqElement = this.document.createElement('inline-formula');
|
|
673
676
|
const equation = this.createEquation(node, true);
|
package/dist/es/schema/index.js
CHANGED
|
@@ -44,6 +44,7 @@ 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';
|
|
47
48
|
import { graphicalAbstractSection } from './nodes/graphical_abstract_section';
|
|
48
49
|
import { hardBreak } from './nodes/hard_break';
|
|
49
50
|
import { highlightMarker } from './nodes/highlight_marker';
|
|
@@ -95,6 +96,7 @@ export * from './nodes/equation_element';
|
|
|
95
96
|
export * from './nodes/figcaption';
|
|
96
97
|
export * from './nodes/figure';
|
|
97
98
|
export * from './nodes/figure_element';
|
|
99
|
+
export * from './nodes/general_table_footnote';
|
|
98
100
|
export * from './nodes/footnote';
|
|
99
101
|
export * from './nodes/footnotes_element';
|
|
100
102
|
export * from './nodes/footnotes_section';
|
|
@@ -170,6 +172,7 @@ export const schema = new Schema({
|
|
|
170
172
|
footnote,
|
|
171
173
|
footnotes_element: footnotesElement,
|
|
172
174
|
footnotes_section: footnotesSection,
|
|
175
|
+
general_table_footnote: generalTableFootnote,
|
|
173
176
|
graphical_abstract_section: graphicalAbstractSection,
|
|
174
177
|
hard_break: hardBreak,
|
|
175
178
|
highlight_marker: highlightMarker,
|
|
@@ -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 generalTableFootnote = {
|
|
17
|
+
content: 'paragraph*',
|
|
18
|
+
attrs: {
|
|
19
|
+
id: { default: '' },
|
|
20
|
+
dataTracked: { default: null },
|
|
21
|
+
},
|
|
22
|
+
group: 'block',
|
|
23
|
+
toDOM: () => ['general-table-footnote', 0],
|
|
24
|
+
};
|
|
@@ -18,7 +18,7 @@ export const tableElementFooter = {
|
|
|
18
18
|
id: { default: '' },
|
|
19
19
|
dataTracked: { default: null },
|
|
20
20
|
},
|
|
21
|
-
content: '
|
|
21
|
+
content: 'general_table_footnote? footnotes_element?',
|
|
22
22
|
group: 'block element',
|
|
23
23
|
toDOM: () => ['table-wrap-foot', 0],
|
|
24
24
|
};
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const title = {
|
|
17
|
-
content: 'text*',
|
|
18
|
-
marks: 'italic smallcaps subscript superscript tracked_insert tracked_delete',
|
|
17
|
+
content: '(text | highlight_marker)*',
|
|
19
18
|
attrs: {
|
|
20
19
|
id: { default: '' },
|
|
21
20
|
dataTracked: { default: null },
|
|
@@ -160,7 +160,9 @@ export class Decoder {
|
|
|
160
160
|
this.creators = {
|
|
161
161
|
[ObjectTypes.Titles]: (data) => {
|
|
162
162
|
const model = data;
|
|
163
|
-
|
|
163
|
+
const comments = this.createCommentNodes(model);
|
|
164
|
+
comments.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
165
|
+
return this.parseContents(model.title, 'div', this.getComments(model), {
|
|
164
166
|
topNode: schema.nodes.title.create({
|
|
165
167
|
id: model._id,
|
|
166
168
|
}),
|
|
@@ -481,10 +483,32 @@ export class Decoder {
|
|
|
481
483
|
},
|
|
482
484
|
[ObjectTypes.TableElementFooter]: (data) => {
|
|
483
485
|
const model = data;
|
|
484
|
-
const
|
|
486
|
+
const contents = [];
|
|
487
|
+
const generalTableFootnotes = [];
|
|
488
|
+
const footnotesElements = [];
|
|
489
|
+
for (const containedObjectID of model.containedObjectIDs) {
|
|
490
|
+
const model = this.modelMap.get(containedObjectID);
|
|
491
|
+
if (model.objectType === ObjectTypes.ParagraphElement) {
|
|
492
|
+
const paragraph = this.decode(model);
|
|
493
|
+
if (paragraph) {
|
|
494
|
+
generalTableFootnotes.push(paragraph);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
footnotesElements.push(this.decode(model));
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
if (generalTableFootnotes && generalTableFootnotes.length) {
|
|
502
|
+
contents.push(schema.nodes.general_table_footnote.create({}, [
|
|
503
|
+
...generalTableFootnotes,
|
|
504
|
+
]));
|
|
505
|
+
}
|
|
506
|
+
if (footnotesElements && footnotesElements.length) {
|
|
507
|
+
contents.push(...footnotesElements);
|
|
508
|
+
}
|
|
485
509
|
return schema.nodes.table_element_footer.create({
|
|
486
510
|
id: model._id,
|
|
487
|
-
},
|
|
511
|
+
}, contents);
|
|
488
512
|
},
|
|
489
513
|
[ObjectTypes.AuthorNotes]: (data) => {
|
|
490
514
|
const model = data;
|
|
@@ -202,6 +202,18 @@ 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
|
+
};
|
|
205
217
|
const containedObjectIDs = (node, nodeTypes) => {
|
|
206
218
|
const ids = [];
|
|
207
219
|
for (let i = 0; i < node.childCount; i++) {
|
|
@@ -374,7 +386,7 @@ const encoders = {
|
|
|
374
386
|
paragraphStyle: node.attrs.paragraphStyle || undefined,
|
|
375
387
|
}),
|
|
376
388
|
table_element_footer: (node) => ({
|
|
377
|
-
containedObjectIDs:
|
|
389
|
+
containedObjectIDs: tableElementFooterContainedIDs(node),
|
|
378
390
|
}),
|
|
379
391
|
author_notes: (node) => ({
|
|
380
392
|
containedObjectIDs: containedObjectIDs(node),
|
|
@@ -549,6 +561,7 @@ const containerTypes = [
|
|
|
549
561
|
schema.nodes.abstracts,
|
|
550
562
|
schema.nodes.body,
|
|
551
563
|
schema.nodes.backmatter,
|
|
564
|
+
schema.nodes.general_table_footnote,
|
|
552
565
|
];
|
|
553
566
|
const placeholderTypes = [
|
|
554
567
|
schema.nodes.placeholder,
|
|
@@ -34,6 +34,7 @@ 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';
|
|
37
38
|
export * from './nodes/footnote';
|
|
38
39
|
export * from './nodes/footnotes_element';
|
|
39
40
|
export * from './nodes/footnotes_section';
|
|
@@ -0,0 +1,25 @@
|
|
|
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 {};
|
|
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
|
|
|
17
17
|
import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
|
|
18
18
|
import { EditorView, NodeView } from 'prosemirror-view';
|
|
19
19
|
export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
|
|
20
|
-
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | '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' | 'ordered_list' | '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';
|
|
20
|
+
export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_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' | 'ordered_list' | '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' | 'general_table_footnote';
|
|
21
21
|
export type ManuscriptSchema = Schema<Nodes, Marks>;
|
|
22
22
|
export type ManuscriptEditorState = EditorState;
|
|
23
23
|
export type ManuscriptEditorView = EditorView;
|
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.
|
|
4
|
+
"version": "2.3.3-LEAN-3519-0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -78,4 +78,4 @@
|
|
|
78
78
|
"rimraf": "^3.0.2",
|
|
79
79
|
"typescript": "^4.0.5"
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
}
|