@manuscripts/transform 1.4.6 → 1.5.0-LEAN-2852-9

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.
Files changed (63) hide show
  1. package/dist/cjs/jats/importer/jats-body-dom-parser.js +126 -0
  2. package/dist/cjs/jats/importer/jats-body-transformations.js +59 -0
  3. package/dist/cjs/jats/importer/jats-front-parser.js +7 -7
  4. package/dist/cjs/jats/importer/jats-parser-utils.js +4 -0
  5. package/dist/cjs/jats/importer/parse-jats-article.js +18 -7
  6. package/dist/cjs/jats/jats-exporter.js +10 -8
  7. package/dist/cjs/lib/core-section-categories.js +2 -2
  8. package/dist/cjs/schema/index.js +9 -6
  9. package/dist/cjs/schema/nodes/affiliation.js +3 -0
  10. package/dist/cjs/schema/nodes/affiliations_section.js +15 -0
  11. package/dist/cjs/schema/nodes/contributor.js +8 -1
  12. package/dist/cjs/schema/nodes/contributors_section.js +15 -0
  13. package/dist/cjs/schema/nodes/meta_section.js +1 -1
  14. package/dist/cjs/schema/nodes/titles.js +32 -0
  15. package/dist/cjs/transformer/builders.js +1 -2
  16. package/dist/cjs/transformer/decode.js +74 -23
  17. package/dist/cjs/transformer/encode.js +26 -0
  18. package/dist/cjs/transformer/html.js +6 -5
  19. package/dist/cjs/transformer/node-types.js +3 -0
  20. package/dist/cjs/transformer/project-bundle.js +22 -1
  21. package/dist/cjs/transformer/section-category.js +12 -0
  22. package/dist/es/jats/importer/jats-body-dom-parser.js +126 -0
  23. package/dist/es/jats/importer/jats-body-transformations.js +59 -0
  24. package/dist/es/jats/importer/jats-front-parser.js +1 -1
  25. package/dist/es/jats/importer/jats-parser-utils.js +4 -0
  26. package/dist/es/jats/importer/parse-jats-article.js +18 -7
  27. package/dist/es/jats/jats-exporter.js +11 -9
  28. package/dist/es/lib/core-section-categories.js +2 -2
  29. package/dist/es/schema/index.js +9 -6
  30. package/dist/es/schema/nodes/affiliation.js +3 -0
  31. package/dist/es/schema/nodes/affiliations_section.js +11 -0
  32. package/dist/es/schema/nodes/contributor.js +6 -0
  33. package/dist/es/schema/nodes/contributors_section.js +11 -0
  34. package/dist/es/schema/nodes/meta_section.js +1 -1
  35. package/dist/es/schema/nodes/titles.js +29 -0
  36. package/dist/es/transformer/builders.js +1 -2
  37. package/dist/es/transformer/decode.js +74 -23
  38. package/dist/es/transformer/encode.js +26 -0
  39. package/dist/es/transformer/html.js +7 -6
  40. package/dist/es/transformer/node-types.js +3 -0
  41. package/dist/es/transformer/project-bundle.js +20 -0
  42. package/dist/es/transformer/section-category.js +12 -0
  43. package/dist/types/jats/importer/jats-body-transformations.d.ts +4 -1
  44. package/dist/types/jats/importer/jats-front-parser.d.ts +5 -5
  45. package/dist/types/jats/importer/parse-jats-article.d.ts +5 -2
  46. package/dist/types/schema/index.d.ts +3 -2
  47. package/dist/types/schema/nodes/affiliation.d.ts +1 -0
  48. package/dist/types/schema/nodes/affiliations_section.d.ts +11 -0
  49. package/dist/types/schema/nodes/contributor.d.ts +2 -0
  50. package/dist/types/schema/nodes/contributors_section.d.ts +11 -0
  51. package/dist/types/schema/nodes/titles.d.ts +28 -0
  52. package/dist/types/schema/types.d.ts +1 -1
  53. package/dist/types/transformer/builders.d.ts +1 -1
  54. package/dist/types/transformer/decode.d.ts +4 -2
  55. package/dist/types/transformer/project-bundle.d.ts +2 -1
  56. package/dist/types/transformer/section-category.d.ts +2 -2
  57. package/package.json +3 -3
  58. package/dist/cjs/schema/nodes/affiliation_list.js +0 -10
  59. package/dist/cjs/schema/nodes/contributor_list.js +0 -10
  60. package/dist/es/schema/nodes/affiliation_list.js +0 -7
  61. package/dist/es/schema/nodes/contributor_list.js +0 -7
  62. package/dist/types/schema/nodes/affiliation_list.d.ts +0 -10
  63. package/dist/types/schema/nodes/contributor_list.d.ts +0 -10
