@manuscripts/transform 3.0.5 → 3.0.6

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.
@@ -833,7 +833,12 @@ const nodes = [
833
833
  tag: 'sec',
834
834
  node: 'section',
835
835
  getAttrs: (node) => {
836
+ var _a, _b;
836
837
  const element = node;
838
+ const grandParentNodeName = (_b = (_a = element.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.nodeName.toLowerCase();
839
+ if (grandParentNodeName && grandParentNodeName !== 'body') {
840
+ element.setAttribute('sec-type', 'subsection');
841
+ }
837
842
  return {
838
843
  id: element.getAttribute('id'),
839
844
  category: (0, transformer_1.chooseSectionCategory)(element),
@@ -203,6 +203,8 @@ const chooseSectionCategoryByType = (secType) => {
203
203
  return 'MPSectionCategory:ethics-statement';
204
204
  case 'box-element':
205
205
  return 'MPSectionCategory:box-element';
206
+ case 'subsection':
207
+ return 'MPSectionCategory:subsection';
206
208
  default:
207
209
  return undefined;
208
210
  }
@@ -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.5";
4
+ exports.VERSION = "3.0.6";
@@ -827,7 +827,12 @@ const nodes = [
827
827
  tag: 'sec',
828
828
  node: 'section',
829
829
  getAttrs: (node) => {
830
+ var _a, _b;
830
831
  const element = node;
832
+ const grandParentNodeName = (_b = (_a = element.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.nodeName.toLowerCase();
833
+ if (grandParentNodeName && grandParentNodeName !== 'body') {
834
+ element.setAttribute('sec-type', 'subsection');
835
+ }
831
836
  return {
832
837
  id: element.getAttribute('id'),
833
838
  category: chooseSectionCategory(element),
@@ -192,6 +192,8 @@ export const chooseSectionCategoryByType = (secType) => {
192
192
  return 'MPSectionCategory:ethics-statement';
193
193
  case 'box-element':
194
194
  return 'MPSectionCategory:box-element';
195
+ case 'subsection':
196
+ return 'MPSectionCategory:subsection';
195
197
  default:
196
198
  return undefined;
197
199
  }
@@ -1 +1 @@
1
- export const VERSION = "3.0.5";
1
+ export const VERSION = "3.0.6";
@@ -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.5";
1
+ export declare const VERSION = "3.0.6";
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.5",
4
+ "version": "3.0.6",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -83,4 +83,4 @@
83
83
  "rimraf": "^3.0.2",
84
84
  "typescript": "^4.0.5"
85
85
  }
86
- }
86
+ }