@manuscripts/transform 3.0.64 → 3.0.66

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.
@@ -963,7 +963,10 @@ class JATSExporter {
963
963
  const createBoxElement = (node) => {
964
964
  const element = createElement(node, 'boxed-text');
965
965
  appendLabels(element, node);
966
- appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
966
+ const child = node.firstChild;
967
+ if ((child === null || child === void 0 ? void 0 : child.type) === schema_1.schema.nodes.figcaption) {
968
+ appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
969
+ }
967
970
  processChildNodes(element, node, node.type.schema.nodes.section);
968
971
  return element;
969
972
  };
@@ -1227,10 +1230,9 @@ class JATSExporter {
1227
1230
  };
1228
1231
  this.appendParagraphToElement = (paragraph, element) => {
1229
1232
  const parsedDoc = new DOMParser().parseFromString(paragraph.textContent, 'text/html');
1230
- const parsedParagraph = parsedDoc.body.querySelector('p');
1231
- if (parsedParagraph) {
1233
+ if (parsedDoc.body.innerHTML.length) {
1232
1234
  const paragraphEl = this.createElement('p');
1233
- paragraphEl.innerHTML = parsedParagraph.innerHTML;
1235
+ paragraphEl.innerHTML = parsedDoc.body.innerHTML;
1234
1236
  paragraphEl.setAttribute('id', normalizeID(paragraph.attrs.id));
1235
1237
  element.appendChild(paragraphEl);
1236
1238
  }
@@ -51,6 +51,12 @@ const buildTargets = (node) => {
51
51
  if (parent && excludedTypes.includes(parent.type)) {
52
52
  return;
53
53
  }
54
+ if (node.type === schema_1.schema.nodes.box_element) {
55
+ const child = node.firstChild;
56
+ if (!child || child.type !== schema_1.schema.nodes.figcaption) {
57
+ return;
58
+ }
59
+ }
54
60
  const label = buildLabel(node.type);
55
61
  targets.set(node.attrs.id, {
56
62
  type: node.type.name,
@@ -337,6 +337,11 @@ class JATSDOMParser {
337
337
  };
338
338
  },
339
339
  },
340
+ {
341
+ tag: 'fn[fn-type]',
342
+ context: 'author_notes/',
343
+ ignore: true,
344
+ },
340
345
  {
341
346
  tag: 'fn:not([fn-type])',
342
347
  node: 'footnote',
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "3.0.64";
4
+ exports.VERSION = "3.0.66";
@@ -955,7 +955,10 @@ export class JATSExporter {
955
955
  const createBoxElement = (node) => {
956
956
  const element = createElement(node, 'boxed-text');
957
957
  appendLabels(element, node);
958
- appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
958
+ const child = node.firstChild;
959
+ if ((child === null || child === void 0 ? void 0 : child.type) === schema.nodes.figcaption) {
960
+ appendChildNodeOfType(element, node, node.type.schema.nodes.figcaption);
961
+ }
959
962
  processChildNodes(element, node, node.type.schema.nodes.section);
960
963
  return element;
961
964
  };
@@ -1219,10 +1222,9 @@ export class JATSExporter {
1219
1222
  };
1220
1223
  this.appendParagraphToElement = (paragraph, element) => {
1221
1224
  const parsedDoc = new DOMParser().parseFromString(paragraph.textContent, 'text/html');
1222
- const parsedParagraph = parsedDoc.body.querySelector('p');
1223
- if (parsedParagraph) {
1225
+ if (parsedDoc.body.innerHTML.length) {
1224
1226
  const paragraphEl = this.createElement('p');
1225
- paragraphEl.innerHTML = parsedParagraph.innerHTML;
1227
+ paragraphEl.innerHTML = parsedDoc.body.innerHTML;
1226
1228
  paragraphEl.setAttribute('id', normalizeID(paragraph.attrs.id));
1227
1229
  element.appendChild(paragraphEl);
1228
1230
  }
@@ -48,6 +48,12 @@ export const buildTargets = (node) => {
48
48
  if (parent && excludedTypes.includes(parent.type)) {
49
49
  return;
50
50
  }
51
+ if (node.type === schema.nodes.box_element) {
52
+ const child = node.firstChild;
53
+ if (!child || child.type !== schema.nodes.figcaption) {
54
+ return;
55
+ }
56
+ }
51
57
  const label = buildLabel(node.type);
52
58
  targets.set(node.attrs.id, {
53
59
  type: node.type.name,
@@ -334,6 +334,11 @@ export class JATSDOMParser {
334
334
  };
335
335
  },
336
336
  },
337
+ {
338
+ tag: 'fn[fn-type]',
339
+ context: 'author_notes/',
340
+ ignore: true,
341
+ },
337
342
  {
338
343
  tag: 'fn:not([fn-type])',
339
344
  node: 'footnote',
@@ -1 +1 @@
1
- export const VERSION = "3.0.64";
1
+ export const VERSION = "3.0.66";
@@ -15,11 +15,10 @@
15
15
  */
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
- interface Attrs {
18
+ export interface BoxElementAttrs {
19
19
  id: string;
20
20
  }
21
21
  export interface BoxElementNode extends ManuscriptNode {
22
- attrs: Attrs;
22
+ attrs: BoxElementAttrs;
23
23
  }
24
24
  export declare const box_element: NodeSpec;
25
- export {};
@@ -1 +1 @@
1
- export declare const VERSION = "3.0.64";
1
+ export declare const VERSION = "3.0.66";
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": "3.0.64",
4
+ "version": "3.0.66",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",