@manuscripts/transform 3.0.2 → 3.0.4-LEAN-3933.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.
@@ -887,8 +887,8 @@ const nodes = [
887
887
  node: 'table_cell',
888
888
  getAttrs: (node) => {
889
889
  const element = node;
890
- const colspan = element.getAttribute('colspan');
891
- const rowspan = element.getAttribute('rowspan');
890
+ const colspan = parseInt(element.getAttribute('colspan') || '1');
891
+ const rowspan = parseInt(element.getAttribute('rowspan') || '1');
892
892
  return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
893
893
  },
894
894
  },
@@ -897,8 +897,8 @@ const nodes = [
897
897
  node: 'table_header',
898
898
  getAttrs: (node) => {
899
899
  const element = node;
900
- const colspan = element.getAttribute('colspan');
901
- const rowspan = element.getAttribute('rowspan');
900
+ const colspan = parseInt(element.getAttribute('colspan') || '1');
901
+ const rowspan = parseInt(element.getAttribute('rowspan') || '1');
902
902
  return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
903
903
  },
904
904
  },
@@ -209,11 +209,16 @@ const chooseSectionCategoryByType = (secType) => {
209
209
  };
210
210
  exports.chooseSectionCategoryByType = chooseSectionCategoryByType;
211
211
  const chooseSectionCategory = (section) => {
212
+ var _a, _b;
212
213
  const secType = section.getAttribute('sec-type');
213
214
  const secCat = (0, exports.chooseSectionCategoryByType)(secType);
215
+ const parent = (_b = (_a = section.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.nodeName.toLowerCase();
214
216
  if (secCat) {
215
217
  return secCat;
216
218
  }
219
+ else if (parent !== 'body') {
220
+ return 'MPSectionCategory:subsection';
221
+ }
217
222
  else {
218
223
  const titleNode = section.firstElementChild;
219
224
  if (titleNode && titleNode.nodeName === 'title' && titleNode.textContent) {
@@ -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.2";
4
+ exports.VERSION = "3.0.4-LEAN-3933.0";
@@ -881,8 +881,8 @@ const nodes = [
881
881
  node: 'table_cell',
882
882
  getAttrs: (node) => {
883
883
  const element = node;
884
- const colspan = element.getAttribute('colspan');
885
- const rowspan = element.getAttribute('rowspan');
884
+ const colspan = parseInt(element.getAttribute('colspan') || '1');
885
+ const rowspan = parseInt(element.getAttribute('rowspan') || '1');
886
886
  return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
887
887
  },
888
888
  },
@@ -891,8 +891,8 @@ const nodes = [
891
891
  node: 'table_header',
892
892
  getAttrs: (node) => {
893
893
  const element = node;
894
- const colspan = element.getAttribute('colspan');
895
- const rowspan = element.getAttribute('rowspan');
894
+ const colspan = parseInt(element.getAttribute('colspan') || '1');
895
+ const rowspan = parseInt(element.getAttribute('rowspan') || '1');
896
896
  return Object.assign(Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })), { valign: element.getAttribute('valign'), align: element.getAttribute('align'), scope: element.getAttribute('scope'), style: element.getAttribute('style') });
897
897
  },
898
898
  },
@@ -197,11 +197,16 @@ export const chooseSectionCategoryByType = (secType) => {
197
197
  }
198
198
  };
199
199
  export const chooseSectionCategory = (section) => {
200
+ var _a, _b;
200
201
  const secType = section.getAttribute('sec-type');
201
202
  const secCat = chooseSectionCategoryByType(secType);
203
+ const parent = (_b = (_a = section.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.nodeName.toLowerCase();
202
204
  if (secCat) {
203
205
  return secCat;
204
206
  }
207
+ else if (parent !== 'body') {
208
+ return 'MPSectionCategory:subsection';
209
+ }
205
210
  else {
206
211
  const titleNode = section.firstElementChild;
207
212
  if (titleNode && titleNode.nodeName === 'title' && titleNode.textContent) {
@@ -1 +1 @@
1
- export const VERSION = "3.0.2";
1
+ export const VERSION = "3.0.4-LEAN-3933.0";
@@ -17,8 +17,8 @@ import { Element } from '@manuscripts/json-schema';
17
17
  import { SectionGroupType } from '../lib/section-group-type';
18
18
  import { ManuscriptNode, ManuscriptNodeType } from '../schema';
19
19
  export declare const isAnySectionNode: (node: ManuscriptNode) => boolean;
20
- export type SectionCategory = 'MPSectionCategory:abstract' | 'MPSectionCategory:abstract-teaser' | 'MPSectionCategory:abstract-graphical' | 'MPSectionCategory:acknowledgement' | 'MPSectionCategory:availability' | 'MPSectionCategory:bibliography' | 'MPSectionCategory:conclusions' | 'MPSectionCategory:discussion' | 'MPSectionCategory:endnotes' | 'MPSectionCategory:introduction' | 'MPSectionCategory:keywords' | 'MPSectionCategory:materials-method' | 'MPSectionCategory:results' | 'MPSectionCategory:toc' | 'MPSectionCategory:floating-element' | 'MPSectionCategory:appendices' | 'MPSectionCategory:competing-interests' | 'MPSectionCategory:financial-disclosure' | 'MPSectionCategory:con' | 'MPSectionCategory:deceased' | 'MPSectionCategory:equal' | 'MPSectionCategory:present-address' | 'MPSectionCategory:presented-at' | 'MPSectionCategory:previously-at' | 'MPSectionCategory:supplementary-material' | 'MPSectionCategory:supported-by' | 'MPSectionCategory:ethics-statement' | 'MPSectionCategory:box-element';
21
- export type SecType = 'abstract' | 'abstract-teaser' | 'abstract-graphical' | 'acknowledgments' | 'availability' | 'bibliography' | 'conclusions' | 'data-availability' | 'discussion' | 'endnotes' | 'intro' | 'keywords' | 'materials' | 'methods' | 'results' | 'toc' | 'floating-element' | 'appendices' | 'competing-interests' | 'financial-disclosure' | 'con' | 'deceased' | 'equal' | 'present-address' | 'presented-at' | 'previously-at' | 'supplementary-material' | 'supported-by' | 'ethics-statement' | 'box-element';
20
+ export type SectionCategory = 'MPSectionCategory:abstract' | 'MPSectionCategory:abstract-teaser' | 'MPSectionCategory:abstract-graphical' | 'MPSectionCategory:acknowledgement' | 'MPSectionCategory:availability' | 'MPSectionCategory:bibliography' | 'MPSectionCategory:conclusions' | 'MPSectionCategory:discussion' | 'MPSectionCategory:endnotes' | 'MPSectionCategory:introduction' | 'MPSectionCategory:keywords' | 'MPSectionCategory:materials-method' | 'MPSectionCategory:results' | 'MPSectionCategory:toc' | 'MPSectionCategory:floating-element' | 'MPSectionCategory:appendices' | 'MPSectionCategory:competing-interests' | 'MPSectionCategory:financial-disclosure' | 'MPSectionCategory:con' | 'MPSectionCategory:deceased' | 'MPSectionCategory:equal' | 'MPSectionCategory:present-address' | 'MPSectionCategory:presented-at' | 'MPSectionCategory:previously-at' | 'MPSectionCategory:supplementary-material' | 'MPSectionCategory:supported-by' | 'MPSectionCategory:ethics-statement' | 'MPSectionCategory:box-element' | 'MPSectionCategory:subsection';
21
+ export type SecType = 'abstract' | 'abstract-teaser' | 'abstract-graphical' | 'acknowledgments' | 'availability' | 'bibliography' | 'conclusions' | 'data-availability' | 'discussion' | 'endnotes' | 'intro' | 'keywords' | 'materials' | 'methods' | 'results' | 'toc' | 'floating-element' | 'appendices' | 'competing-interests' | 'financial-disclosure' | 'con' | 'deceased' | 'equal' | 'present-address' | 'presented-at' | 'previously-at' | 'supplementary-material' | 'supported-by' | 'ethics-statement' | 'box-element' | 'subsection';
22
22
  export declare const chooseSectionNodeType: (category?: SectionCategory) => ManuscriptNodeType;
23
23
  export declare const chooseSectionLableName: (type?: SecType) => string;
24
24
  export declare const guessSectionCategory: (elements: Element[]) => SectionCategory | undefined;
@@ -1 +1 @@
1
- export declare const VERSION = "3.0.2";
1
+ export declare const VERSION = "3.0.4-LEAN-3933.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": "3.0.2",
4
+ "version": "3.0.4-LEAN-3933.0",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",