@@ -14,6 +14,7 @@ interface Attrs {
14
14
  postCode: string;
15
15
  country: string;
16
16
  email: Email;
17
+ priority: number;
17
18
  }
18
19
  export interface AffiliationNode extends ManuscriptNode {
19
20
  attrs: Attrs;
@@ -0,0 +1,11 @@
1
+ import { NodeSpec } from 'prosemirror-model';
2
+ import { ManuscriptNode } from '../types';
3
+ interface Attrs {
4
+ id: string;
5
+ }
6
+ export interface AffiliationsSectionNode extends ManuscriptNode {
7
+ attrs: Attrs;
8
+ }
9
+ export declare const affiliationsSection: NodeSpec;
10
+ export declare const isAffiliationsSectionNode: (node: ManuscriptNode) => node is AffiliationsSectionNode;
11
+ export {};
@@ -10,9 +10,11 @@ interface Attrs {
10
10
  invitationID: string;
11
11
  isCorresponding: boolean;
12
12
  ORCIDIdentifier: string;
13
+ priority: number;
13
14
  }
14
15
  export interface ContributorNode extends ManuscriptNode {
15
16
  attrs: Attrs;
16
17
  }
17
18
  export declare const contributor: NodeSpec;
19
+ export declare const isContributorNode: (node: ManuscriptNode) => node is ContributorNode;
18
20
  export {};
@@ -0,0 +1,11 @@
1
+ import { NodeSpec } from 'prosemirror-model';
2
+ import { ManuscriptNode } from '../types';
3
+ interface Attrs {
4
+ id: string;
5
+ }
6
+ export interface ContributorsSectionNode extends ManuscriptNode {
7
+ attrs: Attrs;
8
+ }
9
+ export declare const contributorsSection: NodeSpec;
10
+ export declare const isContributorsSectionNode: (node: ManuscriptNode) => node is ContributorsSectionNode;
11
+ export {};
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { NodeSpec } from 'prosemirror-model';
17
+ import { ManuscriptNode } from '../types';
18
+ interface Attrs {
19
+ id: string;
20
+ title: string;
21
+ subtitle: string;
22
+ runningTitle: string;
23
+ }
24
+ export interface TitlesNode extends ManuscriptNode {
25
+ attrs: Attrs;
26
+ }
27
+ export declare const Titles: NodeSpec;
28
+ export {};
@@ -17,7 +17,7 @@ import { Fragment, Mark as ProsemirrorMark, MarkType, Node as ProsemirrorNode, N
17
17
  import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
18
18
  import { EditorView, NodeView } from 'prosemirror-view';
19
19
  export type Marks = 'bold' | 'code' | 'italic' | 'smallcaps' | 'strikethrough' | 'styled' | 'subscript' | 'superscript' | 'underline' | 'tracked_insert' | 'tracked_delete';
20
- export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keywords_group' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'meta_section' | 'affiliation_list' | 'contributor_list' | 'contributor' | 'table_element_footer';
20
+ export type Nodes = 'attribution' | 'bibliography_item' | 'bibliography_element' | 'bibliography_section' | 'blockquote_element' | 'bullet_list' | 'caption' | 'caption_title' | 'comment' | 'comment_list' | 'citation' | 'cross_reference' | 'doc' | 'equation' | 'equation_element' | 'figcaption' | 'figure' | 'graphical_abstract_section' | 'figure_element' | 'footnote' | 'footnotes_element' | 'footnotes_section' | 'hard_break' | 'highlight_marker' | 'inline_equation' | 'inline_footnote' | 'keyword' | 'keywords_element' | 'keywords_group' | 'keywords_section' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'missing_figure' | 'ordered_list' | 'paragraph' | 'placeholder' | 'placeholder_element' | 'pullquote_element' | 'section' | 'section_label' | 'section_title' | 'section_title_plain' | 'table' | 'table_body' | 'table_cell' | 'table_element' | 'table_row' | 'table_colgroup' | 'table_col' | 'text' | 'toc_element' | 'toc_section' | 'affiliation' | 'meta_section' | 'contributor' | 'table_element_footer' | 'titles' | 'affiliations_section' | 'contributors_section';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -28,7 +28,7 @@ export type BuildEmbedded<T extends EmbeddedModel, O> = Pick<T, Exclude<keyof T,
28
28
  objectType: O;
29
29
  };
30
30
  export declare const buildProject: (owner: string) => Build<Project>;
31
- export declare const buildManuscript: (title?: string) => Build<Manuscript>;
31
+ export declare const buildManuscript: () => Build<Manuscript>;
32
32
  export type ContributorRoleType = 'author';
33
33
  export declare const buildContributor: (bibliographicName: BibliographicName, role?: ContributorRoleType, priority?: number, userID?: string, invitationID?: string) => Build<Contributor>;
34
34
  export declare const buildBibliographyItem: (data: Partial<Build<BibliographyItem>>) => Build<BibliographyItem>;
@@ -25,10 +25,12 @@ export declare class Decoder {
25
25
  private readonly allowMissingElements;
26
26
  private comments;
27
27
  private creators;
28
- private createAffiliationListNode;
29
- private createContributorListNode;
30
28
  private createMetaSectionNode;
31
29
  private createCommentListNode;
30
+ private handleMissingRootSectionNodes;
31
+ private createAffiliationSectionNode;
32
+ private createContributorSectionNode;
33
+ private createTitlesNode;
32
34
  private createRootSectionNodes;
33
35
  private createCommentsNode;
34
36
  private getComments;
@@ -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 { Journal, Manuscript, Model, ObjectTypes } from '@manuscripts/json-schema';
16
+ import { Journal, Manuscript, Model, ObjectTypes, Titles } from '@manuscripts/json-schema';
17
17
  import { ManuscriptModel } from './models';
18
18
  export interface ProjectBundle {
19
19
  version: string;
@@ -27,3 +27,4 @@ export declare const findManuscript: (modelMap: Map<string, Model>) => Manuscrip
27
27
  export declare const findJournal: (modelMap: Map<string, Model>) => Journal | null;
28
28
  export declare const findManuscriptModelByType: <T extends ManuscriptModel>(modelMap: Map<string, Model>, manuscript: Manuscript, objectType: ObjectTypes) => T | undefined;
29
29
  export declare const findManuscriptById: (modelMap: Map<string, Model>, manuscriptID: string) => Manuscript;
30
+ export declare const findTitles: (modelMap: Map<string, Model>) => Titles;
@@ -17,8 +17,8 @@ import { Element } from '@manuscripts/json-schema';
17
17
  import { ManuscriptNode, ManuscriptNodeType } from '../schema';
18
18
  export declare const getCoreSectionTitles: (sectionCategory: SectionCategory) => string[];
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:body' | 'MPSectionCategory:abstracts' | 'MPSectionCategory:backmatter';
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';
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' | 'MPSectionCategory:affiliations' | 'MPSectionCategory:contributors';
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' | 'affiliations' | 'contributors';
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;
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.4.6",
4
+ "version": "1.5.0-LEAN-2852-9",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -29,7 +29,7 @@
29
29
  "version": "yarn build"
30
30
  },
31
31
  "dependencies": {
32
- "@manuscripts/json-schema": "^2.2.0",
32
+ "@manuscripts/json-schema": "2.2.0-LEAN-2852-5",
33
33
  "debug": "^4.3.4",
34
34
  "jszip": "^3.10.1",
35
35
  "mathjax-full": "^3.2.2",
@@ -82,4 +82,4 @@
82
82
  "prosemirror-state": "^1.4.2",
83
83
  "prosemirror-view": "^1.29.1"
84
84
  }
85
- }
85
+ }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.affiliationList = void 0;
4
- exports.affiliationList = {
5
- content: 'affiliation*',
6
- attrs: {
7
- id: { default: 'AFFILIATION_LIST' },
8
- },
9
- toDOM: () => ['section', 0],
10
- };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.contributorList = void 0;
4
- exports.contributorList = {
5
- content: 'contributor*',
6
- attrs: {
7
- id: { default: 'CONTRIBUTOR_LIST' },
8
- },
9
- toDOM: () => ['section', 0],
10
- };
@@ -1,7 +0,0 @@
1
- export const affiliationList = {
2
- content: 'affiliation*',
3
- attrs: {
4
- id: { default: 'AFFILIATION_LIST' },
5
- },
6
- toDOM: () => ['section', 0],
7
- };
@@ -1,7 +0,0 @@
1
- export const contributorList = {
2
- content: 'contributor*',
3
- attrs: {
4
- id: { default: 'CONTRIBUTOR_LIST' },
5
- },
6
- toDOM: () => ['section', 0],
7
- };
@@ -1,10 +0,0 @@
1
- import { NodeSpec } from 'prosemirror-model';
2
- import { ManuscriptNode } from '../types';
3
- interface Attrs {
4
- id: string;
5
- }
6
- export interface AffiliationListNode extends ManuscriptNode {
7
- attrs: Attrs;
8
- }
9
- export declare const affiliationList: NodeSpec;
10
- export {};
@@ -1,10 +0,0 @@
1
- import { NodeSpec } from 'prosemirror-model';
2
- import { ManuscriptNode } from '../types';
3
- interface Attrs {
4
- id: string;
5
- }
6
- export interface ContributorListNode extends ManuscriptNode {
7
- attrs: Attrs;
8
- }
9
- export declare const contributorList: NodeSpec;
10
- export {};