@manuscripts/transform 1.3.6-LEAN-2650 → 1.3.6-LEAN-2647

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/index.js CHANGED
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.isSectionLabelNode = void 0;
18
- __exportStar(require("./lib/core-sections"), exports);
19
18
  __exportStar(require("./lib/table-cell-styles"), exports);
20
19
  __exportStar(require("./lib/utils"), exports);
21
20
  __exportStar(require("./mathjax"), exports);
@@ -25,7 +25,7 @@ const createSectionContainer = (type, createElement) => {
25
25
  sectionContainer.setAttribute('sec-type', sectionCategory ? (0, transformer_1.chooseSecType)(sectionCategory) : '');
26
26
  const title = createElement('title');
27
27
  title.textContent = sectionCategory
28
- ? (0, transformer_1.getCoreSectionTitles)(sectionCategory)[0]
28
+ ? (0, transformer_1.getSectionTitles)(sectionCategory)[0]
29
29
  : ' ';
30
30
  sectionContainer.appendChild(title);
31
31
  return sectionContainer;
@@ -17,6 +17,7 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.bibliographyItem = void 0;
19
19
  exports.bibliographyItem = {
20
+ content: 'inline{0}',
20
21
  attrs: {
21
22
  id: { default: '' },
22
23
  type: { default: undefined },
@@ -14,10 +14,13 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
17
20
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.chooseSectionCategoryFromTitle = exports.chooseSectionCategory = exports.chooseSectionCategoryByType = exports.chooseSecType = exports.chooseJatsFnType = exports.buildSectionCategory = exports.guessSectionCategory = exports.chooseSectionLableName = exports.chooseSectionNodeType = exports.isAnySectionNode = exports.getCoreSectionTitles = void 0;
21
+ exports.chooseSectionCategoryFromTitle = exports.chooseSectionCategory = exports.chooseSectionCategoryByType = exports.chooseSecType = exports.chooseJatsFnType = exports.buildSectionCategory = exports.guessSectionCategory = exports.chooseSectionLableName = exports.chooseSectionNodeType = exports.isAnySectionNode = exports.getSectionTitles = void 0;
22
+ const section_categories_json_1 = __importDefault(require("@manuscripts/data/dist/shared/section-categories.json"));
19
23
  const json_schema_1 = require("@manuscripts/json-schema");
20
- const core_sections_1 = require("../lib/core-sections");
21
24
  const schema_1 = require("../schema");
22
25
  const sectionNodeTypes = [
23
26
  schema_1.schema.nodes.bibliography_section,
@@ -26,14 +29,18 @@ const sectionNodeTypes = [
26
29
  schema_1.schema.nodes.section,
27
30
  schema_1.schema.nodes.toc_section,
28
31
  ];
29
- const getCoreSectionTitles = (sectionCategory) => {
30
- const category = core_sections_1.coreSections.find((section) => section._id === sectionCategory);
32
+ const sectionCategoriesMap = new Map(section_categories_json_1.default.map((section) => [
33
+ section._id,
34
+ section,
35
+ ]));
36
+ const getSectionTitles = (sectionCategory) => {
37
+ const category = sectionCategoriesMap.get(sectionCategory);
31
38
  if (category) {
32
39
  return category.titles.length ? category.titles : [' '];
33
40
  }
34
- throw new Error(`${sectionCategory} not found in core sections`);
41
+ throw new Error(`${sectionCategory} not found in section categories`);
35
42
  };
36
- exports.getCoreSectionTitles = getCoreSectionTitles;
43
+ exports.getSectionTitles = getSectionTitles;
37
44
  const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
38
45
  exports.isAnySectionNode = isAnySectionNode;
39
46
  const chooseSectionNodeType = (category) => {
package/dist/es/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export * from './lib/core-sections';
2
1
  export * from './lib/table-cell-styles';
3
2
  export * from './lib/utils';
4
3
  export * from './mathjax';
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { chooseSectionCategoryByType, chooseSecType, getCoreSectionTitles, } from '../../transformer';
16
+ import { chooseSectionCategoryByType, chooseSecType, getSectionTitles, } from '../../transformer';
17
17
  const removeNodeFromParent = (node) => node.parentNode && node.parentNode.removeChild(node);
18
18
  const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1);
19
19
  const createSectionContainer = (type, createElement) => {
@@ -22,7 +22,7 @@ const createSectionContainer = (type, createElement) => {
22
22
  sectionContainer.setAttribute('sec-type', sectionCategory ? chooseSecType(sectionCategory) : '');
23
23
  const title = createElement('title');
24
24
  title.textContent = sectionCategory
25
- ? getCoreSectionTitles(sectionCategory)[0]
25
+ ? getSectionTitles(sectionCategory)[0]
26
26
  : ' ';
27
27
  sectionContainer.appendChild(title);
28
28
  return sectionContainer;
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export const bibliographyItem = {
17
+ content: 'inline{0}',
17
18
  attrs: {
18
19
  id: { default: '' },
19
20
  type: { default: undefined },
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ObjectTypes } from '@manuscripts/json-schema';
17
- import { coreSections } from '../lib/core-sections';
16
+ import sectionCategories from '@manuscripts/data/dist/shared/section-categories.json';
17
+ import { ObjectTypes, } from '@manuscripts/json-schema';
18
18
  import { schema } from '../schema';
19
19
  const sectionNodeTypes = [
20
20
  schema.nodes.bibliography_section,
@@ -23,12 +23,16 @@ const sectionNodeTypes = [
23
23
  schema.nodes.section,
24
24
  schema.nodes.toc_section,
25
25
  ];
26
- export const getCoreSectionTitles = (sectionCategory) => {
27
- const category = coreSections.find((section) => section._id === sectionCategory);
26
+ const sectionCategoriesMap = new Map(sectionCategories.map((section) => [
27
+ section._id,
28
+ section,
29
+ ]));
30
+ export const getSectionTitles = (sectionCategory) => {
31
+ const category = sectionCategoriesMap.get(sectionCategory);
28
32
  if (category) {
29
33
  return category.titles.length ? category.titles : [' '];
30
34
  }
31
- throw new Error(`${sectionCategory} not found in core sections`);
35
+ throw new Error(`${sectionCategory} not found in section categories`);
32
36
  };
33
37
  export const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
34
38
  export const chooseSectionNodeType = (category) => {
@@ -1,4 +1,3 @@
1
- export * from './lib/core-sections';
2
1
  export * from './lib/table-cell-styles';
3
2
  export * from './lib/utils';
4
3
  export * from './mathjax';
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { Element } from '@manuscripts/json-schema';
17
17
  import { ManuscriptNode, ManuscriptNodeType } from '../schema';
18
- export declare const getCoreSectionTitles: (sectionCategory: SectionCategory) => string[];
18
+ export declare const getSectionTitles: (sectionCategory: SectionCategory) => string[];
19
19
  export declare const isAnySectionNode: (node: ManuscriptNode) => boolean;
20
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:body' | 'MPSectionCategory:abstracts' | 'MPSectionCategory:backmatter';
21
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' | 'abstracts' | 'body' | 'backmatter';
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": "1.3.6-LEAN-2650",
4
+ "version": "1.3.6-LEAN-2647",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -43,6 +43,7 @@
43
43
  "@babel/preset-env": "^7.20.2",
44
44
  "@babel/preset-typescript": "^7.18.6",
45
45
  "@jats4r/dtds": "^0.0.8",
46
+ "@manuscripts/data": "^1.0.2",
46
47
  "@manuscripts/eslint-config": "^0.5.1",
47
48
  "@manuscripts/examples": "^0.1.0",
48
49
  "@types/debug": "^4.1.7",
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.coreSections = void 0;
4
- exports.coreSections = [
5
- {
6
- _id: 'MPSectionCategory:abstracts',
7
- name: 'Abstracts',
8
- desc: 'Abstracts section for grouping',
9
- objectType: 'MPSectionCategory',
10
- titles: [],
11
- priority: 120,
12
- },
13
- {
14
- _id: 'MPSectionCategory:backmatter',
15
- name: 'Backmatter',
16
- desc: 'Backmatter section for grouping',
17
- objectType: 'MPSectionCategory',
18
- titles: [],
19
- priority: 170,
20
- },
21
- {
22
- _id: 'MPSectionCategory:body',
23
- name: 'Body',
24
- desc: 'Body section for grouping',
25
- objectType: 'MPSectionCategory',
26
- titles: [],
27
- priority: 190,
28
- },
29
- ];
@@ -1,26 +0,0 @@
1
- export const coreSections = [
2
- {
3
- _id: 'MPSectionCategory:abstracts',
4
- name: 'Abstracts',
5
- desc: 'Abstracts section for grouping',
6
- objectType: 'MPSectionCategory',
7
- titles: [],
8
- priority: 120,
9
- },
10
- {
11
- _id: 'MPSectionCategory:backmatter',
12
- name: 'Backmatter',
13
- desc: 'Backmatter section for grouping',
14
- objectType: 'MPSectionCategory',
15
- titles: [],
16
- priority: 170,
17
- },
18
- {
19
- _id: 'MPSectionCategory:body',
20
- name: 'Body',
21
- desc: 'Body section for grouping',
22
- objectType: 'MPSectionCategory',
23
- titles: [],
24
- priority: 190,
25
- },
26
- ];
@@ -1,8 +0,0 @@
1
- export declare const coreSections: {
2
- _id: string;
3
- name: string;
4
- desc: string;
5
- objectType: string;
6
- titles: never[];
7
- priority: number;
8
- }[];