@manuscripts/transform 4.3.53 → 4.4.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 (196) hide show
  1. package/dist/cjs/jats/__tests__/jats-roundtrip.test.js +3 -3
  2. package/dist/cjs/jats/exporter/jats-exporter.js +3 -0
  3. package/dist/cjs/jats/importer/jats-dom-parser.js +41 -1
  4. package/dist/cjs/schema/index.js +9 -0
  5. package/dist/cjs/schema/nodes/headshot_element.js +38 -0
  6. package/dist/cjs/schema/nodes/headshot_grid.js +37 -0
  7. package/dist/cjs/schema/nodes/headshot_image.js +51 -0
  8. package/dist/cjs/transformer/node-names.js +2 -0
  9. package/dist/cjs/transformer/node-title.js +6 -0
  10. package/dist/cjs/version.js +1 -1
  11. package/dist/es/jats/__tests__/jats-roundtrip.test.js +3 -3
  12. package/dist/es/jats/exporter/jats-exporter.js +3 -0
  13. package/dist/es/jats/importer/jats-dom-parser.js +41 -1
  14. package/dist/es/schema/index.js +9 -0
  15. package/dist/es/schema/nodes/headshot_element.js +34 -0
  16. package/dist/es/schema/nodes/headshot_grid.js +33 -0
  17. package/dist/es/schema/nodes/headshot_image.js +48 -0
  18. package/dist/es/transformer/node-names.js +2 -0
  19. package/dist/es/transformer/node-title.js +6 -0
  20. package/dist/es/version.js +1 -1
  21. package/dist/types/jats/__tests__/utils.d.ts +1 -1
  22. package/dist/types/schema/index.d.ts +3 -0
  23. package/dist/types/schema/nodes/headshot_element.d.ts +25 -0
  24. package/dist/types/schema/nodes/headshot_grid.d.ts +24 -0
  25. package/dist/types/schema/nodes/headshot_image.d.ts +26 -0
  26. package/dist/types/schema/types.d.ts +1 -1
  27. package/dist/types/version.d.ts +1 -1
  28. package/package.json +22 -21
  29. package/src/errors.ts +28 -0
  30. package/src/getVersion.ts +21 -0
  31. package/src/index.ts +28 -0
  32. package/src/jats/__tests__/__fixtures__/debug-example.xml +136 -0
  33. package/src/jats/__tests__/__fixtures__/jats-abstract-no-body.xml +163 -0
  34. package/src/jats/__tests__/__fixtures__/jats-citations.xml +472 -0
  35. package/src/jats/__tests__/__fixtures__/jats-comments.xml +46 -0
  36. package/src/jats/__tests__/__fixtures__/jats-document.xml +134 -0
  37. package/src/jats/__tests__/__fixtures__/jats-example-doc.xml +1235 -0
  38. package/src/jats/__tests__/__fixtures__/jats-example-front-only.xml +26 -0
  39. package/src/jats/__tests__/__fixtures__/jats-example-full.xml +209 -0
  40. package/src/jats/__tests__/__fixtures__/jats-example-no-back.xml +156 -0
  41. package/src/jats/__tests__/__fixtures__/jats-example-no-body.xml +91 -0
  42. package/src/jats/__tests__/__fixtures__/jats-example.xml +221 -0
  43. package/src/jats/__tests__/__fixtures__/jats-fn-group.xml +60 -0
  44. package/src/jats/__tests__/__fixtures__/jats-import-no-refs.xml +1077 -0
  45. package/src/jats/__tests__/__fixtures__/jats-import.xml +1578 -0
  46. package/src/jats/__tests__/__fixtures__/jats-roundtrip.xml +133 -0
  47. package/src/jats/__tests__/__fixtures__/jats-tables-example.xml +2043 -0
  48. package/src/jats/__tests__/__fixtures__/math-fragment.xml +12 -0
  49. package/src/jats/__tests__/__snapshots__/citeproc.test.ts.snap +57 -0
  50. package/src/jats/__tests__/__snapshots__/create-article-node.test.ts.snap +65 -0
  51. package/src/jats/__tests__/__snapshots__/jats-exporter.test.ts.snap +7 -0
  52. package/src/jats/__tests__/__snapshots__/jats-importer.test.ts.snap +59796 -0
  53. package/src/jats/__tests__/__snapshots__/jats-roundtrip.test.ts.snap +18 -0
  54. package/src/jats/__tests__/citations.ts +25 -0
  55. package/src/jats/__tests__/citeproc.test.ts +195 -0
  56. package/src/jats/__tests__/create-article-node.test.ts +29 -0
  57. package/src/jats/__tests__/data/section-categories.ts +212 -0
  58. package/src/jats/__tests__/files.ts +24 -0
  59. package/src/jats/__tests__/jats-exporter.test.ts +223 -0
  60. package/src/jats/__tests__/jats-importer.test.ts +567 -0
  61. package/src/jats/__tests__/jats-roundtrip.test.ts +66 -0
  62. package/src/jats/__tests__/utils.ts +90 -0
  63. package/src/jats/exporter/citeproc.ts +265 -0
  64. package/src/jats/exporter/jats-exporter.ts +2093 -0
  65. package/src/jats/exporter/jats-versions.ts +50 -0
  66. package/src/jats/exporter/labels.ts +101 -0
  67. package/src/jats/importer/create-article-node.ts +52 -0
  68. package/src/jats/importer/jats-comments.ts +111 -0
  69. package/src/jats/importer/jats-dom-parser.ts +1306 -0
  70. package/src/jats/importer/jats-parser-utils.ts +234 -0
  71. package/src/jats/importer/jats-transformations.ts +591 -0
  72. package/src/jats/importer/parse-jats-article.ts +106 -0
  73. package/src/jats/index.ts +21 -0
  74. package/src/jats/types.ts +16 -0
  75. package/src/lib/__tests__/footnotes.test.ts +36 -0
  76. package/src/lib/citeproc.ts +30 -0
  77. package/src/lib/credit-roles.ts +91 -0
  78. package/src/lib/deafults.ts +17 -0
  79. package/src/lib/footnotes.ts +85 -0
  80. package/src/lib/html.ts +56 -0
  81. package/src/lib/section-categories.ts +27 -0
  82. package/src/lib/utils.ts +145 -0
  83. package/src/lib/xml.ts +28 -0
  84. package/src/schema/__tests__/docs.ts +1911 -0
  85. package/src/schema/__tests__/groups.test.ts +61 -0
  86. package/src/schema/__tests__/migration.test.ts +23 -0
  87. package/src/schema/groups.ts +36 -0
  88. package/src/schema/index.ts +295 -0
  89. package/src/schema/marks.ts +254 -0
  90. package/src/schema/migration/migrate.ts +77 -0
  91. package/src/schema/migration/migration-script.ts +26 -0
  92. package/src/schema/migration/migration-scripts/1.2.5.ts +44 -0
  93. package/src/schema/migration/migration-scripts/2.3.22.ts +52 -0
  94. package/src/schema/migration/migration-scripts/3.0.12.ts +33 -0
  95. package/src/schema/migration/migration-scripts/3.0.21.ts +50 -0
  96. package/src/schema/migration/migration-scripts/3.0.30.ts +65 -0
  97. package/src/schema/migration/migration-scripts/3.0.31.ts +40 -0
  98. package/src/schema/migration/migration-scripts/3.0.41.ts +37 -0
  99. package/src/schema/migration/migration-scripts/3.0.55.ts +42 -0
  100. package/src/schema/migration/migration-scripts/3.0.56.ts +114 -0
  101. package/src/schema/migration/migration-scripts/4.2.13.ts +37 -0
  102. package/src/schema/migration/migration-scripts/4.2.15.ts +48 -0
  103. package/src/schema/migration/migration-scripts/4.3.23.ts +55 -0
  104. package/src/schema/migration/migration-scripts/4.3.34.ts +132 -0
  105. package/src/schema/migration/migration-scripts/4.3.35.ts +41 -0
  106. package/src/schema/migration/migration-scripts/index.ts +49 -0
  107. package/src/schema/nodes/abstracts.ts +29 -0
  108. package/src/schema/nodes/affiliation.ts +88 -0
  109. package/src/schema/nodes/affiliations.ts +30 -0
  110. package/src/schema/nodes/alt_text.ts +36 -0
  111. package/src/schema/nodes/alt_title.ts +40 -0
  112. package/src/schema/nodes/alt_titles_section.ts +58 -0
  113. package/src/schema/nodes/attachment.ts +46 -0
  114. package/src/schema/nodes/attachments.ts +45 -0
  115. package/src/schema/nodes/attribution.ts +38 -0
  116. package/src/schema/nodes/author_notes.ts +44 -0
  117. package/src/schema/nodes/award.ts +52 -0
  118. package/src/schema/nodes/awards.ts +45 -0
  119. package/src/schema/nodes/backmatter.ts +31 -0
  120. package/src/schema/nodes/bibliography_element.ts +58 -0
  121. package/src/schema/nodes/bibliography_item.ts +108 -0
  122. package/src/schema/nodes/bibliography_section.ts +60 -0
  123. package/src/schema/nodes/blockquote_element.ts +79 -0
  124. package/src/schema/nodes/body.ts +29 -0
  125. package/src/schema/nodes/box_element.ts +67 -0
  126. package/src/schema/nodes/caption.ts +67 -0
  127. package/src/schema/nodes/caption_title.ts +67 -0
  128. package/src/schema/nodes/citation.ts +70 -0
  129. package/src/schema/nodes/comment.ts +50 -0
  130. package/src/schema/nodes/comments.ts +28 -0
  131. package/src/schema/nodes/contributor.ts +87 -0
  132. package/src/schema/nodes/contributors.ts +40 -0
  133. package/src/schema/nodes/core_section.ts +27 -0
  134. package/src/schema/nodes/corresp.ts +49 -0
  135. package/src/schema/nodes/cross_reference.ts +64 -0
  136. package/src/schema/nodes/doc.ts +21 -0
  137. package/src/schema/nodes/embed.ts +55 -0
  138. package/src/schema/nodes/equation.ts +65 -0
  139. package/src/schema/nodes/equation_element.ts +61 -0
  140. package/src/schema/nodes/figure.ts +65 -0
  141. package/src/schema/nodes/figure_element.ts +73 -0
  142. package/src/schema/nodes/footnote.ts +95 -0
  143. package/src/schema/nodes/footnotes_element.ts +69 -0
  144. package/src/schema/nodes/footnotes_section.ts +61 -0
  145. package/src/schema/nodes/general_table_footnote.ts +42 -0
  146. package/src/schema/nodes/graphical_abstract_section.ts +62 -0
  147. package/src/schema/nodes/hard_break.ts +36 -0
  148. package/src/schema/nodes/headshot_element.ts +48 -0
  149. package/src/schema/nodes/headshot_grid.ts +46 -0
  150. package/src/schema/nodes/headshot_image.ts +65 -0
  151. package/src/schema/nodes/hero_image.ts +46 -0
  152. package/src/schema/nodes/highlight_marker.ts +68 -0
  153. package/src/schema/nodes/image_element.ts +49 -0
  154. package/src/schema/nodes/inline_equation.ts +68 -0
  155. package/src/schema/nodes/inline_footnote.ts +66 -0
  156. package/src/schema/nodes/keyword.ts +61 -0
  157. package/src/schema/nodes/keyword_group.ts +63 -0
  158. package/src/schema/nodes/keywords.ts +59 -0
  159. package/src/schema/nodes/keywords_element.ts +64 -0
  160. package/src/schema/nodes/link.ts +79 -0
  161. package/src/schema/nodes/list.ts +134 -0
  162. package/src/schema/nodes/listing.ts +91 -0
  163. package/src/schema/nodes/listing_element.ts +61 -0
  164. package/src/schema/nodes/long_desc.ts +36 -0
  165. package/src/schema/nodes/manuscript.ts +86 -0
  166. package/src/schema/nodes/missing_figure.ts +59 -0
  167. package/src/schema/nodes/paragraph.ts +77 -0
  168. package/src/schema/nodes/placeholder.ts +62 -0
  169. package/src/schema/nodes/placeholder_element.ts +60 -0
  170. package/src/schema/nodes/pullquote_element.ts +81 -0
  171. package/src/schema/nodes/quote_image.ts +64 -0
  172. package/src/schema/nodes/section.ts +69 -0
  173. package/src/schema/nodes/section_label.ts +39 -0
  174. package/src/schema/nodes/section_title.ts +58 -0
  175. package/src/schema/nodes/subtitle.ts +40 -0
  176. package/src/schema/nodes/subtitles.ts +51 -0
  177. package/src/schema/nodes/supplement.ts +77 -0
  178. package/src/schema/nodes/supplements.ts +60 -0
  179. package/src/schema/nodes/table.ts +144 -0
  180. package/src/schema/nodes/table_col.ts +76 -0
  181. package/src/schema/nodes/table_element.ts +67 -0
  182. package/src/schema/nodes/table_element_footer.ts +42 -0
  183. package/src/schema/nodes/text.ts +31 -0
  184. package/src/schema/nodes/title.ts +43 -0
  185. package/src/schema/nodes/trans_abstract.ts +58 -0
  186. package/src/schema/nodes/trans_graphical_abstract.ts +67 -0
  187. package/src/schema/types.ts +243 -0
  188. package/src/tests.ts +33 -0
  189. package/src/transformer/id.ts +23 -0
  190. package/src/transformer/index.ts +21 -0
  191. package/src/transformer/node-names.ts +75 -0
  192. package/src/transformer/node-title.ts +116 -0
  193. package/src/transformer/node-types.ts +39 -0
  194. package/src/transformer/node-validator.ts +82 -0
  195. package/src/types.ts +25 -0
  196. package/src/version.ts +1 -0
