@manuscripts/transform 1.0.0

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 (315) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +193 -0
  3. package/dist/cjs/errors.js +17 -0
  4. package/dist/cjs/index.js +27 -0
  5. package/dist/cjs/jats/importer/index.js +24 -0
  6. package/dist/cjs/jats/importer/jats-body-dom-parser.js +650 -0
  7. package/dist/cjs/jats/importer/jats-body-transformations.js +269 -0
  8. package/dist/cjs/jats/importer/jats-comments.js +131 -0
  9. package/dist/cjs/jats/importer/jats-front-parser.js +341 -0
  10. package/dist/cjs/jats/importer/jats-journal-meta-parser.js +77 -0
  11. package/dist/cjs/jats/importer/jats-parser-utils.js +145 -0
  12. package/dist/cjs/jats/importer/jats-reference-parser.js +180 -0
  13. package/dist/cjs/jats/importer/parse-jats-article.js +237 -0
  14. package/dist/cjs/jats/index.js +40 -0
  15. package/dist/cjs/jats/jats-exporter.js +1569 -0
  16. package/dist/cjs/jats/jats-versions.js +41 -0
  17. package/dist/cjs/lib/attributes.js +26 -0
  18. package/dist/cjs/lib/html.js +48 -0
  19. package/dist/cjs/lib/styled-content.js +28 -0
  20. package/dist/cjs/lib/table-cell-styles.js +52 -0
  21. package/dist/cjs/lib/utils.js +66 -0
  22. package/dist/cjs/mathjax/index.js +41 -0
  23. package/dist/cjs/mathjax/mathjax-packages.js +20 -0
  24. package/dist/cjs/mathjax/mathml-to-svg.js +56 -0
  25. package/dist/cjs/mathjax/tex-to-mathml.js +49 -0
  26. package/dist/cjs/mathjax/tex-to-svg.js +59 -0
  27. package/dist/cjs/schema/groups.js +31 -0
  28. package/dist/cjs/schema/index.js +195 -0
  29. package/dist/cjs/schema/marks.js +159 -0
  30. package/dist/cjs/schema/nodes/attribution.js +32 -0
  31. package/dist/cjs/schema/nodes/bibliography_element.js +44 -0
  32. package/dist/cjs/schema/nodes/bibliography_item.js +101 -0
  33. package/dist/cjs/schema/nodes/bibliography_section.js +46 -0
  34. package/dist/cjs/schema/nodes/blockquote_element.js +62 -0
  35. package/dist/cjs/schema/nodes/caption.js +52 -0
  36. package/dist/cjs/schema/nodes/caption_title.js +51 -0
  37. package/dist/cjs/schema/nodes/citation.js +52 -0
  38. package/dist/cjs/schema/nodes/comment.js +26 -0
  39. package/dist/cjs/schema/nodes/cross_reference.js +58 -0
  40. package/dist/cjs/schema/nodes/doc.js +21 -0
  41. package/dist/cjs/schema/nodes/equation.js +55 -0
  42. package/dist/cjs/schema/nodes/equation_element.js +52 -0
  43. package/dist/cjs/schema/nodes/figcaption.js +31 -0
  44. package/dist/cjs/schema/nodes/figure.js +52 -0
  45. package/dist/cjs/schema/nodes/figure_element.js +78 -0
  46. package/dist/cjs/schema/nodes/footnote.js +67 -0
  47. package/dist/cjs/schema/nodes/footnotes_element.js +54 -0
  48. package/dist/cjs/schema/nodes/footnotes_section.js +45 -0
  49. package/dist/cjs/schema/nodes/graphical_abstract_section.js +46 -0
  50. package/dist/cjs/schema/nodes/hard_break.js +30 -0
  51. package/dist/cjs/schema/nodes/highlight_marker.js +53 -0
  52. package/dist/cjs/schema/nodes/inline_equation.js +58 -0
  53. package/dist/cjs/schema/nodes/inline_footnote.js +51 -0
  54. package/dist/cjs/schema/nodes/keywords_element.js +52 -0
  55. package/dist/cjs/schema/nodes/keywords_section.js +46 -0
  56. package/dist/cjs/schema/nodes/link.js +61 -0
  57. package/dist/cjs/schema/nodes/list.js +121 -0
  58. package/dist/cjs/schema/nodes/listing.js +73 -0
  59. package/dist/cjs/schema/nodes/listing_element.js +52 -0
  60. package/dist/cjs/schema/nodes/manuscript.js +46 -0
  61. package/dist/cjs/schema/nodes/missing_figure.js +50 -0
  62. package/dist/cjs/schema/nodes/paragraph.js +63 -0
  63. package/dist/cjs/schema/nodes/placeholder.js +49 -0
  64. package/dist/cjs/schema/nodes/placeholder_element.js +48 -0
  65. package/dist/cjs/schema/nodes/pullquote_element.js +65 -0
  66. package/dist/cjs/schema/nodes/section.js +94 -0
  67. package/dist/cjs/schema/nodes/section_label.js +30 -0
  68. package/dist/cjs/schema/nodes/section_title.js +48 -0
  69. package/dist/cjs/schema/nodes/table.js +70 -0
  70. package/dist/cjs/schema/nodes/table_col.js +57 -0
  71. package/dist/cjs/schema/nodes/table_element.js +62 -0
  72. package/dist/cjs/schema/nodes/table_row.js +123 -0
  73. package/dist/cjs/schema/nodes/text.js +21 -0
  74. package/dist/cjs/schema/nodes/toc_element.js +52 -0
  75. package/dist/cjs/schema/nodes/toc_section.js +46 -0
  76. package/dist/cjs/schema/types.js +17 -0
  77. package/dist/cjs/tests.js +30 -0
  78. package/dist/cjs/transformer/builders.js +305 -0
  79. package/dist/cjs/transformer/bundles-data.js +36 -0
  80. package/dist/cjs/transformer/bundles.js +32 -0
  81. package/dist/cjs/transformer/decode.js +619 -0
  82. package/dist/cjs/transformer/document-object-types.js +31 -0
  83. package/dist/cjs/transformer/encode.js +545 -0
  84. package/dist/cjs/transformer/filename.js +27 -0
  85. package/dist/cjs/transformer/footnote-category.js +20 -0
  86. package/dist/cjs/transformer/footnotes-order.js +59 -0
  87. package/dist/cjs/transformer/highlight-markers.js +126 -0
  88. package/dist/cjs/transformer/html.js +414 -0
  89. package/dist/cjs/transformer/id.js +28 -0
  90. package/dist/cjs/transformer/index.js +54 -0
  91. package/dist/cjs/transformer/labels.js +85 -0
  92. package/dist/cjs/transformer/manuscript-dependencies.js +74 -0
  93. package/dist/cjs/transformer/model-map.js +26 -0
  94. package/dist/cjs/transformer/models.js +17 -0
  95. package/dist/cjs/transformer/node-names.js +42 -0
  96. package/dist/cjs/transformer/node-title.js +87 -0
  97. package/dist/cjs/transformer/node-types.js +62 -0
  98. package/dist/cjs/transformer/object-types.js +57 -0
  99. package/dist/cjs/transformer/project-bundle.js +86 -0
  100. package/dist/cjs/transformer/section-category.js +222 -0
  101. package/dist/cjs/transformer/serializer.js +23 -0
  102. package/dist/cjs/transformer/shared-data.js +31 -0
  103. package/dist/cjs/transformer/tei-grobid-importer.js +121 -0
  104. package/dist/cjs/transformer/timestamp.js +20 -0
  105. package/dist/cjs/transformer/update-identifiers.js +93 -0
  106. package/dist/cjs/types.js +2 -0
  107. package/dist/es/errors.js +12 -0
  108. package/dist/es/index.js +9 -0
  109. package/dist/es/jats/importer/index.js +16 -0
  110. package/dist/es/jats/importer/jats-body-dom-parser.js +644 -0
  111. package/dist/es/jats/importer/jats-body-transformations.js +266 -0
  112. package/dist/es/jats/importer/jats-comments.js +124 -0
  113. package/dist/es/jats/importer/jats-front-parser.js +335 -0
  114. package/dist/es/jats/importer/jats-journal-meta-parser.js +70 -0
  115. package/dist/es/jats/importer/jats-parser-utils.js +139 -0
  116. package/dist/es/jats/importer/jats-reference-parser.js +177 -0
  117. package/dist/es/jats/importer/parse-jats-article.js +229 -0
  118. package/dist/es/jats/index.js +18 -0
  119. package/dist/es/jats/jats-exporter.js +1561 -0
  120. package/dist/es/jats/jats-versions.js +36 -0
  121. package/dist/es/lib/attributes.js +22 -0
  122. package/dist/es/lib/html.js +43 -0
  123. package/dist/es/lib/styled-content.js +23 -0
  124. package/dist/es/lib/table-cell-styles.js +47 -0
  125. package/dist/es/lib/utils.js +59 -0
  126. package/dist/es/mathjax/index.js +12 -0
  127. package/dist/es/mathjax/mathjax-packages.js +17 -0
  128. package/dist/es/mathjax/mathml-to-svg.js +52 -0
  129. package/dist/es/mathjax/tex-to-mathml.js +45 -0
  130. package/dist/es/mathjax/tex-to-svg.js +55 -0
  131. package/dist/es/schema/groups.js +27 -0
  132. package/dist/es/schema/index.js +178 -0
  133. package/dist/es/schema/marks.js +156 -0
  134. package/dist/es/schema/nodes/attribution.js +29 -0
  135. package/dist/es/schema/nodes/bibliography_element.js +41 -0
  136. package/dist/es/schema/nodes/bibliography_item.js +98 -0
  137. package/dist/es/schema/nodes/bibliography_section.js +42 -0
  138. package/dist/es/schema/nodes/blockquote_element.js +58 -0
  139. package/dist/es/schema/nodes/caption.js +49 -0
  140. package/dist/es/schema/nodes/caption_title.js +48 -0
  141. package/dist/es/schema/nodes/citation.js +48 -0
  142. package/dist/es/schema/nodes/comment.js +23 -0
  143. package/dist/es/schema/nodes/cross_reference.js +55 -0
  144. package/dist/es/schema/nodes/doc.js +18 -0
  145. package/dist/es/schema/nodes/equation.js +52 -0
  146. package/dist/es/schema/nodes/equation_element.js +49 -0
  147. package/dist/es/schema/nodes/figcaption.js +28 -0
  148. package/dist/es/schema/nodes/figure.js +49 -0
  149. package/dist/es/schema/nodes/figure_element.js +74 -0
  150. package/dist/es/schema/nodes/footnote.js +63 -0
  151. package/dist/es/schema/nodes/footnotes_element.js +50 -0
  152. package/dist/es/schema/nodes/footnotes_section.js +41 -0
  153. package/dist/es/schema/nodes/graphical_abstract_section.js +42 -0
  154. package/dist/es/schema/nodes/hard_break.js +27 -0
  155. package/dist/es/schema/nodes/highlight_marker.js +49 -0
  156. package/dist/es/schema/nodes/inline_equation.js +55 -0
  157. package/dist/es/schema/nodes/inline_footnote.js +47 -0
  158. package/dist/es/schema/nodes/keywords_element.js +49 -0
  159. package/dist/es/schema/nodes/keywords_section.js +42 -0
  160. package/dist/es/schema/nodes/link.js +58 -0
  161. package/dist/es/schema/nodes/list.js +117 -0
  162. package/dist/es/schema/nodes/listing.js +69 -0
  163. package/dist/es/schema/nodes/listing_element.js +49 -0
  164. package/dist/es/schema/nodes/manuscript.js +43 -0
  165. package/dist/es/schema/nodes/missing_figure.js +47 -0
  166. package/dist/es/schema/nodes/paragraph.js +59 -0
  167. package/dist/es/schema/nodes/placeholder.js +46 -0
  168. package/dist/es/schema/nodes/placeholder_element.js +45 -0
  169. package/dist/es/schema/nodes/pullquote_element.js +61 -0
  170. package/dist/es/schema/nodes/section.js +90 -0
  171. package/dist/es/schema/nodes/section_label.js +26 -0
  172. package/dist/es/schema/nodes/section_title.js +44 -0
  173. package/dist/es/schema/nodes/table.js +67 -0
  174. package/dist/es/schema/nodes/table_col.js +54 -0
  175. package/dist/es/schema/nodes/table_element.js +59 -0
  176. package/dist/es/schema/nodes/table_row.js +120 -0
  177. package/dist/es/schema/nodes/text.js +18 -0
  178. package/dist/es/schema/nodes/toc_element.js +49 -0
  179. package/dist/es/schema/nodes/toc_section.js +42 -0
  180. package/dist/es/schema/types.js +16 -0
  181. package/dist/es/tests.js +28 -0
  182. package/dist/es/transformer/builders.js +261 -0
  183. package/dist/es/transformer/bundles-data.js +8 -0
  184. package/dist/es/transformer/bundles.js +27 -0
  185. package/dist/es/transformer/decode.js +608 -0
  186. package/dist/es/transformer/document-object-types.js +28 -0
  187. package/dist/es/transformer/encode.js +535 -0
  188. package/dist/es/transformer/filename.js +23 -0
  189. package/dist/es/transformer/footnote-category.js +16 -0
  190. package/dist/es/transformer/footnotes-order.js +53 -0
  191. package/dist/es/transformer/highlight-markers.js +120 -0
  192. package/dist/es/transformer/html.js +407 -0
  193. package/dist/es/transformer/id.js +23 -0
  194. package/dist/es/transformer/index.js +38 -0
  195. package/dist/es/transformer/labels.js +81 -0
  196. package/dist/es/transformer/manuscript-dependencies.js +64 -0
  197. package/dist/es/transformer/model-map.js +22 -0
  198. package/dist/es/transformer/models.js +16 -0
  199. package/dist/es/transformer/node-names.js +39 -0
  200. package/dist/es/transformer/node-title.js +82 -0
  201. package/dist/es/transformer/node-types.js +55 -0
  202. package/dist/es/transformer/object-types.js +52 -0
  203. package/dist/es/transformer/project-bundle.js +77 -0
  204. package/dist/es/transformer/section-category.js +210 -0
  205. package/dist/es/transformer/serializer.js +17 -0
  206. package/dist/es/transformer/shared-data.js +1 -0
  207. package/dist/es/transformer/tei-grobid-importer.js +115 -0
  208. package/dist/es/transformer/timestamp.js +16 -0
  209. package/dist/es/transformer/update-identifiers.js +87 -0
  210. package/dist/es/types.js +1 -0
  211. package/dist/types/errors.d.ts +6 -0
  212. package/dist/types/index.d.ts +9 -0
  213. package/dist/types/jats/importer/index.d.ts +16 -0
  214. package/dist/types/jats/importer/jats-body-dom-parser.d.ts +24 -0
  215. package/dist/types/jats/importer/jats-body-transformations.d.ts +31 -0
  216. package/dist/types/jats/importer/jats-comments.d.ts +26 -0
  217. package/dist/types/jats/importer/jats-front-parser.d.ts +62 -0
  218. package/dist/types/jats/importer/jats-journal-meta-parser.d.ts +37 -0
  219. package/dist/types/jats/importer/jats-parser-utils.d.ts +23 -0
  220. package/dist/types/jats/importer/jats-reference-parser.d.ts +23 -0
  221. package/dist/types/jats/importer/parse-jats-article.d.ts +30 -0
  222. package/dist/types/jats/index.d.ts +18 -0
  223. package/dist/types/jats/jats-exporter.d.ts +72 -0
  224. package/dist/types/jats/jats-versions.d.ts +23 -0
  225. package/dist/types/lib/attributes.d.ts +20 -0
  226. package/dist/types/lib/html.d.ts +17 -0
  227. package/dist/types/lib/styled-content.d.ts +22 -0
  228. package/dist/types/lib/table-cell-styles.d.ts +27 -0
  229. package/dist/types/lib/utils.d.ts +26 -0
  230. package/dist/types/mathjax/index.d.ts +3 -0
  231. package/dist/types/mathjax/mathjax-packages.d.ts +16 -0
  232. package/dist/types/mathjax/mathml-to-svg.d.ts +17 -0
  233. package/dist/types/mathjax/tex-to-mathml.d.ts +17 -0
  234. package/dist/types/mathjax/tex-to-svg.d.ts +17 -0
  235. package/dist/types/schema/groups.d.ts +22 -0
  236. package/dist/types/schema/index.d.ts +65 -0
  237. package/dist/types/schema/marks.d.ts +27 -0
  238. package/dist/types/schema/nodes/attribution.d.ts +21 -0
  239. package/dist/types/schema/nodes/bibliography_element.d.ts +26 -0
  240. package/dist/types/schema/nodes/bibliography_item.d.ts +36 -0
  241. package/dist/types/schema/nodes/bibliography_section.d.ts +26 -0
  242. package/dist/types/schema/nodes/blockquote_element.d.ts +28 -0
  243. package/dist/types/schema/nodes/caption.d.ts +25 -0
  244. package/dist/types/schema/nodes/caption_title.d.ts +25 -0
  245. package/dist/types/schema/nodes/citation.d.ts +27 -0
  246. package/dist/types/schema/nodes/comment.d.ts +31 -0
  247. package/dist/types/schema/nodes/cross_reference.d.ts +26 -0
  248. package/dist/types/schema/nodes/doc.d.ts +17 -0
  249. package/dist/types/schema/nodes/equation.d.ts +28 -0
  250. package/dist/types/schema/nodes/equation_element.d.ts +29 -0
  251. package/dist/types/schema/nodes/figcaption.d.ts +21 -0
  252. package/dist/types/schema/nodes/figure.d.ts +25 -0
  253. package/dist/types/schema/nodes/figure_element.d.ts +44 -0
  254. package/dist/types/schema/nodes/footnote.d.ts +32 -0
  255. package/dist/types/schema/nodes/footnotes_element.d.ts +28 -0
  256. package/dist/types/schema/nodes/footnotes_section.d.ts +26 -0
  257. package/dist/types/schema/nodes/graphical_abstract_section.d.ts +26 -0
  258. package/dist/types/schema/nodes/hard_break.d.ts +21 -0
  259. package/dist/types/schema/nodes/highlight_marker.d.ts +29 -0
  260. package/dist/types/schema/nodes/inline_equation.d.ts +28 -0
  261. package/dist/types/schema/nodes/inline_footnote.d.ts +27 -0
  262. package/dist/types/schema/nodes/keywords_element.d.ts +27 -0
  263. package/dist/types/schema/nodes/keywords_section.d.ts +26 -0
  264. package/dist/types/schema/nodes/link.d.ts +26 -0
  265. package/dist/types/schema/nodes/list.d.ts +39 -0
  266. package/dist/types/schema/nodes/listing.d.ts +33 -0
  267. package/dist/types/schema/nodes/listing_element.d.ts +29 -0
  268. package/dist/types/schema/nodes/manuscript.d.ts +23 -0
  269. package/dist/types/schema/nodes/missing_figure.d.ts +23 -0
  270. package/dist/types/schema/nodes/paragraph.d.ts +30 -0
  271. package/dist/types/schema/nodes/placeholder.d.ts +26 -0
  272. package/dist/types/schema/nodes/placeholder_element.d.ts +25 -0
  273. package/dist/types/schema/nodes/pullquote_element.d.ts +28 -0
  274. package/dist/types/schema/nodes/section.d.ts +36 -0
  275. package/dist/types/schema/nodes/section_label.d.ts +22 -0
  276. package/dist/types/schema/nodes/section_title.d.ts +22 -0
  277. package/dist/types/schema/nodes/table.d.ts +27 -0
  278. package/dist/types/schema/nodes/table_col.d.ts +24 -0
  279. package/dist/types/schema/nodes/table_element.d.ts +35 -0
  280. package/dist/types/schema/nodes/table_row.d.ts +41 -0
  281. package/dist/types/schema/nodes/text.d.ts +17 -0
  282. package/dist/types/schema/nodes/toc_element.d.ts +27 -0
  283. package/dist/types/schema/nodes/toc_section.d.ts +26 -0
  284. package/dist/types/schema/types.d.ts +45 -0
  285. package/dist/types/tests.d.ts +16 -0
  286. package/dist/types/transformer/builders.d.ts +74 -0
  287. package/dist/types/transformer/bundles-data.d.ts +3 -0
  288. package/dist/types/transformer/bundles.d.ts +3 -0
  289. package/dist/types/transformer/decode.d.ts +38 -0
  290. package/dist/types/transformer/document-object-types.d.ts +17 -0
  291. package/dist/types/transformer/encode.d.ts +29 -0
  292. package/dist/types/transformer/filename.d.ts +16 -0
  293. package/dist/types/transformer/footnote-category.d.ts +17 -0
  294. package/dist/types/transformer/footnotes-order.d.ts +23 -0
  295. package/dist/types/transformer/highlight-markers.d.ts +26 -0
  296. package/dist/types/transformer/html.d.ts +36 -0
  297. package/dist/types/transformer/id.d.ts +20 -0
  298. package/dist/types/transformer/index.d.ts +38 -0
  299. package/dist/types/transformer/labels.d.ts +24 -0
  300. package/dist/types/transformer/manuscript-dependencies.d.ts +12 -0
  301. package/dist/types/transformer/model-map.d.ts +19 -0
  302. package/dist/types/transformer/models.d.ts +48 -0
  303. package/dist/types/transformer/node-names.d.ts +17 -0
  304. package/dist/types/transformer/node-title.d.ts +19 -0
  305. package/dist/types/transformer/node-types.d.ts +22 -0
  306. package/dist/types/transformer/object-types.d.ts +29 -0
  307. package/dist/types/transformer/project-bundle.d.ts +30 -0
  308. package/dist/types/transformer/section-category.d.ts +28 -0
  309. package/dist/types/transformer/serializer.d.ts +19 -0
  310. package/dist/types/transformer/shared-data.d.ts +2 -0
  311. package/dist/types/transformer/tei-grobid-importer.d.ts +20 -0
  312. package/dist/types/transformer/timestamp.d.ts +16 -0
  313. package/dist/types/transformer/update-identifiers.d.ts +23 -0
  314. package/dist/types/types.d.ts +2 -0
  315. package/package.json +89 -0
