@manuscripts/transform 1.3.12 → 1.4.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/jats/importer/jats-body-dom-parser.js +2 -1
- package/dist/cjs/jats/jats-exporter.js +8 -1
- package/dist/cjs/schema/nodes/list.js +3 -0
- package/dist/cjs/transformer/decode.js +4 -0
- package/dist/cjs/transformer/encode.js +1 -0
- package/dist/es/jats/importer/jats-body-dom-parser.js +2 -1
- package/dist/es/jats/jats-exporter.js +8 -1
- package/dist/es/schema/nodes/list.js +3 -0
- package/dist/es/transformer/decode.js +4 -0
- package/dist/es/transformer/encode.js +1 -0
- package/dist/types/schema/nodes/list.d.ts +1 -0
- package/package.json +2 -2
|
@@ -456,12 +456,13 @@ const nodes = [
|
|
|
456
456
|
},
|
|
457
457
|
},
|
|
458
458
|
{
|
|
459
|
-
tag: 'list[list-type
|
|
459
|
+
tag: 'list[list-type]',
|
|
460
460
|
node: 'ordered_list',
|
|
461
461
|
getAttrs: (node) => {
|
|
462
462
|
const element = node;
|
|
463
463
|
return {
|
|
464
464
|
id: element.getAttribute('id'),
|
|
465
|
+
listStyleType: element.getAttribute('list-type'),
|
|
465
466
|
};
|
|
466
467
|
},
|
|
467
468
|
},
|
|
@@ -825,7 +825,14 @@ class JATSExporter {
|
|
|
825
825
|
graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', '');
|
|
826
826
|
return graphic;
|
|
827
827
|
},
|
|
828
|
-
ordered_list: () =>
|
|
828
|
+
ordered_list: (node) => {
|
|
829
|
+
var _a;
|
|
830
|
+
return [
|
|
831
|
+
'list',
|
|
832
|
+
{ 'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'order' },
|
|
833
|
+
0,
|
|
834
|
+
];
|
|
835
|
+
},
|
|
829
836
|
paragraph: (node) => {
|
|
830
837
|
if (!node.childCount) {
|
|
831
838
|
return '';
|
|
@@ -57,6 +57,7 @@ exports.orderedList = {
|
|
|
57
57
|
group: 'block list element',
|
|
58
58
|
attrs: {
|
|
59
59
|
id: { default: '' },
|
|
60
|
+
listStyleType: { default: null },
|
|
60
61
|
paragraphStyle: { default: '' },
|
|
61
62
|
dataTracked: { default: null },
|
|
62
63
|
},
|
|
@@ -67,6 +68,7 @@ exports.orderedList = {
|
|
|
67
68
|
const dom = p;
|
|
68
69
|
return {
|
|
69
70
|
id: dom.getAttribute('id'),
|
|
71
|
+
listStyleType: dom.getAttribute('list-type'),
|
|
70
72
|
};
|
|
71
73
|
},
|
|
72
74
|
},
|
|
@@ -78,6 +80,7 @@ exports.orderedList = {
|
|
|
78
80
|
'ol',
|
|
79
81
|
{
|
|
80
82
|
id: orderedListNode.attrs.id,
|
|
83
|
+
'list-type': orderedListNode.attrs.listStyleType,
|
|
81
84
|
class: (0, attributes_1.buildElementClass)(orderedListNode.attrs),
|
|
82
85
|
'data-object-type': json_schema_1.ObjectTypes.ListElement,
|
|
83
86
|
},
|
|
@@ -151,6 +151,8 @@ class Decoder {
|
|
|
151
151
|
},
|
|
152
152
|
[json_schema_1.ObjectTypes.BibliographyItem]: (data) => {
|
|
153
153
|
const model = data;
|
|
154
|
+
const commentNodes = this.createCommentsNode(model);
|
|
155
|
+
commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
154
156
|
return schema_1.schema.nodes.bibliography_item.create({
|
|
155
157
|
id: model._id,
|
|
156
158
|
type: model.type,
|
|
@@ -164,6 +166,7 @@ class Decoder {
|
|
|
164
166
|
page: model.page,
|
|
165
167
|
title: model.title,
|
|
166
168
|
literal: model.literal,
|
|
169
|
+
comments: commentNodes.map((c) => c.attrs.id),
|
|
167
170
|
});
|
|
168
171
|
},
|
|
169
172
|
[object_types_1.ExtraObjectTypes.PlaceholderElement]: (data) => {
|
|
@@ -330,6 +333,7 @@ class Decoder {
|
|
|
330
333
|
return this.parseContents(model.contents || '<ol></ol>', undefined, this.getComments(model), {
|
|
331
334
|
topNode: schema_1.schema.nodes.ordered_list.create({
|
|
332
335
|
id: model._id,
|
|
336
|
+
listStyleType: model.listStyleType,
|
|
333
337
|
paragraphStyle: model.paragraphStyle,
|
|
334
338
|
comments: commentNodes.map((c) => c.attrs.id),
|
|
335
339
|
}),
|
|
@@ -450,12 +450,13 @@ const nodes = [
|
|
|
450
450
|
},
|
|
451
451
|
},
|
|
452
452
|
{
|
|
453
|
-
tag: 'list[list-type
|
|
453
|
+
tag: 'list[list-type]',
|
|
454
454
|
node: 'ordered_list',
|
|
455
455
|
getAttrs: (node) => {
|
|
456
456
|
const element = node;
|
|
457
457
|
return {
|
|
458
458
|
id: element.getAttribute('id'),
|
|
459
|
+
listStyleType: element.getAttribute('list-type'),
|
|
459
460
|
};
|
|
460
461
|
},
|
|
461
462
|
},
|
|
@@ -818,7 +818,14 @@ export class JATSExporter {
|
|
|
818
818
|
graphic.setAttributeNS(XLINK_NAMESPACE, 'xlink:href', '');
|
|
819
819
|
return graphic;
|
|
820
820
|
},
|
|
821
|
-
ordered_list: () =>
|
|
821
|
+
ordered_list: (node) => {
|
|
822
|
+
var _a;
|
|
823
|
+
return [
|
|
824
|
+
'list',
|
|
825
|
+
{ 'list-type': (_a = node.attrs.listStyleType) !== null && _a !== void 0 ? _a : 'order' },
|
|
826
|
+
0,
|
|
827
|
+
];
|
|
828
|
+
},
|
|
822
829
|
paragraph: (node) => {
|
|
823
830
|
if (!node.childCount) {
|
|
824
831
|
return '';
|
|
@@ -54,6 +54,7 @@ export const orderedList = {
|
|
|
54
54
|
group: 'block list element',
|
|
55
55
|
attrs: {
|
|
56
56
|
id: { default: '' },
|
|
57
|
+
listStyleType: { default: null },
|
|
57
58
|
paragraphStyle: { default: '' },
|
|
58
59
|
dataTracked: { default: null },
|
|
59
60
|
},
|
|
@@ -64,6 +65,7 @@ export const orderedList = {
|
|
|
64
65
|
const dom = p;
|
|
65
66
|
return {
|
|
66
67
|
id: dom.getAttribute('id'),
|
|
68
|
+
listStyleType: dom.getAttribute('list-type'),
|
|
67
69
|
};
|
|
68
70
|
},
|
|
69
71
|
},
|
|
@@ -75,6 +77,7 @@ export const orderedList = {
|
|
|
75
77
|
'ol',
|
|
76
78
|
{
|
|
77
79
|
id: orderedListNode.attrs.id,
|
|
80
|
+
'list-type': orderedListNode.attrs.listStyleType,
|
|
78
81
|
class: buildElementClass(orderedListNode.attrs),
|
|
79
82
|
'data-object-type': ObjectTypes.ListElement,
|
|
80
83
|
},
|
|
@@ -141,6 +141,8 @@ export class Decoder {
|
|
|
141
141
|
},
|
|
142
142
|
[ObjectTypes.BibliographyItem]: (data) => {
|
|
143
143
|
const model = data;
|
|
144
|
+
const commentNodes = this.createCommentsNode(model);
|
|
145
|
+
commentNodes.forEach((c) => this.comments.set(c.attrs.id, c));
|
|
144
146
|
return schema.nodes.bibliography_item.create({
|
|
145
147
|
id: model._id,
|
|
146
148
|
type: model.type,
|
|
@@ -154,6 +156,7 @@ export class Decoder {
|
|
|
154
156
|
page: model.page,
|
|
155
157
|
title: model.title,
|
|
156
158
|
literal: model.literal,
|
|
159
|
+
comments: commentNodes.map((c) => c.attrs.id),
|
|
157
160
|
});
|
|
158
161
|
},
|
|
159
162
|
[ExtraObjectTypes.PlaceholderElement]: (data) => {
|
|
@@ -320,6 +323,7 @@ export class Decoder {
|
|
|
320
323
|
return this.parseContents(model.contents || '<ol></ol>', undefined, this.getComments(model), {
|
|
321
324
|
topNode: schema.nodes.ordered_list.create({
|
|
322
325
|
id: model._id,
|
|
326
|
+
listStyleType: model.listStyleType,
|
|
323
327
|
paragraphStyle: model.paragraphStyle,
|
|
324
328
|
comments: commentNodes.map((c) => c.attrs.id),
|
|
325
329
|
}),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"version": "yarn build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@manuscripts/json-schema": "^2.
|
|
32
|
+
"@manuscripts/json-schema": "^2.2.0",
|
|
33
33
|
"debug": "^4.3.4",
|
|
34
34
|
"jszip": "^3.10.1",
|
|
35
35
|
"mathjax-full": "^3.2.2",
|