@manuscripts/transform 1.5.6 → 1.5.7-LEAN-3030-1

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 (111) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/jats/importer/index.js +1 -3
  3. package/dist/cjs/jats/importer/jats-body-dom-parser.js +23 -227
  4. package/dist/cjs/jats/importer/jats-body-transformations.js +110 -201
  5. package/dist/cjs/jats/importer/jats-comments.js +100 -98
  6. package/dist/cjs/jats/importer/jats-front-parser.js +87 -81
  7. package/dist/cjs/jats/importer/jats-journal-meta-parser.js +51 -39
  8. package/dist/cjs/jats/importer/jats-parser-utils.js +17 -56
  9. package/dist/cjs/jats/importer/jats-reference-parser.js +24 -79
  10. package/dist/cjs/jats/importer/jats-references.js +34 -0
  11. package/dist/cjs/jats/importer/parse-jats-article.js +67 -173
  12. package/dist/cjs/jats/index.js +1 -3
  13. package/dist/cjs/jats/jats-exporter.js +32 -52
  14. package/dist/cjs/lib/section-group-type.js +30 -0
  15. package/dist/cjs/lib/utils.js +10 -1
  16. package/dist/cjs/schema/index.js +15 -11
  17. package/dist/cjs/schema/nodes/{affiliations_section.js → affiliations.js} +9 -8
  18. package/dist/cjs/schema/nodes/citation.js +10 -15
  19. package/dist/cjs/schema/nodes/{contributors_section.js → contributors.js} +8 -7
  20. package/dist/cjs/schema/nodes/core_section.js +27 -0
  21. package/dist/cjs/schema/nodes/cross_reference.js +4 -3
  22. package/dist/cjs/schema/nodes/graphical_abstract_section.js +1 -0
  23. package/dist/cjs/schema/nodes/inline_footnote.js +6 -5
  24. package/dist/cjs/schema/nodes/keyword.js +0 -1
  25. package/dist/cjs/schema/nodes/{keywords_group.js → keyword_group.js} +6 -6
  26. package/dist/cjs/schema/nodes/{keywords_section.js → keywords.js} +7 -7
  27. package/dist/cjs/schema/nodes/keywords_element.js +1 -1
  28. package/dist/cjs/schema/nodes/manuscript.js +1 -1
  29. package/dist/cjs/transformer/builders.js +9 -86
  30. package/dist/cjs/transformer/decode.js +110 -113
  31. package/dist/cjs/transformer/encode.js +46 -29
  32. package/dist/cjs/transformer/highlight-markers.js +4 -4
  33. package/dist/cjs/transformer/html.js +4 -19
  34. package/dist/cjs/transformer/node-names.js +1 -1
  35. package/dist/cjs/transformer/node-title.js +1 -1
  36. package/dist/cjs/transformer/node-types.js +7 -5
  37. package/dist/cjs/transformer/object-types.js +1 -2
  38. package/dist/cjs/transformer/section-category.js +35 -17
  39. package/dist/es/index.js +1 -1
  40. package/dist/es/jats/importer/index.js +1 -1
  41. package/dist/es/jats/importer/jats-body-dom-parser.js +23 -227
  42. package/dist/es/jats/importer/jats-body-transformations.js +111 -202
  43. package/dist/es/jats/importer/jats-comments.js +97 -96
  44. package/dist/es/jats/importer/jats-front-parser.js +88 -82
  45. package/dist/es/jats/importer/jats-journal-meta-parser.js +51 -39
  46. package/dist/es/jats/importer/jats-parser-utils.js +16 -54
  47. package/dist/es/jats/importer/jats-reference-parser.js +27 -82
  48. package/dist/es/jats/importer/jats-references.js +30 -0
  49. package/dist/es/jats/importer/parse-jats-article.js +70 -174
  50. package/dist/es/jats/index.js +1 -1
  51. package/dist/es/jats/jats-exporter.js +32 -52
  52. package/dist/es/lib/section-group-type.js +27 -0
  53. package/dist/es/lib/utils.js +8 -0
  54. package/dist/es/schema/index.js +15 -11
  55. package/dist/es/schema/nodes/{affiliations_section.js → affiliations.js} +7 -6
  56. package/dist/es/schema/nodes/citation.js +10 -15
  57. package/dist/es/schema/nodes/{contributors_section.js → contributors.js} +6 -5
  58. package/dist/es/schema/nodes/core_section.js +24 -0
  59. package/dist/es/schema/nodes/cross_reference.js +4 -3
  60. package/dist/es/schema/nodes/graphical_abstract_section.js +1 -0
  61. package/dist/es/schema/nodes/inline_footnote.js +6 -5
  62. package/dist/es/schema/nodes/keyword.js +0 -1
  63. package/dist/es/schema/nodes/{keywords_group.js → keyword_group.js} +4 -4
  64. package/dist/es/schema/nodes/{keywords_section.js → keywords.js} +5 -5
  65. package/dist/es/schema/nodes/keywords_element.js +1 -1
  66. package/dist/es/schema/nodes/manuscript.js +1 -1
  67. package/dist/es/transformer/builders.js +6 -73
  68. package/dist/es/transformer/decode.js +111 -114
  69. package/dist/es/transformer/encode.js +47 -30
  70. package/dist/es/transformer/highlight-markers.js +1 -1
  71. package/dist/es/transformer/html.js +4 -19
  72. package/dist/es/transformer/node-names.js +1 -1
  73. package/dist/es/transformer/node-title.js +1 -1
  74. package/dist/es/transformer/node-types.js +7 -5
  75. package/dist/es/transformer/object-types.js +0 -1
  76. package/dist/es/transformer/section-category.js +33 -15
  77. package/dist/types/index.d.ts +1 -1
  78. package/dist/types/jats/importer/index.d.ts +1 -1
  79. package/dist/types/jats/importer/jats-body-transformations.d.ts +16 -19
  80. package/dist/types/jats/importer/jats-comments.d.ts +13 -9
  81. package/dist/types/jats/importer/jats-front-parser.d.ts +35 -12
  82. package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +4 -4
  83. package/dist/types/jats/importer/jats-parser-utils.d.ts +1 -6
  84. package/dist/types/jats/importer/jats-reference-parser.d.ts +2 -6
  85. package/dist/types/jats/importer/jats-references.d.ts +12 -0
  86. package/dist/types/jats/importer/parse-jats-article.d.ts +5 -17
  87. package/dist/types/jats/index.d.ts +1 -1
  88. package/dist/types/lib/section-group-type.d.ts +31 -0
  89. package/dist/types/lib/utils.d.ts +2 -1
  90. package/dist/types/schema/index.d.ts +3 -3
  91. package/dist/types/schema/nodes/affiliations.d.ts +11 -0
  92. package/dist/types/schema/nodes/citation.d.ts +3 -5
  93. package/dist/types/schema/nodes/contributors.d.ts +12 -0
  94. package/dist/types/schema/nodes/core_section.d.ts +17 -0
  95. package/dist/types/schema/nodes/cross_reference.d.ts +1 -1
  96. package/dist/types/schema/nodes/inline_footnote.d.ts +1 -1
  97. package/dist/types/schema/nodes/keyword.d.ts +0 -1
  98. package/dist/types/schema/nodes/{keywords_group.d.ts → keyword_group.d.ts} +3 -3
  99. package/dist/types/schema/nodes/{keywords_section.d.ts → keywords.d.ts} +3 -3
  100. package/dist/types/schema/types.d.ts +1 -1
  101. package/dist/types/transformer/builders.d.ts +2 -14
  102. package/dist/types/transformer/decode.d.ts +6 -6
  103. package/dist/types/transformer/highlight-markers.d.ts +1 -0
  104. package/dist/types/transformer/object-types.d.ts +1 -2
  105. package/dist/types/transformer/section-category.d.ts +1 -1
  106. package/package.json +1 -1
  107. package/dist/cjs/lib/core-section-categories.js +0 -29
  108. package/dist/es/lib/core-section-categories.js +0 -26
  109. package/dist/types/lib/core-section-categories.d.ts +0 -8
  110. package/dist/types/schema/nodes/affiliations_section.d.ts +0 -11
  111. package/dist/types/schema/nodes/contributors_section.d.ts +0 -12
