@manuscripts/transform 3.0.3 → 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.
@@ -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.3";
4
+ exports.VERSION = "3.0.4-LEAN-3933.0";
@@ -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.3";
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.3";
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.3",
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",