@manuscripts/transform 4.1.0 → 4.1.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/exporter/jats-exporter.js +12 -8
- package/dist/cjs/jats/importer/jats-dom-parser.js +7 -6
- package/dist/cjs/schema/nodes/image_element.js +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/es/jats/exporter/jats-exporter.js +12 -8
- package/dist/es/jats/importer/jats-dom-parser.js +7 -6
- package/dist/es/schema/nodes/image_element.js +1 -0
- package/dist/es/version.js +1 -1
- package/dist/types/jats/importer/jats-dom-parser.d.ts +1 -1
- package/dist/types/schema/nodes/image_element.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -473,7 +473,7 @@ class JATSExporter {
|
|
|
473
473
|
id: normalizeID(node.attrs.id),
|
|
474
474
|
};
|
|
475
475
|
if (node.attrs.lang) {
|
|
476
|
-
attrs[
|
|
476
|
+
attrs[`${XML_NAMESPACE} lang`] = node.attrs.lang;
|
|
477
477
|
}
|
|
478
478
|
if (node.attrs.category) {
|
|
479
479
|
attrs['sec-type'] = node.attrs.category;
|
|
@@ -902,13 +902,17 @@ class JATSExporter {
|
|
|
902
902
|
};
|
|
903
903
|
const createImage = (node) => {
|
|
904
904
|
const graphicNode = node.content.firstChild;
|
|
905
|
-
if (graphicNode) {
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
905
|
+
if (!graphicNode) {
|
|
906
|
+
return '';
|
|
907
|
+
}
|
|
908
|
+
const graphicElement = createGraphic(graphicNode);
|
|
909
|
+
if (node.attrs.extLink) {
|
|
910
|
+
const extLink = this.appendElement(graphicElement, 'ext-link');
|
|
911
|
+
extLink.setAttributeNS(XLINK_NAMESPACE, 'href', node.attrs.extLink);
|
|
910
912
|
}
|
|
911
|
-
|
|
913
|
+
appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.alt_text);
|
|
914
|
+
appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.long_desc);
|
|
915
|
+
return graphicElement;
|
|
912
916
|
};
|
|
913
917
|
const createGraphic = (node) => {
|
|
914
918
|
const graphic = this.createElement('graphic');
|
|
@@ -1523,7 +1527,7 @@ class JATSExporter {
|
|
|
1523
1527
|
}
|
|
1524
1528
|
createTransAbstractNode(transAbstract) {
|
|
1525
1529
|
const transAbstractNode = this.createElement('trans-abstract');
|
|
1526
|
-
transAbstractNode.setAttributeNS(XML_NAMESPACE, 'lang', transAbstract.
|
|
1530
|
+
transAbstractNode.setAttributeNS(XML_NAMESPACE, 'lang', transAbstract.getAttributeNS(XML_NAMESPACE, 'lang') ?? '');
|
|
1527
1531
|
this.setAbstractType(transAbstractNode, transAbstract);
|
|
1528
1532
|
transAbstractNode.append(...transAbstract.childNodes);
|
|
1529
1533
|
return transAbstractNode;
|
|
@@ -97,8 +97,9 @@ class JATSDOMParser {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
this.
|
|
100
|
+
this.getFigAttrs = (node) => {
|
|
101
101
|
const element = node;
|
|
102
|
+
const extLink = element.querySelector('ext-link');
|
|
102
103
|
const parentElement = element.parentElement;
|
|
103
104
|
return {
|
|
104
105
|
id: element.getAttribute('id'),
|
|
@@ -106,6 +107,7 @@ class JATSDOMParser {
|
|
|
106
107
|
element.getAttribute('content-type') ??
|
|
107
108
|
'',
|
|
108
109
|
src: element.getAttributeNS(this.XLINK_NAMESPACE, 'href'),
|
|
110
|
+
extLink: extLink?.getAttributeNS(this.XLINK_NAMESPACE, 'href'),
|
|
109
111
|
};
|
|
110
112
|
};
|
|
111
113
|
this.getInstitutionDetails = (element) => {
|
|
@@ -151,9 +153,7 @@ class JATSDOMParser {
|
|
|
151
153
|
};
|
|
152
154
|
this.getFigContent = (node) => {
|
|
153
155
|
const element = node;
|
|
154
|
-
const content = [
|
|
155
|
-
this.schema.nodes.figure.create(this.getFigureAttrs(element)),
|
|
156
|
-
];
|
|
156
|
+
const content = [this.schema.nodes.figure.create(this.getFigAttrs(element))];
|
|
157
157
|
const altText = element.querySelector('alt-text');
|
|
158
158
|
if (altText) {
|
|
159
159
|
const altTextNode = this.schema.nodes.alt_text.create();
|
|
@@ -568,7 +568,7 @@ class JATSDOMParser {
|
|
|
568
568
|
tag: 'graphic',
|
|
569
569
|
node: 'quote_image',
|
|
570
570
|
context: 'pullquote_element/',
|
|
571
|
-
getAttrs: this.
|
|
571
|
+
getAttrs: this.getFigAttrs,
|
|
572
572
|
},
|
|
573
573
|
{
|
|
574
574
|
tag: 'ext-link',
|
|
@@ -633,12 +633,13 @@ class JATSDOMParser {
|
|
|
633
633
|
tag: 'graphic',
|
|
634
634
|
node: 'figure',
|
|
635
635
|
context: 'figure_element/',
|
|
636
|
-
getAttrs: this.
|
|
636
|
+
getAttrs: this.getFigAttrs,
|
|
637
637
|
},
|
|
638
638
|
{
|
|
639
639
|
tag: 'graphic',
|
|
640
640
|
node: 'image_element',
|
|
641
641
|
getContent: this.getFigContent,
|
|
642
|
+
getAttrs: this.getFigAttrs,
|
|
642
643
|
},
|
|
643
644
|
{
|
|
644
645
|
tag: 'fig',
|
package/dist/cjs/version.js
CHANGED
|
@@ -443,7 +443,7 @@ export class JATSExporter {
|
|
|
443
443
|
id: normalizeID(node.attrs.id),
|
|
444
444
|
};
|
|
445
445
|
if (node.attrs.lang) {
|
|
446
|
-
attrs[
|
|
446
|
+
attrs[`${XML_NAMESPACE} lang`] = node.attrs.lang;
|
|
447
447
|
}
|
|
448
448
|
if (node.attrs.category) {
|
|
449
449
|
attrs['sec-type'] = node.attrs.category;
|
|
@@ -872,13 +872,17 @@ export class JATSExporter {
|
|
|
872
872
|
};
|
|
873
873
|
const createImage = (node) => {
|
|
874
874
|
const graphicNode = node.content.firstChild;
|
|
875
|
-
if (graphicNode) {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
875
|
+
if (!graphicNode) {
|
|
876
|
+
return '';
|
|
877
|
+
}
|
|
878
|
+
const graphicElement = createGraphic(graphicNode);
|
|
879
|
+
if (node.attrs.extLink) {
|
|
880
|
+
const extLink = this.appendElement(graphicElement, 'ext-link');
|
|
881
|
+
extLink.setAttributeNS(XLINK_NAMESPACE, 'href', node.attrs.extLink);
|
|
880
882
|
}
|
|
881
|
-
|
|
883
|
+
appendChildNodeOfType(graphicElement, node, schema.nodes.alt_text);
|
|
884
|
+
appendChildNodeOfType(graphicElement, node, schema.nodes.long_desc);
|
|
885
|
+
return graphicElement;
|
|
882
886
|
};
|
|
883
887
|
const createGraphic = (node) => {
|
|
884
888
|
const graphic = this.createElement('graphic');
|
|
@@ -1493,7 +1497,7 @@ export class JATSExporter {
|
|
|
1493
1497
|
}
|
|
1494
1498
|
createTransAbstractNode(transAbstract) {
|
|
1495
1499
|
const transAbstractNode = this.createElement('trans-abstract');
|
|
1496
|
-
transAbstractNode.setAttributeNS(XML_NAMESPACE, 'lang', transAbstract.
|
|
1500
|
+
transAbstractNode.setAttributeNS(XML_NAMESPACE, 'lang', transAbstract.getAttributeNS(XML_NAMESPACE, 'lang') ?? '');
|
|
1497
1501
|
this.setAbstractType(transAbstractNode, transAbstract);
|
|
1498
1502
|
transAbstractNode.append(...transAbstract.childNodes);
|
|
1499
1503
|
return transAbstractNode;
|
|
@@ -94,8 +94,9 @@ export class JATSDOMParser {
|
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
-
this.
|
|
97
|
+
this.getFigAttrs = (node) => {
|
|
98
98
|
const element = node;
|
|
99
|
+
const extLink = element.querySelector('ext-link');
|
|
99
100
|
const parentElement = element.parentElement;
|
|
100
101
|
return {
|
|
101
102
|
id: element.getAttribute('id'),
|
|
@@ -103,6 +104,7 @@ export class JATSDOMParser {
|
|
|
103
104
|
element.getAttribute('content-type') ??
|
|
104
105
|
'',
|
|
105
106
|
src: element.getAttributeNS(this.XLINK_NAMESPACE, 'href'),
|
|
107
|
+
extLink: extLink?.getAttributeNS(this.XLINK_NAMESPACE, 'href'),
|
|
106
108
|
};
|
|
107
109
|
};
|
|
108
110
|
this.getInstitutionDetails = (element) => {
|
|
@@ -148,9 +150,7 @@ export class JATSDOMParser {
|
|
|
148
150
|
};
|
|
149
151
|
this.getFigContent = (node) => {
|
|
150
152
|
const element = node;
|
|
151
|
-
const content = [
|
|
152
|
-
this.schema.nodes.figure.create(this.getFigureAttrs(element)),
|
|
153
|
-
];
|
|
153
|
+
const content = [this.schema.nodes.figure.create(this.getFigAttrs(element))];
|
|
154
154
|
const altText = element.querySelector('alt-text');
|
|
155
155
|
if (altText) {
|
|
156
156
|
const altTextNode = this.schema.nodes.alt_text.create();
|
|
@@ -565,7 +565,7 @@ export class JATSDOMParser {
|
|
|
565
565
|
tag: 'graphic',
|
|
566
566
|
node: 'quote_image',
|
|
567
567
|
context: 'pullquote_element/',
|
|
568
|
-
getAttrs: this.
|
|
568
|
+
getAttrs: this.getFigAttrs,
|
|
569
569
|
},
|
|
570
570
|
{
|
|
571
571
|
tag: 'ext-link',
|
|
@@ -630,12 +630,13 @@ export class JATSDOMParser {
|
|
|
630
630
|
tag: 'graphic',
|
|
631
631
|
node: 'figure',
|
|
632
632
|
context: 'figure_element/',
|
|
633
|
-
getAttrs: this.
|
|
633
|
+
getAttrs: this.getFigAttrs,
|
|
634
634
|
},
|
|
635
635
|
{
|
|
636
636
|
tag: 'graphic',
|
|
637
637
|
node: 'image_element',
|
|
638
638
|
getContent: this.getFigContent,
|
|
639
|
+
getAttrs: this.getFigAttrs,
|
|
639
640
|
},
|
|
640
641
|
{
|
|
641
642
|
tag: 'fig',
|
package/dist/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "4.1.
|
|
1
|
+
export const VERSION = "4.1.1";
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.1.
|
|
1
|
+
export declare const VERSION = "4.1.1";
|
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": "4.1.
|
|
4
|
+
"version": "4.1.1",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|