@@ -48,6 +48,5 @@ export const hasObjectType = (objectType) => (model) => model.objectType === obj
48
48
  export const isFigure = hasObjectType(ObjectTypes.Figure);
49
49
  export const isManuscript = hasObjectType(ObjectTypes.Manuscript);
50
50
  export const isTable = hasObjectType(ObjectTypes.Table);
51
- export const isUserProfile = hasObjectType(ObjectTypes.UserProfile);
52
51
  export const isCommentAnnotation = hasObjectType(ObjectTypes.CommentAnnotation);
53
52
  export const isKeyword = hasObjectType(ObjectTypes.Keyword);
@@ -14,22 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ObjectTypes } from '@manuscripts/json-schema';
17
- import { coreSectionCategories } from '../lib/core-section-categories';
18
17
  import { schema } from '../schema';
19
18
  const sectionNodeTypes = [
20
19
  schema.nodes.bibliography_section,
21
20
  schema.nodes.footnotes_section,
22
- schema.nodes.keywords_section,
21
+ schema.nodes.keywords,
23
22
  schema.nodes.section,
24
23
  schema.nodes.toc_section,
25
24
  ];
26
- export const getCoreSectionTitles = (sectionCategory) => {
27
- const category = coreSectionCategories.find((section) => section._id === sectionCategory);
28
- if (category) {
29
- return category.titles.length ? category.titles : [' '];
30
- }
31
- throw new Error(`${sectionCategory} not found in core sections`);
32
- };
33
25
  export const isAnySectionNode = (node) => sectionNodeTypes.includes(node.type);