@@ -0,0 +1,42 @@
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
+ export const keywordsSection = {
17
+ content: 'section_title (keywords_element | placeholder_element)',
18
+ attrs: {
19
+ id: { default: '' },
20
+ dataTracked: { default: null },
21
+ },
22
+ group: 'block sections',
23
+ selectable: false,
24
+ parseDOM: [
25
+ {
26
+ tag: 'section.keywords',
27
+ },
28
+ ],
29
+ toDOM: (node) => {
30
+ const keywordsSectionNode = node;
31
+ return [
32
+ 'section',
33
+ {
34
+ id: keywordsSectionNode.attrs.id,
35
+ class: 'keywords',
36
+ spellcheck: 'false',
37
+ },
38
+ 0,
39
+ ];
40
+ },
41
+ };
42
+ export const isKeywordsSectionNode = (node) => node.type === node.type.schema.nodes.keywords_section;
@@ -0,0 +1,58 @@
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
+ export const link = {
17
+ content: 'text*',
18
+ marks: '',
19
+ attrs: {
20
+ href: { default: '' },
21
+ title: { default: '' },
22
+ dataTracked: { default: null },
23
+ },
24
+ inline: true,
25
+ group: 'inline',
26
+ draggable: true,
27
+ atom: true,
28
+ parseDOM: [
29
+ {
30
+ tag: 'a[href]',
31
+ getAttrs: (a) => {
32
+ const dom = a;
33
+ return {
34
+ href: dom.getAttribute('href') || '',
35
+ title: dom.getAttribute('title') || '',
36
+ };
37
+ },
38
+ },
39
+ {
40
+ tag: 'span.citation[data-href]',
41
+ getAttrs: (span) => {
42
+ const dom = span;
43
+ return {
44
+ href: dom.getAttribute('data-href') || '',
45
+ };
46
+ },
47
+ priority: 80,
48
+ },
49
+ ],
50
+ toDOM: (node) => {
51
+ const { href, title } = node.attrs;
52
+ const attrs = { href };
53
+ if (title) {
54
+ attrs.title = title;
55
+ }
56
+ return ['a', attrs, 0];
57
+ },
58
+ };
@@ -0,0 +1,117 @@
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 { ObjectTypes } from '@manuscripts/manuscripts-json-schema';
17
+ import { buildElementClass } from '../../lib/attributes';
18
+ export const bulletList = {
19
+ content: 'list_item+',
20
+ group: 'block list element',
21
+ attrs: {
22
+ id: { default: '' },
23
+ paragraphStyle: { default: '' },
24
+ dataTracked: { default: null },
25
+ },
26
+ parseDOM: [
27
+ {
28
+ tag: 'ul',
29
+ getAttrs: (p) => {
30
+ const dom = p;
31
+ return {
32
+ id: dom.getAttribute('id'),
33
+ };
34
+ },
35
+ },
36
+ ],
37
+ toDOM: (node) => {
38
+ const bulletListNode = node;
39
+ return bulletListNode.attrs.id
40
+ ? [
41
+ 'ul',
42
+ {
43
+ id: bulletListNode.attrs.id,
44
+ class: buildElementClass(bulletListNode.attrs),
45
+ 'data-object-type': ObjectTypes.ListElement,
46
+ },
47
+ 0,
48
+ ]
49
+ : ['ul', 0];
50
+ },
51
+ };
52
+ export const orderedList = {
53
+ content: 'list_item+',
54
+ group: 'block list element',
55
+ attrs: {
56
+ id: { default: '' },
57
+ paragraphStyle: { default: '' },
58
+ dataTracked: { default: null },
59
+ },
60
+ parseDOM: [
61
+ {
62
+ tag: 'ol',
63
+ getAttrs: (p) => {
64
+ const dom = p;
65
+ return {
66
+ id: dom.getAttribute('id'),
67
+ };
68
+ },
69
+ },
70
+ ],
71
+ toDOM: (node) => {
72
+ const orderedListNode = node;
73
+ return orderedListNode.attrs.id
74
+ ? [
75
+ 'ol',
76
+ {
77
+ id: orderedListNode.attrs.id,
78
+ class: buildElementClass(orderedListNode.attrs),
79
+ 'data-object-type': ObjectTypes.ListElement,
80
+ },
81
+ 0,
82
+ ]
83
+ : ['ol', 0];
84
+ },
85
+ };
86
+ export const listItem = {
87
+ content: 'paragraph? (paragraph | list)+',
88
+ group: 'block',
89
+ defining: true,
90
+ attrs: {
91
+ placeholder: { default: 'List item' },
92
+ dataTracked: { default: null },
93
+ },
94
+ parseDOM: [
95
+ {
96
+ tag: 'li',
97
+ getAttrs: (p) => {
98
+ const dom = p;
99
+ return {
100
+ placeholder: dom.getAttribute('data-placeholder-text') || '',
101
+ };
102
+ },
103
+ },
104
+ ],
105
+ toDOM: (node) => {
106
+ const listItemNode = node;
107
+ const attrs = {};
108
+ if (listItemNode.attrs.placeholder) {
109
+ attrs['data-placeholder-text'] = listItemNode.attrs.placeholder;
110
+ }
111
+ return ['li', attrs, 0];
112
+ },
113
+ };
114
+ export const isListNode = (node) => {
115
+ const { nodes } = node.type.schema;
116
+ return node.type === nodes.bullet_list || node.type === nodes.ordered_list;
117
+ };
@@ -0,0 +1,69 @@
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 { ObjectTypes } from '@manuscripts/manuscripts-json-schema';
17
+ export const listing = {
18
+ attrs: {
19
+ id: { default: '' },
20
+ contents: { default: '' },
21
+ language: { default: '' },
22
+ languageKey: { default: 'null' },
23
+ isExpanded: { default: false },
24
+ isExecuting: { default: false },
25
+ dataTracked: { default: null },
26
+ comments: { default: null },
27
+ },
28
+ draggable: false,
29
+ selectable: false,
30
+ group: 'block',
31
+ parseDOM: [
32
+ {
33
+ tag: `pre.${ObjectTypes.Listing}`,
34
+ preserveWhitespace: 'full',
35
+ getAttrs: (p) => {
36
+ const node = p;
37
+ return {
38
+ contents: node.textContent,
39
+ language: node.getAttribute('language'),
40
+ languageKey: node.getAttribute('languageKey'),
41
+ };
42
+ },
43
+ priority: 100,
44
+ },
45
+ {
46
+ tag: 'pre',
47
+ preserveWhitespace: 'full',
48
+ getAttrs: (p) => {
49
+ const node = p;
50
+ return {
51
+ contents: node.getAttribute('code') || node.textContent,
52
+ languageKey: node.getAttribute('language'),
53
+ };
54
+ },
55
+ priority: 90,
56
+ },
57
+ ],
58
+ toDOM: (node) => {
59
+ const listingNode = node;
60
+ const dom = document.createElement('div');
61
+ dom.setAttribute('id', listingNode.attrs.id);
62
+ dom.classList.add(ObjectTypes.Listing);
63
+ dom.setAttribute('data-language', listingNode.attrs.language);
64
+ dom.setAttribute('data-languageKey', listingNode.attrs.languageKey);
65
+ dom.textContent = listingNode.attrs.contents;
66
+ return dom;
67
+ },
68
+ };
69
+ export const isListingNode = (node) => node.type === node.type.schema.nodes.listing;
@@ -0,0 +1,49 @@
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
+ export const listingElement = {
17
+ content: '(listing | placeholder) figcaption',
18
+ attrs: {
19
+ id: { default: '' },
20
+ suppressCaption: { default: true },
21
+ suppressTitle: { default: undefined },
22
+ dataTracked: { default: null },
23
+ comments: { default: null },
24
+ },
25
+ group: 'block element',
26
+ selectable: false,
27
+ parseDOM: [
28
+ {
29
+ tag: 'figure.listing',
30
+ getAttrs: (p) => {
31
+ const dom = p;
32
+ return {
33
+ id: dom.getAttribute('id'),
34
+ };
35
+ },
36
+ },
37
+ ],
38
+ toDOM: (node) => {
39
+ const listingElementNode = node;
40
+ return [
41
+ 'figure',
42
+ {
43
+ class: 'listing',
44
+ id: listingElementNode.attrs.id,
45
+ },
46
+ 0,
47
+ ];
48
+ },
49
+ };
@@ -0,0 +1,43 @@
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
+ export const manuscript = {
17
+ content: '(section | sections)+',
18
+ attrs: {
19
+ id: { default: '' },
20
+ },
21
+ group: 'block',
22
+ parseDOM: [
23
+ {
24
+ tag: 'article',
25
+ getAttrs: (p) => {
26
+ const dom = p;
27
+ return {
28
+ id: dom.getAttribute('id'),
29
+ };
30
+ },
31
+ },
32
+ ],
33
+ toDOM: (node) => {
34
+ const manuscriptNode = node;
35
+ return [
36
+ 'article',
37
+ {
38
+ id: manuscriptNode.attrs.id,
39
+ },
40
+ 0,
41
+ ];
42
+ },
43
+ };
@@ -0,0 +1,47 @@
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
+ export const missingFigure = {
17
+ attrs: {
18
+ id: { default: '' },
19
+ position: { default: undefined },
20
+ dataTracked: { default: null },
21
+ },
22
+ selectable: false,
23
+ group: 'block',
24
+ parseDOM: [
25
+ {
26
+ tag: 'figure',
27
+ context: 'figure_element/',
28
+ getAttrs: (dom) => {
29
+ const element = dom;
30
+ return {
31
+ id: element.getAttribute('id'),
32
+ };
33
+ },
34
+ },
35
+ ],
36
+ toDOM: (node) => {
37
+ const missingFigureNode = node;
38
+ return [
39
+ 'figure',
40
+ {
41
+ class: 'figure',
42
+ id: missingFigureNode.attrs.id,
43
+ },
44
+ 0,
45
+ ];
46
+ },
47
+ };
@@ -0,0 +1,59 @@
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 { ObjectTypes } from '@manuscripts/manuscripts-json-schema';
17
+ import { buildElementClass } from '../../lib/attributes';
18
+ export const paragraph = {
19
+ content: 'inline*',
20
+ attrs: {
21
+ id: { default: '' },
22
+ paragraphStyle: { default: '' },
23
+ placeholder: { default: '' },
24
+ dataTracked: { default: null },
25
+ comments: { default: null },
26
+ },
27
+ group: 'block element',
28
+ selectable: false,
29
+ parseDOM: [
30
+ {
31
+ tag: 'p',
32
+ getAttrs: (p) => {
33
+ const dom = p;
34
+ const attrs = {
35
+ id: dom.getAttribute('id') || undefined,
36
+ };
37
+ const placeholder = dom.getAttribute('data-placeholder-text');
38
+ if (placeholder) {
39
+ attrs.placeholder = placeholder;
40
+ }
41
+ return attrs;
42
+ },
43
+ },
44
+ ],
45
+ toDOM: (node) => {
46
+ const paragraphNode = node;
47
+ const attrs = {};
48
+ if (paragraphNode.attrs.id) {
49
+ attrs.id = paragraphNode.attrs.id;
50
+ }
51
+ attrs.class = buildElementClass(paragraphNode.attrs);
52
+ attrs['data-object-type'] = ObjectTypes.ParagraphElement;
53
+ if (paragraphNode.attrs.placeholder) {
54
+ attrs['data-placeholder-text'] = paragraphNode.attrs.placeholder;
55
+ }
56
+ return ['p', attrs, 0];
57
+ },
58
+ };
59
+ export const isParagraphNode = (node) => node.type === node.type.schema.nodes.paragraph;
@@ -0,0 +1,46 @@
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
+ export const placeholder = {
17
+ atom: true,
18
+ selectable: false,
19
+ attrs: {
20
+ id: { default: '' },
21
+ label: { default: '' },
22
+ dataTracked: { default: null },
23
+ },
24
+ group: 'block',
25
+ parseDOM: [
26
+ {
27
+ tag: 'div.placeholder',
28
+ getAttrs: (p) => {
29
+ const dom = p;
30
+ return {
31
+ id: dom.getAttribute('id'),
32
+ };
33
+ },
34
+ },
35
+ ],
36
+ toDOM: (node) => {
37
+ const placeholderNode = node;
38
+ return [
39
+ 'div',
40
+ {
41
+ class: 'placeholder-item',
42
+ id: placeholderNode.attrs.id,
43
+ },
44
+ ];
45
+ },
46
+ };
@@ -0,0 +1,45 @@
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
+ export const placeholderElement = {
17
+ atom: true,
18
+ selectable: false,
19
+ attrs: {
20
+ id: { default: '' },
21
+ dataTracked: { default: null },
22
+ },
23
+ group: 'block element',
24
+ parseDOM: [
25
+ {
26
+ tag: 'div.placeholder-element',
27
+ getAttrs: (p) => {
28
+ const dom = p;
29
+ return {
30
+ id: dom.getAttribute('id'),
31
+ };
32
+ },
33
+ },
34
+ ],
35
+ toDOM: (node) => {
36
+ const placeholderElementNode = node;
37
+ return [
38
+ 'div',
39
+ {
40
+ class: 'placeholder-element',
41
+ id: placeholderElementNode.attrs.id,
42
+ },
43
+ ];
44
+ },
45
+ };
@@ -0,0 +1,61 @@
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 { ObjectTypes } from '@manuscripts/manuscripts-json-schema';
17
+ import { buildElementClass } from '../../lib/attributes';
18
+ export const pullquoteElement = {
19
+ content: 'paragraph+ attribution',
20
+ attrs: {
21
+ id: { default: '' },
22
+ paragraphStyle: { default: '' },
23
+ placeholder: { default: '' },
24
+ dataTracked: { default: null },
25
+ },
26
+ group: 'block element',
27
+ selectable: false,
28
+ parseDOM: [
29
+ {
30
+ tag: 'aside.pullquote',
31
+ getAttrs: (aside) => {
32
+ const dom = aside;
33
+ const attrs = {
34
+ id: dom.getAttribute('id') || undefined,
35
+ };
36
+ const placeholder = dom.getAttribute('data-placeholder-text');
37
+ if (placeholder) {
38
+ attrs.placeholder = placeholder;
39
+ }
40
+ return attrs;
41
+ },
42
+ },
43
+ ],
44
+ toDOM: (node) => {
45
+ const pullquoteElementNode = node;
46
+ const attrs = {};
47
+ if (pullquoteElementNode.attrs.id) {
48
+ attrs.id = pullquoteElementNode.attrs.id;
49
+ }
50
+ attrs.class = [
51
+ 'pullquote',
52
+ buildElementClass(pullquoteElementNode.attrs),
53
+ ].join(' ');
54
+ attrs['data-object-type'] = ObjectTypes.QuoteElement;
55
+ if (pullquoteElementNode.attrs.placeholder) {
56
+ attrs['data-placeholder-text'] = pullquoteElementNode.attrs.placeholder;
57
+ }
58
+ return ['aside', attrs, 0];
59
+ },
60
+ };
61
+ export const isPullquoteElement = (node) => node.type === node.type.schema.nodes.pullquote_element;