@manuscripts/transform 1.3.11-LEAN-2723-1 → 1.3.11-LEAN-2147
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 +0 -2
- package/dist/cjs/jats/importer/jats-reference-parser.js +0 -1
- package/dist/cjs/jats/jats-exporter.js +1 -1
- package/dist/cjs/schema/marks.js +2 -6
- package/dist/cjs/schema/nodes/affiliation.js +0 -1
- package/dist/cjs/schema/nodes/bibliography_element.js +1 -2
- package/dist/cjs/schema/nodes/bibliography_item.js +0 -1
- package/dist/cjs/schema/nodes/citation.js +1 -11
- package/dist/cjs/schema/nodes/contributor.js +0 -1
- package/dist/cjs/schema/nodes/cross_reference.js +6 -1
- package/dist/cjs/transformer/html.js +2 -1
- package/dist/es/jats/importer/jats-body-dom-parser.js +0 -2
- package/dist/es/jats/importer/jats-reference-parser.js +0 -1
- package/dist/es/jats/jats-exporter.js +1 -1
- package/dist/es/schema/marks.js +2 -6
- package/dist/es/schema/nodes/affiliation.js +0 -1
- package/dist/es/schema/nodes/bibliography_element.js +1 -2
- package/dist/es/schema/nodes/bibliography_item.js +0 -1
- package/dist/es/schema/nodes/citation.js +1 -11
- package/dist/es/schema/nodes/contributor.js +0 -1
- package/dist/es/schema/nodes/cross_reference.js +6 -1
- package/dist/es/transformer/html.js +2 -1
- package/dist/types/schema/nodes/citation.d.ts +0 -4
- package/dist/types/schema/nodes/cross_reference.d.ts +1 -0
- package/package.json +1 -1
|
@@ -651,11 +651,9 @@ const nodes = [
|
|
|
651
651
|
getAttrs: (node) => {
|
|
652
652
|
var _a;
|
|
653
653
|
const element = node;
|
|
654
|
-
const embeddedCitation = element.getAttribute('data-reference-embedded-citation') || 'null';
|
|
655
654
|
return {
|
|
656
655
|
rid: element.getAttribute('rid'),
|
|
657
656
|
contents: (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim(),
|
|
658
|
-
embeddedCitationItems: JSON.parse(embeddedCitation),
|
|
659
657
|
};
|
|
660
658
|
},
|
|
661
659
|
},
|
|
@@ -158,7 +158,6 @@ exports.jatsReferenceParser = {
|
|
|
158
158
|
const citation = (0, builders_1.buildCitation)('', rids);
|
|
159
159
|
modelNodes.push(citation);
|
|
160
160
|
crossReferenceNode.setAttribute('rid', citation._id);
|
|
161
|
-
crossReferenceNode.setAttribute('data-reference-embedded-citation', JSON.stringify(citation.embeddedCitationItems));
|
|
162
161
|
}
|
|
163
162
|
else {
|
|
164
163
|
crossReferenceNode.removeAttribute('rid');
|
|
@@ -689,7 +689,7 @@ class JATSExporter {
|
|
|
689
689
|
const rid = getReferencedObjectId(auxiliaryObjectReference.referencedObject);
|
|
690
690
|
xref.setAttribute('rid', rid);
|
|
691
691
|
}
|
|
692
|
-
xref.textContent = node.attrs.label;
|
|
692
|
+
xref.textContent = node.attrs.customLabel || node.attrs.label;
|
|
693
693
|
return xref;
|
|
694
694
|
},
|
|
695
695
|
doc: () => '',
|
package/dist/cjs/schema/marks.js
CHANGED
|
@@ -104,7 +104,6 @@ exports.underline = {
|
|
|
104
104
|
exports.tracked_insert = {
|
|
105
105
|
excludes: 'tracked_insert tracked_delete',
|
|
106
106
|
attrs: {
|
|
107
|
-
isBlock: { default: null },
|
|
108
107
|
dataTracked: { default: null },
|
|
109
108
|
},
|
|
110
109
|
parseDOM: [
|
|
@@ -124,17 +123,15 @@ exports.tracked_insert = {
|
|
|
124
123
|
},
|
|
125
124
|
],
|
|
126
125
|
toDOM: (el) => {
|
|
127
|
-
const block = el.attrs.isBlock ? 'track-block-node' : '';
|
|
128
126
|
const dataTracked = el.attrs.dataTracked || {};
|
|
129
127
|
const { status = 'pending', id, userID, createdAt } = dataTracked;
|
|
130
|
-
const attrs = Object.assign(Object.assign(Object.assign({ class: `inserted ${status}
|
|
128
|
+
const attrs = Object.assign(Object.assign(Object.assign({ class: `inserted ${status}`, 'data-track-status': status }, (id && { 'data-track-id': id })), (userID && { 'data-user-id': userID })), (createdAt && { 'data-track-created-at': createdAt.toString() }));
|
|
131
129
|
return ['ins', attrs];
|
|
132
130
|
},
|
|
133
131
|
};
|
|
134
132
|
exports.tracked_delete = {
|
|
135
133
|
excludes: 'tracked_insert tracked_delete',
|
|
136
134
|
attrs: {
|
|
137
|
-
isBlock: { default: null },
|
|
138
135
|
dataTracked: { default: null },
|
|
139
136
|
},
|
|
140
137
|
parseDOM: [
|
|
@@ -154,10 +151,9 @@ exports.tracked_delete = {
|
|
|
154
151
|
},
|
|
155
152
|
],
|
|
156
153
|
toDOM: (el) => {
|
|
157
|
-
const block = el.attrs.isBlock ? 'track-block-node' : '';
|
|
158
154
|
const dataTracked = el.attrs.dataTracked || {};
|
|
159
155
|
const { status = 'pending', id, userID, createdAt } = dataTracked;
|
|
160
|
-
const attrs = Object.assign(Object.assign(Object.assign({ class: `deleted ${status}
|
|
156
|
+
const attrs = Object.assign(Object.assign(Object.assign({ class: `deleted ${status}`, 'data-track-status': status }, (id && { 'data-track-id': id })), (userID && { 'data-user-id': userID })), (createdAt && { 'data-track-created-at': createdAt.toString() }));
|
|
161
157
|
return ['del', attrs];
|
|
162
158
|
},
|
|
163
159
|
};
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.bibliographyElement = void 0;
|
|
19
19
|
exports.bibliographyElement = {
|
|
20
|
-
content: '(bibliography_item | placeholder)
|
|
21
|
-
marks: 'tracked_insert tracked_delete',
|
|
20
|
+
content: '(bibliography_item | placeholder)+',
|
|
22
21
|
attrs: {
|
|
23
22
|
id: { default: '' },
|
|
24
23
|
contents: { default: '' },
|
|
@@ -18,7 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.isCitationNode = exports.citation = void 0;
|
|
19
19
|
exports.citation = {
|
|
20
20
|
inline: true,
|
|
21
|
-
isMetaNode: true,
|
|
22
21
|
group: 'inline',
|
|
23
22
|
draggable: true,
|
|
24
23
|
atom: true,
|
|
@@ -27,22 +26,16 @@ exports.citation = {
|
|
|
27
26
|
contents: { default: '' },
|
|
28
27
|
selectedText: { default: '' },
|
|
29
28
|
dataTracked: { default: null },
|
|
30
|
-
embeddedCitationItems: { default: null },
|
|
31
29
|
},
|
|
32
30
|
parseDOM: [
|
|
33
31
|
{
|
|
34
32
|
tag: 'span.citation[data-reference-id]',
|
|
35
33
|
getAttrs: (p) => {
|
|
36
34
|
const dom = p;
|
|
37
|
-
|
|
35
|
+
return {
|
|
38
36
|
rid: dom.getAttribute('data-reference-id'),
|
|
39
37
|
contents: dom.innerHTML,
|
|
40
38
|
};
|
|
41
|
-
const embeddedCitation = JSON.parse(dom.getAttribute('data-reference-embedded-citation') || 'null');
|
|
42
|
-
if (embeddedCitation) {
|
|
43
|
-
attr['embeddedCitationItems'] = embeddedCitation;
|
|
44
|
-
}
|
|
45
|
-
return attr;
|
|
46
39
|
},
|
|
47
40
|
},
|
|
48
41
|
],
|
|
@@ -51,9 +44,6 @@ exports.citation = {
|
|
|
51
44
|
const dom = document.createElement('span');
|
|
52
45
|
dom.className = 'citation';
|
|
53
46
|
dom.setAttribute('data-reference-id', citationNode.attrs.rid);
|
|
54
|
-
if (citationNode.attrs.embeddedCitationItems) {
|
|
55
|
-
dom.setAttribute('data-reference-embedded-citation', JSON.stringify(citationNode.attrs.embeddedCitationItems));
|
|
56
|
-
}
|
|
57
47
|
dom.innerHTML = citationNode.attrs.contents;
|
|
58
48
|
return dom;
|
|
59
49
|
},
|
|
@@ -24,6 +24,7 @@ exports.crossReference = {
|
|
|
24
24
|
attrs: {
|
|
25
25
|
rid: { default: '' },
|
|
26
26
|
label: { default: '' },
|
|
27
|
+
customLabel: { default: '' },
|
|
27
28
|
dataTracked: { default: null },
|
|
28
29
|
},
|
|
29
30
|
parseDOM: [
|
|
@@ -51,7 +52,11 @@ exports.crossReference = {
|
|
|
51
52
|
{
|
|
52
53
|
class: 'kind elementIndex',
|
|
53
54
|
},
|
|
54
|
-
[
|
|
55
|
+
[
|
|
56
|
+
'b',
|
|
57
|
+
crossReferenceNode.attrs.customLabel ||
|
|
58
|
+
crossReferenceNode.attrs.label,
|
|
59
|
+
],
|
|
55
60
|
],
|
|
56
61
|
];
|
|
57
62
|
},
|
|
@@ -228,7 +228,8 @@ class HTMLTransformer {
|
|
|
228
228
|
}
|
|
229
229
|
element.setAttribute('data-reference-ids', crossReferenceNode.attrs.rid);
|
|
230
230
|
}
|
|
231
|
-
element.textContent =
|
|
231
|
+
element.textContent =
|
|
232
|
+
crossReferenceNode.attrs.customLabel || crossReferenceNode.attrs.label;
|
|
232
233
|
return element;
|
|
233
234
|
};
|
|
234
235
|
nodes.listing = (node) => {
|
|
@@ -645,11 +645,9 @@ const nodes = [
|
|
|
645
645
|
getAttrs: (node) => {
|
|
646
646
|
var _a;
|
|
647
647
|
const element = node;
|
|
648
|
-
const embeddedCitation = element.getAttribute('data-reference-embedded-citation') || 'null';
|
|
649
648
|
return {
|
|
650
649
|
rid: element.getAttribute('rid'),
|
|
651
650
|
contents: (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.trim(),
|
|
652
|
-
embeddedCitationItems: JSON.parse(embeddedCitation),
|
|
653
651
|
};
|
|
654
652
|
},
|
|
655
653
|
},
|
|
@@ -155,7 +155,6 @@ export const jatsReferenceParser = {
|
|
|
155
155
|
const citation = buildCitation('', rids);
|
|
156
156
|
modelNodes.push(citation);
|
|
157
157
|
crossReferenceNode.setAttribute('rid', citation._id);
|
|
158
|
-
crossReferenceNode.setAttribute('data-reference-embedded-citation', JSON.stringify(citation.embeddedCitationItems));
|
|
159
158
|
}
|
|
160
159
|
else {
|
|
161
160
|
crossReferenceNode.removeAttribute('rid');
|
|
@@ -682,7 +682,7 @@ export class JATSExporter {
|
|
|
682
682
|
const rid = getReferencedObjectId(auxiliaryObjectReference.referencedObject);
|
|
683
683
|
xref.setAttribute('rid', rid);
|
|
684
684
|
}
|
|
685
|
-
xref.textContent = node.attrs.label;
|
|
685
|
+
xref.textContent = node.attrs.customLabel || node.attrs.label;
|
|
686
686
|
return xref;
|
|
687
687
|
},
|
|
688
688
|
doc: () => '',
|
package/dist/es/schema/marks.js
CHANGED
|
@@ -101,7 +101,6 @@ export const underline = {
|
|
|
101
101
|
export const tracked_insert = {
|
|
102
102
|
excludes: 'tracked_insert tracked_delete',
|
|
103
103
|
attrs: {
|
|
104
|
-
isBlock: { default: null },
|
|
105
104
|
dataTracked: { default: null },
|
|
106
105
|
},
|
|
107
106
|
parseDOM: [
|
|
@@ -121,17 +120,15 @@ export const tracked_insert = {
|
|
|
121
120
|
},
|
|
122
121
|
],
|
|
123
122
|
toDOM: (el) => {
|
|
124
|
-
const block = el.attrs.isBlock ? 'track-block-node' : '';
|
|
125
123
|
const dataTracked = el.attrs.dataTracked || {};
|
|
126
124
|
const { status = 'pending', id, userID, createdAt } = dataTracked;
|
|
127
|
-
const attrs = Object.assign(Object.assign(Object.assign({ class: `inserted ${status}
|
|
125
|
+
const attrs = Object.assign(Object.assign(Object.assign({ class: `inserted ${status}`, 'data-track-status': status }, (id && { 'data-track-id': id })), (userID && { 'data-user-id': userID })), (createdAt && { 'data-track-created-at': createdAt.toString() }));
|
|
128
126
|
return ['ins', attrs];
|
|
129
127
|
},
|
|
130
128
|
};
|
|
131
129
|
export const tracked_delete = {
|
|
132
130
|
excludes: 'tracked_insert tracked_delete',
|
|
133
131
|
attrs: {
|
|
134
|
-
isBlock: { default: null },
|
|
135
132
|
dataTracked: { default: null },
|
|
136
133
|
},
|
|
137
134
|
parseDOM: [
|
|
@@ -151,10 +148,9 @@ export const tracked_delete = {
|
|
|
151
148
|
},
|
|
152
149
|
],
|
|
153
150
|
toDOM: (el) => {
|
|
154
|
-
const block = el.attrs.isBlock ? 'track-block-node' : '';
|
|
155
151
|
const dataTracked = el.attrs.dataTracked || {};
|
|
156
152
|
const { status = 'pending', id, userID, createdAt } = dataTracked;
|
|
157
|
-
const attrs = Object.assign(Object.assign(Object.assign({ class: `deleted ${status}
|
|
153
|
+
const attrs = Object.assign(Object.assign(Object.assign({ class: `deleted ${status}`, 'data-track-status': status }, (id && { 'data-track-id': id })), (userID && { 'data-user-id': userID })), (createdAt && { 'data-track-created-at': createdAt.toString() }));
|
|
158
154
|
return ['del', attrs];
|
|
159
155
|
},
|
|
160
156
|
};
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export const bibliographyElement = {
|
|
17
|
-
content: '(bibliography_item | placeholder)
|
|
18
|
-
marks: 'tracked_insert tracked_delete',
|
|
17
|
+
content: '(bibliography_item | placeholder)+',
|
|
19
18
|
attrs: {
|
|
20
19
|
id: { default: '' },
|
|
21
20
|
contents: { default: '' },
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export const citation = {
|
|
17
17
|
inline: true,
|
|
18
|
-
isMetaNode: true,
|
|
19
18
|
group: 'inline',
|
|
20
19
|
draggable: true,
|
|
21
20
|
atom: true,
|
|
@@ -24,22 +23,16 @@ export const citation = {
|
|
|
24
23
|
contents: { default: '' },
|
|
25
24
|
selectedText: { default: '' },
|
|
26
25
|
dataTracked: { default: null },
|
|
27
|
-
embeddedCitationItems: { default: null },
|
|
28
26
|
},
|
|
29
27
|
parseDOM: [
|
|
30
28
|
{
|
|
31
29
|
tag: 'span.citation[data-reference-id]',
|
|
32
30
|
getAttrs: (p) => {
|
|
33
31
|
const dom = p;
|
|
34
|
-
|
|
32
|
+
return {
|
|
35
33
|
rid: dom.getAttribute('data-reference-id'),
|
|
36
34
|
contents: dom.innerHTML,
|
|
37
35
|
};
|
|
38
|
-
const embeddedCitation = JSON.parse(dom.getAttribute('data-reference-embedded-citation') || 'null');
|
|
39
|
-
if (embeddedCitation) {
|
|
40
|
-
attr['embeddedCitationItems'] = embeddedCitation;
|
|
41
|
-
}
|
|
42
|
-
return attr;
|
|
43
36
|
},
|
|
44
37
|
},
|
|
45
38
|
],
|
|
@@ -48,9 +41,6 @@ export const citation = {
|
|
|
48
41
|
const dom = document.createElement('span');
|
|
49
42
|
dom.className = 'citation';
|
|
50
43
|
dom.setAttribute('data-reference-id', citationNode.attrs.rid);
|
|
51
|
-
if (citationNode.attrs.embeddedCitationItems) {
|
|
52
|
-
dom.setAttribute('data-reference-embedded-citation', JSON.stringify(citationNode.attrs.embeddedCitationItems));
|
|
53
|
-
}
|
|
54
44
|
dom.innerHTML = citationNode.attrs.contents;
|
|
55
45
|
return dom;
|
|
56
46
|
},
|
|
@@ -21,6 +21,7 @@ export const crossReference = {
|
|
|
21
21
|
attrs: {
|
|
22
22
|
rid: { default: '' },
|
|
23
23
|
label: { default: '' },
|
|
24
|
+
customLabel: { default: '' },
|
|
24
25
|
dataTracked: { default: null },
|
|
25
26
|
},
|
|
26
27
|
parseDOM: [
|
|
@@ -48,7 +49,11 @@ export const crossReference = {
|
|
|
48
49
|
{
|
|
49
50
|
class: 'kind elementIndex',
|
|
50
51
|
},
|
|
51
|
-
[
|
|
52
|
+
[
|
|
53
|
+
'b',
|
|
54
|
+
crossReferenceNode.attrs.customLabel ||
|
|
55
|
+
crossReferenceNode.attrs.label,
|
|
56
|
+
],
|
|
52
57
|
],
|
|
53
58
|
];
|
|
54
59
|
},
|
|
@@ -222,7 +222,8 @@ export class HTMLTransformer {
|
|
|
222
222
|
}
|
|
223
223
|
element.setAttribute('data-reference-ids', crossReferenceNode.attrs.rid);
|
|
224
224
|
}
|
|
225
|
-
element.textContent =
|
|
225
|
+
element.textContent =
|
|
226
|
+
crossReferenceNode.attrs.customLabel || crossReferenceNode.attrs.label;
|
|
226
227
|
return element;
|
|
227
228
|
};
|
|
228
229
|
nodes.listing = (node) => {
|
|
@@ -18,10 +18,6 @@ import { ManuscriptNode } from '../types';
|
|
|
18
18
|
interface Attrs {
|
|
19
19
|
rid: string;
|
|
20
20
|
contents: string;
|
|
21
|
-
embeddedCitationItems: {
|
|
22
|
-
id: string;
|
|
23
|
-
bibliographyItem: string;
|
|
24
|
-
}[];
|
|
25
21
|
}
|
|
26
22
|
export interface CitationNode extends ManuscriptNode {
|
|
27
23
|
attrs: Attrs;
|
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.3.11-LEAN-
|
|
4
|
+
"version": "1.3.11-LEAN-2147",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|