@manuscripts/transform 4.0.0 → 4.0.1-LEAN-4573.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/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
|
@@ -467,7 +467,7 @@ class JATSExporter {
|
|
|
467
467
|
id: normalizeID(node.attrs.id),
|
|
468
468
|
};
|
|
469
469
|
if (node.attrs.lang) {
|
|
470
|
-
attrs[
|
|
470
|
+
attrs[`${XML_NAMESPACE} lang`] = node.attrs.lang;
|
|
471
471
|
}
|
|
472
472
|
if (node.attrs.category) {
|
|
473
473
|
attrs['sec-type'] = node.attrs.category;
|
|
@@ -894,13 +894,17 @@ class JATSExporter {
|
|
|
894
894
|
};
|
|
895
895
|
const createImage = (node) => {
|
|
896
896
|
const graphicNode = node.content.firstChild;
|
|
897
|
-
if (graphicNode) {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
897
|
+
if (!graphicNode) {
|
|
898
|
+
return '';
|
|
899
|
+
}
|
|
900
|
+
const graphicElement = createGraphic(graphicNode);
|
|
901
|
+
if (node.attrs.extLink) {
|
|
902
|
+
const extLink = this.appendElement(graphicElement, 'ext-link');
|
|
903
|
+
extLink.setAttributeNS(XLINK_NAMESPACE, 'href', node.attrs.extLink);
|
|
902
904
|
}
|
|
903
|
-
|
|
905
|
+
appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.alt_text);
|
|
906
|
+
appendChildNodeOfType(graphicElement, node, schema_1.schema.nodes.long_desc);
|
|
907
|
+
return graphicElement;
|
|
904
908
|
};
|
|
905
909
|
const createGraphic = (node) => {
|
|
906
910
|
const graphic = this.createElement('graphic');
|
|
@@ -1515,7 +1519,7 @@ class JATSExporter {
|
|
|
1515
1519
|
}
|
|
1516
1520
|
createTransAbstractNode(transAbstract) {
|
|
1517
1521
|
const transAbstractNode = this.createElement('trans-abstract');
|
|
1518
|
-
transAbstractNode.setAttributeNS(XML_NAMESPACE, 'lang', transAbstract.
|
|
1522
|
+
transAbstractNode.setAttributeNS(XML_NAMESPACE, 'lang', transAbstract.getAttributeNS(XML_NAMESPACE, 'lang') ?? '');
|
|
1519
1523
|
this.setAbstractType(transAbstractNode, transAbstract);
|
|
1520
1524
|
transAbstractNode.append(...transAbstract.childNodes);
|
|
1521
1525
|
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
|
@@ -437,7 +437,7 @@ export class JATSExporter {
|
|
|
437
437
|
id: normalizeID(node.attrs.id),
|
|
438
438
|
};
|
|
439
439
|
if (node.attrs.lang) {
|
|
440
|
-
attrs[
|
|
440
|
+
attrs[`${XML_NAMESPACE} lang`] = node.attrs.lang;
|
|
441
441
|
}
|
|
442
442
|
if (node.attrs.category) {
|
|
443
443
|
attrs['sec-type'] = node.attrs.category;
|
|
@@ -864,13 +864,17 @@ export class JATSExporter {
|
|
|
864
864
|
};
|
|
865
865
|
const createImage = (node) => {
|
|
866
866
|
const graphicNode = node.content.firstChild;
|
|
867
|
-
if (graphicNode) {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
867
|
+
if (!graphicNode) {
|
|
868
|
+
return '';
|
|
869
|
+
}
|
|
870
|
+
const graphicElement = createGraphic(graphicNode);
|
|
871
|
+
if (node.attrs.extLink) {
|
|
872
|
+
const extLink = this.appendElement(graphicElement, 'ext-link');
|
|
873
|
+
extLink.setAttributeNS(XLINK_NAMESPACE, 'href', node.attrs.extLink);
|
|
872
874
|
}
|
|
873
|
-
|
|
875
|
+
appendChildNodeOfType(graphicElement, node, schema.nodes.alt_text);
|
|
876
|
+
appendChildNodeOfType(graphicElement, node, schema.nodes.long_desc);
|
|
877
|
+
return graphicElement;
|
|
874
878
|
};
|
|
875
879
|
const createGraphic = (node) => {
|
|
876
880
|
const graphic = this.createElement('graphic');
|
|
@@ -1485,7 +1489,7 @@ export class JATSExporter {
|
|
|
1485
1489
|
}
|
|
1486
1490
|
createTransAbstractNode(transAbstract) {
|
|
1487
1491
|
const transAbstractNode = this.createElement('trans-abstract');
|
|
1488
|
-
transAbstractNode.setAttributeNS(XML_NAMESPACE, 'lang', transAbstract.
|
|
1492
|
+
transAbstractNode.setAttributeNS(XML_NAMESPACE, 'lang', transAbstract.getAttributeNS(XML_NAMESPACE, 'lang') ?? '');
|
|
1489
1493
|
this.setAbstractType(transAbstractNode, transAbstract);
|
|
1490
1494
|
transAbstractNode.append(...transAbstract.childNodes);
|
|
1491
1495
|
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.0.0";
|
|
1
|
+
export const VERSION = "4.0.1-LEAN-4573.0";
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.0";
|
|
1
|
+
export declare const VERSION = "4.0.1-LEAN-4573.0";
|
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.0.0",
|
|
4
|
+
"version": "4.0.1-LEAN-4573.0",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|