@@ -0,0 +1,55 @@
1
+ /*!
2
+ * © 2026 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 { JSONProsemirrorNode } from '../../../types'
17
+ import { MigrationScript } from '../migration-script'
18
+
19
+ class Migration4323 implements MigrationScript {
20
+ fromVersion = '4.3.22'
21
+ toVersion = '4.3.23'
22
+
23
+ migrateNode(node: JSONProsemirrorNode): JSONProsemirrorNode {
24
+ if (node.type === 'contributor') {
25
+ if (node.attrs.affiliations) {
26
+ node.attrs.affiliationIDs = node.attrs.affiliations
27
+ delete node.attrs.affiliations
28
+ }
29
+ if (Array.isArray(node.attrs.corresp)) {
30
+ node.attrs.correspIDs = node.attrs.corresp.map((c) => c.correspID)
31
+ delete node.attrs.corresp
32
+ }
33
+ if (Array.isArray(node.attrs.footnote)) {
34
+ node.attrs.footnoteIDs = node.attrs.footnote.map((f) => f.noteID)
35
+ delete node.attrs.footnote
36
+ }
37
+ node.attrs.given = node.attrs.bibliographicName.given
38
+ node.attrs.family = node.attrs.bibliographicName.family
39
+ node.attrs.suffix = node.attrs.bibliographicName.suffix
40
+ node.attrs.ORCID = node.attrs.ORCIDIdentifier
41
+ delete node.attrs.bibliographicName
42
+ delete node.attrs.userID
43
+ delete node.attrs.ORCIDIdentifier
44
+ }
45
+ if (node.type === 'comment') {
46
+ const contribution = node.attrs.contributions[0]
47
+ node.attrs.userID = contribution.profileID
48
+ node.attrs.timestamp = contribution.timestamp
49
+ delete node.attrs.contributions
50
+ }
51
+ return node
52
+ }
53
+ }
54
+
55
+ export default Migration4323
@@ -0,0 +1,132 @@
1
+ /*!
2
+ * © 2025 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 { JSONProsemirrorNode } from '../../../types'
17
+ import { Nodes, schema } from '../../index'
18
+ import { MigrationScript } from '../migration-script'
19
+
20
+ interface Config {
21
+ title?: 'required' | 'optional'
22
+ caption?: 'required' | 'optional'
23
+ location: { pos?: 'start' | 'end'; before?: Nodes }
24
+ }
25
+
26
+ const CONFIG: Record<string, Config> = {
27
+ figure_element: { caption: 'required', location: { before: 'alt_text' } },
28
+ table_element: { title: 'required', location: { pos: 'start' } },
29
+ image_element: { caption: 'required', location: { before: 'alt_text' } },
30
+ listing_element: {
31
+ title: 'required',
32
+ caption: 'required',
33
+ location: { pos: 'end' },
34
+ },
35
+ supplement: {
36
+ title: 'required',
37
+ caption: 'required',
38
+ location: { pos: 'start' },
39
+ },
40
+ embed: { title: 'required', caption: 'required', location: { pos: 'start' } },
41
+ box_element: {
42
+ title: 'optional',
43
+ caption: 'optional',
44
+ location: { pos: 'start' },
45
+ },
46
+ }
47
+
48
+ const getCaptionNode = (nodes: JSONProsemirrorNode[], isRequired: boolean) => {
49
+ if (nodes.length === 0) {
50
+ return isRequired
51
+ ? {
52
+ type: 'caption',
53
+ content: [{ type: 'text_block', attrs: {} }],
54
+ attrs: {},
55
+ }
56
+ : undefined
57
+ }
58
+
59
+ return nodes.reduce<JSONProsemirrorNode>(
60
+ (caption, { content }) => ({
61
+ ...caption,
62
+ content: [
63
+ ...(caption.content || []),
64
+ { type: 'text_block', content, attrs: {} },
65
+ ],
66
+ }),
67
+ { type: 'caption', content: [], attrs: {} }
68
+ )
69
+ }
70
+
71
+ class Migration4334 implements MigrationScript {
72
+ fromVersion = '4.3.33'
73
+ toVersion = '4.3.34'
74
+
75
+ migrateNode(node: JSONProsemirrorNode): JSONProsemirrorNode {
76
+ const config = CONFIG[node.type]
77
+ if (!node.content || !config) {
78
+ return node
79
+ }
80
+
81
+ const figCaption = node.content.find((n) => n.type === 'figcaption')
82
+ const foundTitle = (figCaption?.content || []).find(
83
+ (n) => n.type === 'caption_title'
84
+ )
85
+ const captionNodes = (figCaption?.content || []).filter(
86
+ (node) => node.type === 'caption')
87
+ const foundCaption = getCaptionNode(
88
+ captionNodes,
89
+ config.caption === 'required'
90
+ )
91
+
92
+ const cleanContent = node.content.filter((n) => n.type !== 'figcaption')
93
+
94
+ const placeholderTitle = schema.nodes.caption_title.create().toJSON()
95
+ const placeholderCaption = schema.nodes.caption.create().toJSON()
96
+
97
+ const captionGroup: JSONProsemirrorNode[] = []
98
+
99
+ if (
100
+ config.title === 'required' ||
101
+ (config.title === 'optional' && foundTitle)
102
+ ) {
103
+ captionGroup.push(foundTitle || placeholderTitle)
104
+ }
105
+
106
+ if (
107
+ config.caption === 'required' ||
108
+ (config.caption === 'optional' && foundCaption)
109
+ ) {
110
+ captionGroup.push(foundCaption || placeholderCaption)
111
+ }
112
+
113
+ if (config.location.pos === 'start') {
114
+ cleanContent.unshift(...captionGroup)
115
+ } else if (config.location.pos === 'end') {
116
+ cleanContent.push(...captionGroup)
117
+ } else if (config.location.before) {
118
+ const idx = cleanContent.findIndex(
119
+ (n) => n.type === config.location.before
120
+ )
121
+ cleanContent.splice(
122
+ idx === -1 ? cleanContent.length : idx,
123
+ 0,
124
+ ...captionGroup
125
+ )
126
+ }
127
+
128
+ return { ...node, content: cleanContent }
129
+ }
130
+ }
131
+
132
+ export default Migration4334
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * © 2026 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 { JSONProsemirrorNode } from '../../../types'
17
+ import { MigrationScript } from '../migration-script'
18
+
19
+ class Migration4335 implements MigrationScript {
20
+ fromVersion = '4.3.34'
21
+ toVersion = '4.3.35'
22
+
23
+ migrateNode(node: JSONProsemirrorNode): JSONProsemirrorNode {
24
+ if (
25
+ node.type === 'pullquote_element' ||
26
+ node.type === 'blockquote_element'
27
+ ) {
28
+ return {
29
+ ...node,
30
+ content: (node.content ?? []).map((child) =>
31
+ child.type === 'paragraph'
32
+ ? { ...child, type: 'text_block' }
33
+ : child
34
+ ),
35
+ }
36
+ }
37
+ return node
38
+ }
39
+ }
40
+
41
+ export default Migration4335
@@ -0,0 +1,49 @@
1
+ /*!
2
+ * © 2024 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
+
17
+ import Migration125 from './1.2.5'
18
+ import Migration2322 from './2.3.22'
19
+ import { Migration3012 } from './3.0.12'
20
+ import Migration3021 from './3.0.21'
21
+ import Migration3030 from './3.0.30'
22
+ import Migration3031 from './3.0.31'
23
+ import Migration3041 from './3.0.41'
24
+ import Migration3055 from './3.0.55'
25
+ import Migration3056 from './3.0.56'
26
+ import Migration4213 from './4.2.13'
27
+ import Migration4215 from './4.2.15'
28
+ import Migration4323 from './4.3.23'
29
+ import Migration4334 from './4.3.34'
30
+ import Migration4335 from './4.3.35'
31
+
32
+ const migrations = [
33
+ new Migration125(),
34
+ new Migration2322(),
35
+ new Migration3012(),
36
+ new Migration3021(),
37
+ new Migration3030(),
38
+ new Migration3031(),
39
+ new Migration3041(),
40
+ new Migration3055(),
41
+ new Migration3056(),
42
+ new Migration4213(),
43
+ new Migration4215(),
44
+ new Migration4323(),
45
+ new Migration4334(),
46
+ new Migration4335(),
47
+ ]
48
+
49
+ export default migrations
@@ -0,0 +1,29 @@
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
+
17
+ import { NodeSpec } from 'prosemirror-model'
18
+
19
+ // This node has no representation in json-schema
20
+ // It exists for the purpose of styling in the UI
21
+
22
+ export const abstracts: NodeSpec = {
23
+ content: 'sections* (trans_abstract | trans_graphical_abstract)*',
24
+ attrs: {
25
+ id: { default: '' },
26
+ },
27
+ group: 'block',
28
+ toDOM: () => ['div', { class: 'abstracts' }, 0],
29
+ }
@@ -0,0 +1,88 @@
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
+ import { NodeSpec } from 'prosemirror-model'
17
+
18
+ import { ManuscriptNode } from '../types'
19
+
20
+ export interface Email {
21
+ href: string
22
+ text: string
23
+ }
24
+
25
+ interface Attrs {
26
+ id: string
27
+ institution: string
28
+ department: string
29
+ addressLine1: string
30
+ addressLine2: string
31
+ addressLine3: string
32
+ postCode: string
33
+ country: string
34
+ county: string
35
+ city: string
36
+ email: Email
37
+ priority: number
38
+ }
39
+
40
+ export interface AffiliationNode extends ManuscriptNode {
41
+ attrs: Attrs
42
+ }
43
+
44
+ export const affiliation: NodeSpec = {
45
+ content: 'inline*',
46
+ atom: true,
47
+ attrs: {
48
+ id: { default: '' },
49
+ institution: { default: '' },
50
+ department: { default: '' },
51
+ addressLine1: { default: '' },
52
+ addressLine2: { default: '' },
53
+ addressLine3: { default: '' },
54
+ postCode: { default: '' },
55
+ country: { default: '' },
56
+ county: { default: '' },
57
+ city: { default: '' },
58
+ priority: { default: undefined },
59
+ email: { default: undefined },
60
+ dataTracked: { default: null },
61
+ },
62
+ group: 'block',
63
+ parseDOM: [
64
+ {
65
+ tag: 'div.affiliation',
66
+ getAttrs: (node) => {
67
+ const dom = node as HTMLSpanElement
68
+ return {
69
+ id: dom.getAttribute('id'),
70
+ }
71
+ },
72
+ },
73
+ ],
74
+ toDOM: (node) => {
75
+ const affiliationNode = node as AffiliationNode
76
+ return [
77
+ 'div',
78
+ {
79
+ class: 'affiliation',
80
+ id: affiliationNode.attrs.id,
81
+ },
82
+ ]
83
+ },
84
+ }
85
+
86
+ export const isAffiliationNode = (
87
+ node: ManuscriptNode
88
+ ): node is AffiliationNode => node.type === node.type.schema.nodes.affiliation
@@ -0,0 +1,30 @@
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
+
17
+ import { NodeSpec } from 'prosemirror-model'
18
+
19
+ // This node has no representation in json-schema
20
+ // It exists for the purpose of styling in the UI
21
+
22
+ export const affiliations: NodeSpec = {
23
+ content: 'affiliation*',
24
+ attrs: {
25
+ id: { default: '' },
26
+ },
27
+ group: 'block',
28
+ selectable: false,
29
+ toDOM: () => ['div', { class: 'affiliations' }, 0],
30
+ }
@@ -0,0 +1,36 @@
1
+ /*!
2
+ * © 2025 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
+
17
+ import type { NodeSpec } from 'prosemirror-model'
18
+
19
+ import type { ManuscriptNode } from '../types'
20
+
21
+ export interface AltTextAttrs {
22
+ id: string
23
+ }
24
+
25
+ export interface AltTextNode extends ManuscriptNode {
26
+ attrs: AltTextAttrs
27
+ }
28
+
29
+ export const altText: NodeSpec = {
30
+ content: 'text*',
31
+ attrs: {
32
+ id: { default: '' },
33
+ },
34
+ parseDOM: [{ tag: 'div' }],
35
+ toDOM: () => ['div', 0],
36
+ }
@@ -0,0 +1,40 @@
1
+ /*!
2
+ * © 2025 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
+
17
+ import { NodeSpec } from 'prosemirror-model'
18
+
19
+ import { ManuscriptNode } from '../types'
20
+
21
+ export interface AltTitleAttrs {
22
+ id: string
23
+ type: string
24
+ }
25
+
26
+ export interface AltTitleNode extends ManuscriptNode {
27
+ attrs: AltTitleAttrs
28
+ }
29
+
30
+ export const altTitle: NodeSpec = {
31
+ content: '(text | highlight_marker)*',
32
+ attrs: {
33
+ id: { default: '' },
34
+ type: { default: '' },
35
+ dataTracked: { default: null },
36
+ },
37
+ group: 'block element',
38
+ parseDOM: [{ tag: 'div' }],
39
+ toDOM: () => ['div', 0],
40
+ }
@@ -0,0 +1,58 @@
1
+ /*!
2
+ * © 2025 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
+
17
+ import { NodeSpec } from 'prosemirror-model'
18
+
19
+ import { ManuscriptNode } from '../types'
20
+
21
+ export interface AltTitlesSectionAttrs {
22
+ id: string
23
+ }
24
+
25
+ export interface AltTitlesSectionNode extends ManuscriptNode {
26
+ attrs: AltTitlesSectionAttrs
27
+ }
28
+
29
+ export const altTitlesSection: NodeSpec = {
30
+ content: 'alt_title*',
31
+ attrs: {
32
+ id: { default: '' },
33
+ },
34
+ group: 'block sections',
35
+ selectable: false,
36
+ parseDOM: [
37
+ {
38
+ tag: 'section.alt-titles',
39
+ },
40
+ ],
41
+ toDOM: (node) => {
42
+ const altTitlesSectionNode = node as AltTitlesSectionNode
43
+
44
+ return [
45
+ 'section',
46
+ {
47
+ id: altTitlesSectionNode.attrs.id,
48
+ class: 'alt-titles',
49
+ },
50
+ 0,
51
+ ]
52
+ },
53
+ }
54
+
55
+ export const isAltTitlesSectionNode = (
56
+ node: ManuscriptNode
57
+ ): node is AltTitlesSectionNode =>
58
+ node.type === node.type.schema.nodes.alt_titles_section
@@ -0,0 +1,46 @@
1
+ /*!
2
+ * © 2025 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
+
18
+ import { ManuscriptNode } from '../types'
19
+ export interface AttachmentAttrs {
20
+ id: string
21
+ href: string
22
+ type: string
23
+ }
24
+
25
+ export interface AttachmentNode extends ManuscriptNode {
26
+ attrs: AttachmentAttrs
27
+ }
28
+ export const attachment: NodeSpec = {
29
+ attrs: {
30
+ id: { default: '' },
31
+ type: { default: '' },
32
+ href: { default: '' },
33
+ },
34
+ toDOM: (node) => {
35
+ return [
36
+ 'div',
37
+ {
38
+ class: 'attachment',
39
+ id: node.attrs.id,
40
+ },
41
+ ]
42
+ },
43
+ }
44
+ export const isAttachmentNode = (
45
+ node: ManuscriptNode
46
+ ): node is AttachmentNode => node.type === node.type.schema.nodes.attachment
@@ -0,0 +1,45 @@
1
+ /*!
2
+ * © 2025 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
+
17
+ import { NodeSpec } from 'prosemirror-model'
18
+
19
+ import { ManuscriptNode } from '../types'
20
+ export interface AttachmentsAttrs {
21
+ id: string
22
+ }
23
+
24
+ export interface AttachmentsNode extends ManuscriptNode {
25
+ attrs: AttachmentsAttrs
26
+ }
27
+ export const attachments: NodeSpec = {
28
+ content: 'attachment*',
29
+ attrs: {
30
+ id: { default: '' },
31
+ },
32
+ toDOM: (node) => {
33
+ return [
34
+ 'div',
35
+ {
36
+ class: 'attachments',
37
+ id: node.attrs.id,
38
+ },
39
+ ]
40
+ },
41
+ }
42
+
43
+ export const isAttachmentsNode = (
44
+ node: ManuscriptNode
45
+ ): node is AttachmentsNode => node.type === node.type.schema.nodes.attachments
@@ -0,0 +1,38 @@
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
+
17
+ import { NodeSpec } from 'prosemirror-model'
18
+
19
+ import { ManuscriptNode } from '../types'
20
+
21
+ export interface AttributionNode extends ManuscriptNode {
22
+ attrs: Record<string, unknown>
23
+ }
24
+
25
+ export const attribution: NodeSpec = {
26
+ content: '(text | link | highlight_marker)*',
27
+ attrs: { dataTracked: { default: null } },
28
+ group: 'block',
29
+ isolating: true,
30
+ selectable: false,
31
+ parseDOM: [
32
+ {
33
+ tag: 'footer',
34
+ context: 'blockquote_element/|pullquote_element/',
35
+ },
36
+ ],
37
+ toDOM: () => ['footer', 0],
38
+ }