34
26
  export const chooseSectionNodeType = (category) => {
35
27
  switch (category) {
@@ -40,11 +32,11 @@ export const chooseSectionNodeType = (category) => {
40
32
  case 'MPSectionCategory:endnotes':
41
33
  return schema.nodes.footnotes_section;
42
34
  case 'MPSectionCategory:keywords':
43
- return schema.nodes.keywords_section;
35
+ return schema.nodes.keywords;
44
36
  case 'MPSectionCategory:affiliations':
45
- return schema.nodes.affiliations_section;
37
+ return schema.nodes.affiliations;
46
38
  case 'MPSectionCategory:contributors':
47
- return schema.nodes.contributors_section;
39
+ return schema.nodes.contributors;
48
40
  case 'MPSectionCategory:toc':
49
41
  return schema.nodes.toc_section;
50
42
  default:
@@ -82,15 +74,15 @@ export const buildSectionCategory = (node) => {
82
74
  return 'MPSectionCategory:bibliography';
83
75
  case schema.nodes.footnotes_section:
84
76
  return 'MPSectionCategory:endnotes';
85
- case schema.nodes.keywords_section:
77
+ case schema.nodes.keywords:
86
78
  return 'MPSectionCategory:keywords';
87
79
  case schema.nodes.toc_section:
88
80
  return 'MPSectionCategory:toc';
89
81
  case schema.nodes.graphical_abstract_section:
90
82
  return 'MPSectionCategory:abstract-graphical';
91
- case schema.nodes.affiliations_section:
83
+ case schema.nodes.affiliations:
92
84
  return 'MPSectionCategory:affiliations';
93
- case schema.nodes.contributors_section:
85
+ case schema.nodes.contributors:
94
86
  return 'MPSectionCategory:contributors';
95
87
  default:
96
88
  return node.attrs.category || undefined;
@@ -117,6 +109,32 @@ export const chooseSecType = (sectionCategory) => {
117
109
  return suffix;
118
110
  }
119
111
  };
112
+ export const chooseCoreSectionBySection = (section) => {
113
+ switch (section) {
114
+ case 'MPSectionCategory:abstract':
115
+ case 'MPSectionCategory:abstract-teaser':
116
+ case 'MPSectionCategory:abstract-graphical':
117
+ return 'MPSectionCategory:abstracts';
118
+ case 'MPSectionCategory:acknowledgement':
119
+ case 'MPSectionCategory:availability':
120
+ case 'MPSectionCategory:conclusions':
121
+ case 'MPSectionCategory:bibliography':
122
+ case 'MPSectionCategory:discussion':
123
+ case 'MPSectionCategory:endnotes':
124
+ case 'MPSectionCategory:appendices':
125
+ case 'MPSectionCategory:competing-interests':
126
+ case 'MPSectionCategory:con':
127
+ case 'MPSectionCategory:deceased':
128
+ case 'MPSectionCategory:ethics-statement':
129
+ case 'MPSectionCategory:financial-disclosure':
130
+ case 'MPSectionCategory:supplementary-material':
131
+ case 'MPSectionCategory:supported-by':
132
+ case 'MPSectionCategory:abbreviations':
133
+ case 'MPSectionCategory:results':
134
+ return 'MPSectionCategory:backmatter';
135
+ }
136
+ return 'MPSectionCategory:body';
137
+ };
120
138
  export const chooseSectionCategoryByType = (secType) => {
121
139
  switch (secType) {
122
140
  case 'abstract':
@@ -1,4 +1,4 @@
1
- export * from './lib/core-section-categories';
1
+ export * from './lib/section-group-type';
2
2
  export * from './lib/table-cell-styles';
3
3
  export * from './lib/utils';
4
4
  export * from './mathjax';
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { parseJATSFront, parseJATSBody, parseJATSReferences, parseJATSArticle, getElementsOrder, } from './parse-jats-article';
16
+ export { parseJATSFront, parseJATSBody, parseJATSArticle, } from './parse-jats-article';
@@ -13,29 +13,26 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Affiliation, BibliographyItem, Contributor } from '@manuscripts/json-schema';
17
- import { Build } from '../../transformer';
18
16
  export declare const jatsBodyTransformations: {
19
17
  ensureSection(body: Element, createElement: (tagName: string) => HTMLElement): void;
20
- createAbstract(abstractNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
21
- createAcknowledgments(ackNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
22
- createBibliography(doc: Document, references: BibliographyItem[], createElement: (tagName: string) => HTMLElement): HTMLElement;
23
- createFootnotes(footnoteGroups: Element[], createElement: (tagName: string) => HTMLElement): HTMLElement;
18
+ createAbstractSection(abstractNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
19
+ createAcknowledgmentsSection(ackNode: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
20
+ createFootnotesSection(footnoteGroups: Element[], createElement: (tagName: string) => HTMLElement): HTMLElement;
24
21
  createAppendixSection(app: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
25
- createFloatsGroupSection(floatsGroup: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
26
- moveAbstractsIntoContainer(doc: Document, abstractsContainer: Element, createElement: (tagName: string) => HTMLElement): void;
27
- wrapBodySections(doc: Document, bodyContainer: Element): void;
28
- moveBackSectionsIntoContainer(doc: Document, backmatterContainer: Element): void;
29
- moveAcknowledgmentsIntoContainer(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
30
- moveAppendicesIntoContainer(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
31
- moveBibliographyIntoContainer(doc: Document, backmatterContainer: Element, references: BibliographyItem[] | null, createElement: (tagName: string) => HTMLElement): void;
32
- moveSectionsToBody(doc: Document, body: Element, references: BibliographyItem[] | null, createElement: (tagName: string) => HTMLElement): void;
33
- mapFootnotesToSections(doc: Document, backmatterContainer: Element, createElement: (tagName: string) => HTMLElement): void;
22
+ createFloatsGroupSection(group: Element, createElement: (tagName: string) => HTMLElement): HTMLElement;
23
+ moveAbstracts(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
24
+ wrapBodySections(doc: Document, group: Element): void;
25
+ moveBackSections(doc: Document, group: Element): void;
26
+ moveAcknowledgments(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
27
+ moveAppendices(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
28
+ createBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
29
+ createAbstracts(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
30
+ createBackmatter(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
31
+ moveSpecialFootnotes(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
32
+ moveFootnotes(doc: Document, group: Element, createElement: (tagName: string) => HTMLElement): void;
34
33
  moveCaptionsToEnd(body: Element): void;
34
+ fixTables(body: Element, createElement: (tagName: string) => HTMLElement): void;
35
35
  moveTableFooterToEnd(body: Element): void;
36
- moveAffiliationsToBody(doc: Document, affiliations: Build<Affiliation>[] | undefined, body: Element, createElement: (tagName: string) => HTMLElement): void;
37
- moveAuthorsToBody(doc: Document, authors: Build<Contributor>[] | undefined, body: Element, createElement: (tagName: string) => HTMLElement): void;
38
36
  moveFloatsGroupToBody(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
39
- moveBlockNodesFromParagraph(doc: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
40
- moveKeywordsToBody(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
37
+ createKeywords(document: Document, body: Element, createElement: (tagName: string) => HTMLElement): void;
41
38
  };
@@ -13,14 +13,18 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { BibliographyItem, CommentAnnotation, Model } from '@manuscripts/json-schema';
17
- import { Build } from '../../transformer';
18
- type ProcessingInstruction = {
16
+ import { CommentAnnotation, Model } from '@manuscripts/json-schema';
17
+ import { References } from './jats-references';
18
+ export type JATSComment = {
19
19
  id: string;
20
- queryText: string;
20
+ text: string;
21
21
  };
22
- export declare const parseProcessingInstruction: (node: Node) => ProcessingInstruction | undefined;
23
- export declare const markProcessingInstructions: (doc: Document) => Map<string, string>;
24
- export declare const createComments: (authorQueriesMap: Map<string, string>, manuscriptModels: Array<Model>) => Build<CommentAnnotation>[];
25
- export declare const createReferenceComments: (referenceQueriesMap: Map<string, string[]>, references: Array<BibliographyItem>) => Build<CommentAnnotation>[];
26
- export {};
22
+ export type JATSCommentMark = {
23
+ token: string;
24
+ comment: JATSComment;
25
+ };
26
+ export declare const isJATSComment: (node: Node) => boolean;
27
+ export declare const parseJATSComment: (node: Node) => JATSComment | undefined;
28
+ export declare const markComments: (doc: Document) => JATSCommentMark[];
29
+ export declare const createComments: (models: Model[], marks: JATSCommentMark[]) => CommentAnnotation[];
30
+ export declare const createReferenceComments: (references: References) => CommentAnnotation[];
@@ -13,20 +13,43 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Journal } from '@manuscripts/json-schema';
17
16
  export declare const jatsFrontParser: {
18
- parseCounts(counts: Element | null | undefined): {
17
+ parseTitles(element: Element | null, createElement: (tagName: string) => HTMLElement): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Titles>;
18
+ parseCounts(counts: Element | null): {
19
19
  wordCount: number | undefined;
20
20
  figureCount: number | undefined;
21
21
  tableCount: number | undefined;
22
22
  equationCount: number | undefined;
23
23
  referencesCount: number | undefined;
24
24
  genericCounts: {
25
- count: number;
25
+ count: number | undefined;
26
26
  countType: string;
27
27
  }[] | undefined;
28
28
  } | undefined;
29
- parseJournal(journalMeta: Element | null): Partial<Journal>;
29
+ parseJournal(element: Element | null): {
30
+ title: string | undefined;
31
+ templateID?: string | undefined;
32
+ ISSNs: {
33
+ [k: string]: any;
34
+ ISSN: string;
35
+ publicationType?: string | undefined;
36
+ }[];
37
+ abbreviatedTitles: {
38
+ [k: string]: any;
39
+ abbreviatedTitle: string;
40
+ abbrevType?: string | undefined;
41
+ }[];
42
+ journalIdentifiers: {
43
+ [k: string]: any;
44
+ journalID: string;
45
+ journalIDType?: string | undefined;
46
+ }[];
47
+ submittable?: boolean | undefined;
48
+ publisherName: string | undefined;
49
+ _id: string;
50
+ objectType: string;
51
+ contributions?: import("@manuscripts/json-schema/dist/types").Contribution[] | undefined;
52
+ };
30
53
  parseDates(historyNode: Element | null): {
31
54
  acceptanceDate?: number | undefined;
32
55
  correctionDate?: number | undefined;
@@ -35,18 +58,18 @@ export declare const jatsFrontParser: {
35
58
  revisionReceiveDate?: number | undefined;
36
59
  receiveDate?: number | undefined;
37
60
  } | undefined;
38
- parseSupplements(supplementNodes: Element[] | null): import("../../transformer").Build<import("@manuscripts/json-schema").Supplement>[];
39
- parseAffiliationNodes(affiliationNodes: Element[]): {
40
- affiliations: import("../../transformer").Build<import("@manuscripts/json-schema").Affiliation>[];
61
+ parseSupplements(elements: Element[] | null): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Supplement>[];
62
+ parseAffiliations(elements: Element[]): {
63
+ affiliations: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Affiliation>[];
41
64
  affiliationIDs: Map<string, string>;
42
65
  };
43
- parseFootnoteNodes(footnoteNodes: Element[]): {
44
- footnotes: import("../../transformer").Build<import("@manuscripts/json-schema").Footnote>[];
66
+ parseAuthorNotes(elements: Element[]): {
67
+ footnotes: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Footnote>[];
45
68
  footnoteIDs: Map<string, string>;
46
69
  };
47
- parseCorrespNodes(correspNodes: Element[]): {
48
- correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema").Corresponding>[];
70
+ parseCorresp(elements: Element[]): {
71
+ correspondingList: import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Corresponding>[];
49
72
  correspondingIDs: Map<string, string>;
50
73
  };
51
- parseAuthorNodes(authorNodes: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): import("../../transformer").Build<import("@manuscripts/json-schema").Contributor>[];
74
+ parseContributors(elements: Element[], affiliationIDs: Map<string, string>, footnoteIDs: Map<string, string>, correspondingIDs: Map<string, string>): import("../../transformer").Build<import("@manuscripts/json-schema/dist/types").Contributor>[];
52
75
  };
@@ -25,10 +25,10 @@ export type JournalIdentifier = {
25
25
  journalID: string;
26
26
  journalIDType?: string;
27
27
  };
28
- export declare const parseJournalIdentifiers: (journalMeta: Element) => Array<JournalIdentifier>;
29
- export declare const parseJournalAbbreviatedTitles: (journalMeta: Element) => Array<AbbreviatedTitle>;
30
- export declare const parseJournalISSNs: (journalMeta: Element) => Array<ISSN>;
31
- export declare const parseJournalMeta: (journalMeta: Element) => {
28
+ export declare const parseJournalIdentifiers: (element: Element | null) => JournalIdentifier[];
29
+ export declare const parseJournalAbbreviatedTitles: (element: Element | null) => AbbreviatedTitle[];
30
+ export declare const parseJournalISSNs: (element: Element | null) => ISSN[];
31
+ export declare const parseJournalMeta: (element: Element | null) => {
32
32
  abbreviatedTitles: AbbreviatedTitle[];
33
33
  journalIdentifiers: JournalIdentifier[];
34
34
  ISSNs: ISSN[];
@@ -13,11 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Model } from '@manuscripts/json-schema';
17
16
  import { ManuscriptNode } from '../../schema';
18
- export declare function flatten<T>(arrays: T[][]): T[];
19
- export declare const fixBodyPMNode: (output: ManuscriptNode, models: Model[], referenceIdsMap?: Map<string, string>) => {
20
- warnings: string[];
21
- replacements: Map<string, string>;
22
- };
17
+ export declare const updateDocumentIDs: (node: ManuscriptNode, replacements: Map<string, string>) => string[];
23
18
  export declare const htmlFromJatsNode: (element: Element | undefined | null, createElement: (tagName: string) => HTMLElement) => string | undefined;
@@ -13,11 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { References } from './jats-references';
16
17
  export declare const jatsReferenceParser: {
17
- parseReferences(referenceNodes: Element[], createElement: (tagName: string) => HTMLElement): {
18
- references: import("../../transformer/builders").Build<import("@manuscripts/json-schema").BibliographyItem>[];
19
- referenceIDs: Map<string, string>;
20
- referenceQueries: Map<string, string[]>;
21
- };
22
- parseCrossReferences(crossReferenceNodes: Element[], referenceIDs: Map<string, string>): (import("../../transformer/builders").Build<import("@manuscripts/json-schema").AuxiliaryObjectReference> | import("../../transformer/builders").Build<import("@manuscripts/json-schema").Citation>)[];
18
+ parseReferences(elements: Element[], createElement: (tagName: string) => HTMLElement): References;
23
19
  };
@@ -0,0 +1,12 @@
1
+ import { BibliographyItem } from '@manuscripts/json-schema';
2
+ import { JATSComment } from './jats-comments';
3
+ export declare class References {
4
+ items: Map<string, BibliographyItem>;
5
+ IDs: Map<string, string>;
6
+ comments: Map<string, JATSComment[]>;
7
+ constructor();
8
+ add(item: BibliographyItem, id: string | null, comments: JATSComment[]): void;
9
+ getBibliographyItems(): BibliographyItem[];
10
+ getComments(id: string): JATSComment[];
11
+ private getValue;
12
+ }
@@ -13,20 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Affiliation, BibliographyItem, Contributor, ElementsOrder, FootnotesOrder, Model } from '@manuscripts/json-schema';
17
- import { ManuscriptNode } from '../../schema';
18
- import { Build } from '../../transformer/builders';
19
- export declare const parseJATSFront: (front: Element) => Promise<{
20
- models: Model[];
21
- authors: Build<Contributor>[];
22
- affiliations: Build<Affiliation>[];
23
- }>;
24
- export declare const parseJATSReferences: (back: Element | null, body: Element | null, createElement: (tagName: string) => HTMLElement) => {
25
- references: Model[];
26
- crossReferences: Model[];
27
- referenceQueriesMap: Map<string, string[]> | undefined;
28
- referenceIdsMap: Map<string, string> | undefined;
29
- };
30
- export declare const parseJATSBody: (document: Document, body: Element, bibliographyItems: BibliographyItem[] | null, authors: Build<Contributor>[], affiliations: Build<Affiliation>[], refModels: Model[], referenceIdsMap: Map<string, string> | undefined, footnotesOrder?: FootnotesOrder) => ManuscriptNode;
31
- export declare const parseJATSArticle: (doc: Document) => Promise<Model[]>;
32
- export declare const getElementsOrder: (node: ManuscriptNode) => ElementsOrder[];
16
+ import { Model } from '@manuscripts/json-schema';
17
+ import { References } from './jats-references';
18
+ export declare const parseJATSFront: (doc: Document, front: Element) => Model[];
19
+ export declare const parseJATSBody: (doc: Document, body: Element, references?: References) => IterableIterator<Model>;
20
+ export declare const parseJATSArticle: (doc: Document) => Model[];
@@ -13,6 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { parseJATSFront, parseJATSReferences, parseJATSBody, parseJATSArticle, getElementsOrder, } from './importer';
16
+ export { parseJATSFront, parseJATSBody, parseJATSArticle, } from './importer';
17
17
  export * from './jats-exporter';
18
18
  export * from './jats-versions';
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * © 2023 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
+ export type SectionGroupType = {
17
+ _id: string;
18
+ title: string;
19
+ };
20
+ export declare const abstractsType: {
21
+ _id: string;
22
+ title: string;
23
+ };
24
+ export declare const bodyType: {
25
+ _id: string;
26
+ title: string;
27
+ };
28
+ export declare const backmatterType: {
29
+ _id: string;
30
+ title: string;
31
+ };
@@ -26,4 +26,5 @@ export declare const findParentNodeClosestToPos: ($pos: ResolvedPos, predicate:
26
26
  depth: number;
27
27
  node: ProsemirrorNode;
28
28
  } | undefined;
29
- export declare const getTrimmedTextContent: (node: Element | Document, querySelector: string) => string | null | undefined;
29
+ export declare const getTrimmedTextContent: (node: Element | Document | null, querySelector: string) => string | null | undefined;
30
+ export declare const groupBy: <T, K extends string | number | symbol>(list: T[], getKey: (item: T) => K) => Record<K, T[]>;
@@ -44,7 +44,7 @@ export * from './nodes/inline_equation';
44
44
  export * from './nodes/inline_footnote';
45
45
  export * from './nodes/keyword';
46
46
  export * from './nodes/keywords_element';
47
- export * from './nodes/keywords_section';
47
+ export * from './nodes/keywords';
48
48
  export * from './nodes/link';
49
49
  export * from './nodes/list';
50
50
  export * from './nodes/listing';
@@ -69,6 +69,6 @@ export * from './nodes/meta_section';
69
69
  export * from './nodes/contributor';
70
70
  export * from './nodes/table_element_footer';
71
71
  export * from './nodes/title';
72
- export * from './nodes/affiliations_section';
73
- export * from './nodes/contributors_section';
72
+ export * from './nodes/affiliations';
73
+ export * from './nodes/contributors';
74
74
  export declare const schema: Schema<Nodes, Marks>;
@@ -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 AffiliationsNode extends ManuscriptNode {
7
+ attrs: Attrs;
8
+ }
9
+ export declare const affiliations: NodeSpec;
10
+ export declare const isAffiliationsNode: (node: ManuscriptNode) => node is AffiliationsNode;
11
+ export {};
@@ -16,12 +16,10 @@
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
18
  interface Attrs {
19
- rid: string;
19
+ id: string;
20
+ rids: string[];
20
21
  contents: string;
21
- embeddedCitationItems: {
22
- id: string;
23
- bibliographyItem: string;
24
- }[];
22
+ selectedText: string;
25
23
  }
26
24
  export interface CitationNode extends ManuscriptNode {
27
25
  attrs: Attrs;
@@ -0,0 +1,12 @@
1
+ import { NodeSpec } from 'prosemirror-model';
2
+ import { ManuscriptNode } from '../types';
3
+ interface Attrs {
4
+ id: string;
5
+ contents: string;
6
+ }
7
+ export interface ContributorsNode extends ManuscriptNode {
8
+ attrs: Attrs;
9
+ }
10
+ export declare const contributors: NodeSpec;
11
+ export declare const isContributorsNode: (node: ManuscriptNode) => node is ContributorsNode;
12
+ export {};
@@ -0,0 +1,17 @@
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
+ export declare const coreSection: NodeSpec;
@@ -16,7 +16,7 @@
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
18
  interface Attrs {
19
- rid: string;
19
+ rids: string[];
20
20
  label: string;
21
21
  customLabel: string;
22
22
  }
@@ -16,7 +16,7 @@
16
16
  import { NodeSpec } from 'prosemirror-model';
17
17
  import { ManuscriptNode } from '../types';
18
18
  interface Attrs {
19
- rid: string;
19
+ rids: string[];
20
20
  contents: string;
21
21
  }
22
22
  export interface InlineFootnoteNode extends ManuscriptNode {
@@ -18,7 +18,6 @@ import { ManuscriptNode } from '../types';
18
18
  import { CommentNode } from './comment';
19
19
  interface Attrs {
20
20
  id: string;
21
- contents: string;
22
21
  comments?: CommentNode[];
23
22
  }
24
23
  export interface KeywordNode extends ManuscriptNode {
@@ -18,9 +18,9 @@ import { ManuscriptNode } from '../types';
18
18
  interface Attrs {
19
19
  id: string;
20
20
  }
21
- export interface KeywordsGroupNode extends ManuscriptNode {
21
+ export interface KeywordGroupNode extends ManuscriptNode {
22
22
  attrs: Attrs;
23
23
  }
24
- export declare const keywordsGroup: NodeSpec;
25
- export declare const isKeywordsGroupNode: (node: ManuscriptNode) => node is KeywordsGroupNode;
24
+ export declare const keywordGroup: NodeSpec;
25
+ export declare const isKeywordGroupNode: (node: ManuscriptNode) => node is KeywordGroupNode;
26
26
  export {};
@@ -18,9 +18,9 @@ import { ManuscriptNode } from '../types';
18
18
  interface Attrs {
19
19
  id: string;
20
20
  }
21
- export interface KeywordsSectionNode extends ManuscriptNode {
21
+ export interface KeywordsNode extends ManuscriptNode {
22
22
  attrs: Attrs;
23
23
  }
24
- export declare const keywordsSection: NodeSpec;
25
- export declare const isKeywordsSectionNode: (node: ManuscriptNode) => node is KeywordsSectionNode;
24
+ export declare const keywords: NodeSpec;
25
+ export declare const isKeywordsNode: (node: ManuscriptNode) => node is KeywordsNode;
26
26
  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' | 'contributor' | 'table_element_footer' | 'title' | 'affiliations_section' | 'contributors_section';
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' | 'keyword_group' | 'keywords' | 'link' | 'list_item' | 'listing' | 'listing_element' | 'manuscript' | 'abstracts' | 'body' | 'backmatter' | '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' | 'title' | 'affiliations' | 'contributors';
21
21
  export type ManuscriptSchema = Schema<Nodes, Marks>;
22
22
  export type ManuscriptEditorState = EditorState;
23
23
  export type ManuscriptEditorView = EditorView;
@@ -13,11 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Affiliation, Attribution, AuxiliaryObjectReference, BibliographicDate, BibliographicName, BibliographyItem, Citation, CitationItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, Highlight, HighlightMarker, InlineMathFragment, InlineStyle, Journal, Keyword, KeywordGroup, LibraryCollection, Manuscript, ManuscriptKeyword, ManuscriptNote, ObjectTypes, ParagraphElement, Project, RequirementsValidation, RequirementsValidationData, Section, StatusLabel, Supplement, Titles, UserProfileAffiliation } from '@manuscripts/json-schema';
16
+ import { Affiliation, Attribution, BibliographicDate, BibliographicName, BibliographyElement, BibliographyItem, Color, CommentAnnotation, Contribution, Contributor, ContributorRole, Corresponding, ElementsOrder, EmbeddedModel, Figure, Footnote, FootnotesOrder, InlineMathFragment, Journal, Keyword, KeywordGroup, Manuscript, ManuscriptNote, ObjectTypes, ParagraphElement, Project, Section, Supplement, Titles } from '@manuscripts/json-schema';
17
17
  import { FootnotesOrderIndexList } from './footnotes-order';
18
18
  import { CommentSelector, ManuscriptModel, ModelAttachment } from './models';
19
- export declare const DEFAULT_BUNDLE = "MPBundle:www-zotero-org-styles-nature";
20
- export declare const DEFAULT_PAGE_LAYOUT = "MPPageLayout:defaultA4";
21
19
  export type Build<T> = Pick<T, Exclude<keyof T, keyof ManuscriptModel>> & {
22
20
  _id: string;
23
21
  objectType: string;
@@ -34,24 +32,18 @@ export declare const buildContributor: (bibliographicName: BibliographicName, ro
34
32
  export declare const buildBibliographyItem: (data: Partial<Build<BibliographyItem>>) => Build<BibliographyItem>;
35
33
  export declare const buildBibliographicName: (data: Partial<BibliographicName>) => BuildEmbedded<BibliographicName, ObjectTypes.BibliographicName>;
36
34
  export declare const buildBibliographicDate: (data: Partial<BibliographicDate>) => BuildEmbedded<BibliographicDate, ObjectTypes.BibliographicDate>;
37
- export declare const buildAuxiliaryObjectReference: (containingObject: string, rids: string[]) => Build<AuxiliaryObjectReference>;
38
- export declare const buildEmbeddedCitationItem: (bibliographyItem: string) => CitationItem;
39
- export declare const buildCitation: (containingObject: string, embeddedCitationItems: string[]) => Build<Citation>;
35
+ export declare const buildBibliographyElement: (bibliographyItems: BibliographyItem[]) => Build<BibliographyElement>;
40
36
  export declare const buildKeyword: (name: string) => Build<Keyword>;
41
37
  export declare const buildKeywordGroup: (attributes: {
42
38
  type?: string;
43
39
  title?: string;
44
40
  label?: string;
45
41
  }) => Build<KeywordGroup>;
46
- export declare const buildManuscriptKeyword: (name: string) => Build<ManuscriptKeyword>;
47
- export declare const buildLibraryCollection: (owner: string, name: string) => Build<LibraryCollection>;
48
42
  export declare const buildFigure: (blob: Blob) => Build<Figure & ModelAttachment>;
49
43
  export declare const buildAffiliation: (institution: string, priority?: number) => Build<Affiliation>;
50
44
  export declare const buildSupplementaryMaterial: (title: string, href: string) => Build<Supplement>;
51
- export declare const buildUserProfileAffiliation: (institution: string, priority?: number) => Build<UserProfileAffiliation>;
52
45
  export declare const buildComment: (target: string, contents?: string, selector?: CommentSelector, contributions?: Contribution[], annotationColor?: string) => Build<CommentAnnotation>;
53
46
  export declare const buildNote: (target: string, source: 'EMAIL' | 'EDITOR' | 'DASHBOARD', contents?: string) => Build<ManuscriptNote>;
54
- export declare const buildValidation: (results: RequirementsValidationData[]) => Build<RequirementsValidation>;
55
47
  export declare const buildInlineMathFragment: (containingObject: string, TeXRepresentation: string) => Build<InlineMathFragment>;
56
48
  export declare const buildFootnote: (containingObject: string, contents: string, kind?: 'footnote' | 'endnote') => Build<Footnote>;
57
49
  export declare const buildFootnotesOrder: (footnotesList: FootnotesOrderIndexList) => Build<FootnotesOrder>;
@@ -59,14 +51,10 @@ export declare const buildCorresp: (contents: string) => Build<Corresponding>;
59
51
  export declare const buildSection: (priority?: number, path?: string[]) => Build<Section>;
60
52
  export declare const buildParagraph: (placeholderInnerHTML: string) => Build<ParagraphElement>;
61
53
  export declare const buildColor: (value: string, priority: number) => Build<Color>;
62
- export declare const buildHighlight: () => Build<Highlight>;
63
- export declare const buildHighlightMarker: (highlightID: string, start: boolean, offset: number, field: 'caption' | 'contents' | 'title') => Build<HighlightMarker>;
64
54
  export declare const buildContribution: (profileID: string) => Contribution;
65
55
  export declare const buildContributorRole: (name: string) => Build<ContributorRole>;
66
- export declare const buildInlineStyle: (priority: number, title?: string) => Build<InlineStyle>;
67
56
  export declare const buildAttribution: () => Build<Attribution>;
68
57
  export declare const buildJournal: () => Build<Journal>;
69
- export declare const buildStatusLabel: (name: string) => Build<StatusLabel>;
70
58
  export type AuxiliaryObjects = 'MPFigureElement' | 'MPTableElement' | 'MPListingElement' | 'MPEquationElement';
71
59
  export declare const auxiliaryObjectTypes: Set<import("prosemirror-model").NodeType>;
72
60
  export declare const buildElementsOrder: (elementType: AuxiliaryObjects) => Build<ElementsOrder>;