@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,62 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.tableElement = void 0;
19
+ exports.tableElement = {
20
+ content: '(table | placeholder) figcaption? footnotes_element? (listing | placeholder)',
21
+ attrs: {
22
+ id: { default: '' },
23
+ paragraphStyle: { default: '' },
24
+ tableStyle: { default: '' },
25
+ label: { default: '' },
26
+ suppressCaption: { default: false },
27
+ suppressTitle: { default: undefined },
28
+ suppressFooter: { default: false },
29
+ suppressHeader: { default: false },
30
+ expandListing: { default: false },
31
+ dataTracked: { default: null },
32
+ comments: { default: null },
33
+ },
34
+ selectable: false,
35
+ group: 'block element executable',
36
+ parseDOM: [
37
+ {
38
+ tag: 'figure.table',
39
+ getAttrs: (dom) => {
40
+ const element = dom;
41
+ return {
42
+ id: element.getAttribute('id'),
43
+ paragraphStyle: element.getAttribute('data-paragraph-style') || '',
44
+ tableStyle: element.getAttribute('data-table-style') || '',
45
+ };
46
+ },
47
+ },
48
+ ],
49
+ toDOM: (node) => {
50
+ const tableElementNode = node;
51
+ return [
52
+ 'figure',
53
+ {
54
+ class: 'table',
55
+ id: tableElementNode.attrs.id,
56
+ 'data-paragraph-style': tableElementNode.attrs.paragraphStyle,
57
+ 'data-table-style': tableElementNode.attrs.tableStyle,
58
+ },
59
+ 0,
60
+ ];
61
+ },
62
+ };
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.tableCell = exports.tableRow = void 0;
19
+ const table_cell_styles_1 = require("../../lib/table-cell-styles");
20
+ const getCellAttrs = (p) => {
21
+ const dom = p;
22
+ const celltype = dom.tagName.toLowerCase();
23
+ const widthAttr = dom.getAttribute('data-colwidth');
24
+ const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr)
25
+ ? widthAttr.split(',').map((s) => Number(s))
26
+ : null;
27
+ const colspan = Number(dom.getAttribute('colspan') || 1);
28
+ const valign = dom.getAttribute('valign');
29
+ const align = dom.getAttribute('align');
30
+ const scope = dom.getAttribute('scope');
31
+ const style = dom.getAttribute('style');
32
+ return {
33
+ celltype,
34
+ colspan,
35
+ rowspan: Number(dom.getAttribute('rowspan') || 1),
36
+ colwidth: widths && widths.length === colspan ? widths : null,
37
+ placeholder: dom.getAttribute('data-placeholder-text') || '',
38
+ styles: (0, table_cell_styles_1.getTableCellStyles)(dom.style),
39
+ valign,
40
+ align,
41
+ scope,
42
+ style,
43
+ };
44
+ };
45
+ exports.tableRow = {
46
+ content: 'table_cell+',
47
+ tableRole: 'row',
48
+ attrs: {
49
+ placeholder: { default: '' },
50
+ },
51
+ parseDOM: [
52
+ {
53
+ tag: 'tr',
54
+ priority: 80,
55
+ },
56
+ ],
57
+ toDOM: (node) => {
58
+ const tableRowNode = node;
59
+ const attrs = {};
60
+ if (tableRowNode.attrs.placeholder) {
61
+ attrs['data-placeholder-text'] = tableRowNode.attrs.placeholder;
62
+ }
63
+ return ['tr', attrs, 0];
64
+ },
65
+ };
66
+ exports.tableCell = {
67
+ content: 'inline*',
68
+ attrs: {
69
+ celltype: { default: 'td' },
70
+ colspan: { default: 1 },
71
+ rowspan: { default: 1 },
72
+ colwidth: { default: null },
73
+ placeholder: { default: 'Data' },
74
+ styles: { default: {} },
75
+ valign: { default: null },
76
+ align: { default: null },
77
+ scope: { default: null },
78
+ style: { default: null },
79
+ },
80
+ tableRole: 'cell',
81
+ isolating: true,
82
+ parseDOM: [
83
+ { tag: 'td', getAttrs: getCellAttrs },
84
+ { tag: 'th', getAttrs: getCellAttrs },
85
+ ],
86
+ toDOM: (node) => {
87
+ const tableCellNode = node;
88
+ const attrs = {};
89
+ const tag = tableCellNode.attrs.celltype;
90
+ if (tableCellNode.attrs.colspan && tableCellNode.attrs.colspan !== 1) {
91
+ attrs.colspan = String(tableCellNode.attrs.colspan);
92
+ }
93
+ if (tableCellNode.attrs.rowspan && tableCellNode.attrs.rowspan !== 1) {
94
+ attrs.rowspan = String(tableCellNode.attrs.rowspan);
95
+ }
96
+ if (tableCellNode.attrs.colwidth) {
97
+ attrs['data-colwidth'] = tableCellNode.attrs.colwidth.join(',');
98
+ }
99
+ if (tableCellNode.attrs.placeholder) {
100
+ attrs['data-placeholder-text'] = tableCellNode.attrs.placeholder;
101
+ }
102
+ if (!tableCellNode.textContent) {
103
+ attrs.class = 'placeholder';
104
+ }
105
+ const styleString = (0, table_cell_styles_1.serializeTableCellStyles)(tableCellNode.attrs.styles);
106
+ if (styleString) {
107
+ attrs.style = styleString;
108
+ }
109
+ if (tableCellNode.attrs.valign) {
110
+ attrs.valign = tableCellNode.attrs.valign;
111
+ }
112
+ if (tableCellNode.attrs.align) {
113
+ attrs.align = tableCellNode.attrs.align;
114
+ }
115
+ if (tableCellNode.attrs.scope) {
116
+ attrs.scope = tableCellNode.attrs.scope;
117
+ }
118
+ if (tableCellNode.attrs.style) {
119
+ attrs.style = tableCellNode.attrs.style;
120
+ }
121
+ return [tag, attrs, 0];
122
+ },
123
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.text = void 0;
19
+ exports.text = {
20
+ group: 'inline',
21
+ };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.tocElement = void 0;
19
+ const html_1 = require("../../lib/html");
20
+ const createBodyElement = (node) => {
21
+ const dom = document.createElement('div');
22
+ dom.classList.add('manuscript-toc');
23
+ dom.id = node.attrs.id;
24
+ return dom;
25
+ };
26
+ exports.tocElement = {
27
+ atom: true,
28
+ attrs: {
29
+ id: { default: '' },
30
+ contents: { default: '' },
31
+ paragraphStyle: { default: '' },
32
+ dataTracked: { default: null },
33
+ },
34
+ group: 'block element',
35
+ selectable: false,
36
+ parseDOM: [
37
+ {
38
+ tag: 'div.manuscript-toc',
39
+ getAttrs: (p) => {
40
+ const dom = p;
41
+ return {
42
+ contents: dom.innerHTML,
43
+ };
44
+ },
45
+ },
46
+ ],
47
+ toDOM: (node) => {
48
+ const tocElementNode = node;
49
+ return ((0, html_1.nodeFromHTML)(tocElementNode.attrs.contents) ||
50
+ createBodyElement(tocElementNode));
51
+ },
52
+ };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.isTOCSectionNode = exports.tocSection = void 0;
19
+ exports.tocSection = {
20
+ content: 'section_title (toc_element | placeholder_element)',
21
+ attrs: {
22
+ id: { default: '' },
23
+ dataTracked: { default: null },
24
+ },
25
+ group: 'block sections',
26
+ selectable: false,
27
+ parseDOM: [
28
+ {
29
+ tag: 'section.toc',
30
+ },
31
+ ],
32
+ toDOM: (node) => {
33
+ const tocSectioNode = node;
34
+ return [
35
+ 'section',
36
+ {
37
+ id: tocSectioNode.attrs.id,
38
+ class: 'toc',
39
+ spellcheck: 'false',
40
+ },
41
+ 0,
42
+ ];
43
+ },
44
+ };
45
+ const isTOCSectionNode = (node) => node.type === node.type.schema.nodes.toc_section;
46
+ exports.isTOCSectionNode = isTOCSectionNode;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const uuid_1 = require("uuid");
19
+ const supportedCommands = [];
20
+ Object.defineProperty(document, 'queryCommandSupported', {
21
+ value: (cmd) => supportedCommands.includes(cmd),
22
+ });
23
+ Object.defineProperty(document, 'execCommand', {
24
+ value: (cmd) => supportedCommands.includes(cmd),
25
+ });
26
+ if (!window.URL.createObjectURL) {
27
+ Object.defineProperty(window.URL, 'createObjectURL', {
28
+ value: jest.fn(() => 'blob:https://localhost/' + (0, uuid_1.v4)()),
29
+ });
30
+ }
@@ -0,0 +1,305 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.buildElementsOrder = exports.auxiliaryObjectTypes = exports.buildUserFootNote = exports.buildStatusLabel = exports.buildJournal = exports.buildSubmission = exports.buildAttribution = exports.buildInlineStyle = exports.buildContributorRole = exports.buildContribution = exports.buildHighlightMarker = exports.buildHighlight = exports.buildColor = exports.buildParagraph = exports.buildSection = exports.buildCorresp = exports.buildFootnotesOrder = exports.buildFootnote = exports.buildInlineMathFragment = exports.buildValidation = exports.buildNote = exports.buildComment = exports.buildUserProfileAffiliation = exports.buildSupplementaryMaterial = exports.buildAffiliation = exports.buildFigure = exports.buildLibraryCollection = exports.buildManuscriptKeyword = exports.buildKeywordGroup = exports.buildKeyword = exports.buildCitation = exports.buildEmbeddedCitationItem = exports.buildAuxiliaryObjectReference = exports.buildBibliographicDate = exports.buildBibliographicName = exports.buildBibliographyItem = exports.buildContributor = exports.buildManuscript = exports.buildProject = exports.DEFAULT_PAGE_LAYOUT = exports.DEFAULT_BUNDLE = void 0;
22
+ const manuscripts_json_schema_1 = require("@manuscripts/manuscripts-json-schema");
23
+ const w3c_xmlserializer_1 = __importDefault(require("w3c-xmlserializer"));
24
+ const schema_1 = require("../schema");
25
+ const id_1 = require("./id");
26
+ const timestamp_1 = require("./timestamp");
27
+ exports.DEFAULT_BUNDLE = 'MPBundle:www-zotero-org-styles-nature';
28
+ exports.DEFAULT_PAGE_LAYOUT = 'MPPageLayout:defaultA4';
29
+ const buildProject = (owner) => ({
30
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Project),
31
+ objectType: manuscripts_json_schema_1.ObjectTypes.Project,
32
+ owners: [owner],
33
+ writers: [],
34
+ viewers: [],
35
+ title: '',
36
+ });
37
+ exports.buildProject = buildProject;
38
+ const buildManuscript = (title = '') => ({
39
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Manuscript),
40
+ objectType: manuscripts_json_schema_1.ObjectTypes.Manuscript,
41
+ title,
42
+ });
43
+ exports.buildManuscript = buildManuscript;
44
+ const buildContributor = (bibliographicName, role = 'author', priority = 0, userID, invitationID) => ({
45
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Contributor),
46
+ objectType: manuscripts_json_schema_1.ObjectTypes.Contributor,
47
+ priority,
48
+ role,
49
+ affiliations: [],
50
+ bibliographicName: (0, exports.buildBibliographicName)(bibliographicName),
51
+ userID,
52
+ invitationID,
53
+ });
54
+ exports.buildContributor = buildContributor;
55
+ const buildBibliographyItem = (data) => (Object.assign(Object.assign({}, data), { type: data.type || 'article-journal', _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.BibliographyItem), objectType: manuscripts_json_schema_1.ObjectTypes.BibliographyItem }));
56
+ exports.buildBibliographyItem = buildBibliographyItem;
57
+ const buildBibliographicName = (data) => (Object.assign(Object.assign({}, data), { _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.BibliographicName), objectType: manuscripts_json_schema_1.ObjectTypes.BibliographicName }));
58
+ exports.buildBibliographicName = buildBibliographicName;
59
+ const buildBibliographicDate = (data) => (Object.assign(Object.assign({}, data), { _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.BibliographicDate), objectType: manuscripts_json_schema_1.ObjectTypes.BibliographicDate }));
60
+ exports.buildBibliographicDate = buildBibliographicDate;
61
+ const buildAuxiliaryObjectReference = (containingObject, rids) => {
62
+ const auxiliaryObjectReference = {
63
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.AuxiliaryObjectReference),
64
+ objectType: manuscripts_json_schema_1.ObjectTypes.AuxiliaryObjectReference,
65
+ containingObject: containingObject || undefined,
66
+ };
67
+ if (rids.length < 2) {
68
+ Object.assign(auxiliaryObjectReference, { referencedObject: rids[0] });
69
+ }
70
+ else {
71
+ Object.assign(auxiliaryObjectReference, { referencedObjects: rids });
72
+ }
73
+ return auxiliaryObjectReference;
74
+ };
75
+ exports.buildAuxiliaryObjectReference = buildAuxiliaryObjectReference;
76
+ const buildEmbeddedCitationItem = (bibliographyItem) => ({
77
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.CitationItem),
78
+ objectType: manuscripts_json_schema_1.ObjectTypes.CitationItem,
79
+ bibliographyItem,
80
+ });
81
+ exports.buildEmbeddedCitationItem = buildEmbeddedCitationItem;
82
+ const buildCitation = (containingObject, embeddedCitationItems) => ({
83
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Citation),
84
+ objectType: manuscripts_json_schema_1.ObjectTypes.Citation,
85
+ containingObject: containingObject || undefined,
86
+ embeddedCitationItems: embeddedCitationItems.map(exports.buildEmbeddedCitationItem),
87
+ });
88
+ exports.buildCitation = buildCitation;
89
+ const buildKeyword = (name) => ({
90
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Keyword),
91
+ objectType: manuscripts_json_schema_1.ObjectTypes.Keyword,
92
+ name,
93
+ });
94
+ exports.buildKeyword = buildKeyword;
95
+ const buildKeywordGroup = (attributes) => (Object.assign(Object.assign(Object.assign({ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.KeywordGroup), objectType: manuscripts_json_schema_1.ObjectTypes.KeywordGroup }, (attributes.type && { type: attributes.type })), (attributes.title && { title: attributes.title })), (attributes.label && { label: attributes.label })));
96
+ exports.buildKeywordGroup = buildKeywordGroup;
97
+ const buildManuscriptKeyword = (name) => ({
98
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.ManuscriptKeyword),
99
+ objectType: manuscripts_json_schema_1.ObjectTypes.ManuscriptKeyword,
100
+ name,
101
+ });
102
+ exports.buildManuscriptKeyword = buildManuscriptKeyword;
103
+ const buildLibraryCollection = (owner, name) => ({
104
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.LibraryCollection),
105
+ objectType: manuscripts_json_schema_1.ObjectTypes.LibraryCollection,
106
+ owners: [owner],
107
+ writers: [],
108
+ viewers: [],
109
+ name,
110
+ });
111
+ exports.buildLibraryCollection = buildLibraryCollection;
112
+ const buildFigure = (blob) => ({
113
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Figure),
114
+ objectType: manuscripts_json_schema_1.ObjectTypes.Figure,
115
+ contentType: blob.type,
116
+ src: window.URL.createObjectURL(blob),
117
+ attachment: {
118
+ id: 'image',
119
+ type: blob.type,
120
+ data: blob,
121
+ },
122
+ });
123
+ exports.buildFigure = buildFigure;
124
+ const buildAffiliation = (institution, priority = 0) => ({
125
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Affiliation),
126
+ objectType: manuscripts_json_schema_1.ObjectTypes.Affiliation,
127
+ institution,
128
+ priority,
129
+ });
130
+ exports.buildAffiliation = buildAffiliation;
131
+ const buildSupplementaryMaterial = (title, href) => ({
132
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Supplement),
133
+ objectType: manuscripts_json_schema_1.ObjectTypes.Supplement,
134
+ title,
135
+ href,
136
+ });
137
+ exports.buildSupplementaryMaterial = buildSupplementaryMaterial;
138
+ const buildUserProfileAffiliation = (institution, priority = 0) => ({
139
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.UserProfileAffiliation),
140
+ objectType: manuscripts_json_schema_1.ObjectTypes.UserProfileAffiliation,
141
+ institution,
142
+ priority,
143
+ });
144
+ exports.buildUserProfileAffiliation = buildUserProfileAffiliation;
145
+ const buildComment = (target, contents = '', selector, contributions, annotationColor) => ({
146
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.CommentAnnotation),
147
+ objectType: manuscripts_json_schema_1.ObjectTypes.CommentAnnotation,
148
+ target,
149
+ selector,
150
+ contents,
151
+ contributions,
152
+ annotationColor,
153
+ });
154
+ exports.buildComment = buildComment;
155
+ const buildNote = (target, source, contents = '') => ({
156
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.ManuscriptNote),
157
+ objectType: manuscripts_json_schema_1.ObjectTypes.ManuscriptNote,
158
+ target,
159
+ source,
160
+ contents,
161
+ });
162
+ exports.buildNote = buildNote;
163
+ const buildValidation = (results) => ({
164
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.RequirementsValidation),
165
+ objectType: manuscripts_json_schema_1.ObjectTypes.RequirementsValidation,
166
+ results,
167
+ });
168
+ exports.buildValidation = buildValidation;
169
+ const buildInlineMathFragment = (containingObject, TeXRepresentation) => ({
170
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.InlineMathFragment),
171
+ objectType: manuscripts_json_schema_1.ObjectTypes.InlineMathFragment,
172
+ containingObject: containingObject || undefined,
173
+ TeXRepresentation,
174
+ });
175
+ exports.buildInlineMathFragment = buildInlineMathFragment;
176
+ const buildFootnote = (containingObject, contents, kind = 'footnote') => ({
177
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Footnote),
178
+ objectType: manuscripts_json_schema_1.ObjectTypes.Footnote,
179
+ containingObject: containingObject || undefined,
180
+ contents,
181
+ kind,
182
+ });
183
+ exports.buildFootnote = buildFootnote;
184
+ const buildFootnotesOrder = (footnotesList) => ({
185
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.FootnotesOrder),
186
+ objectType: manuscripts_json_schema_1.ObjectTypes.FootnotesOrder,
187
+ footnotesList,
188
+ });
189
+ exports.buildFootnotesOrder = buildFootnotesOrder;
190
+ const buildCorresp = (contents) => ({
191
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Corresponding),
192
+ objectType: manuscripts_json_schema_1.ObjectTypes.Corresponding,
193
+ contents,
194
+ });
195
+ exports.buildCorresp = buildCorresp;
196
+ const buildSection = (priority = 0, path = []) => {
197
+ const id = (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Section);
198
+ return {
199
+ _id: id,
200
+ objectType: manuscripts_json_schema_1.ObjectTypes.Section,
201
+ priority,
202
+ path: path.concat(id),
203
+ };
204
+ };
205
+ exports.buildSection = buildSection;
206
+ const buildParagraph = (placeholderInnerHTML) => {
207
+ const _id = (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.ParagraphElement);
208
+ const element = document.createElementNS('http://www.w3.org/1999/xhtml', 'p');
209
+ element.setAttribute('id', _id);
210
+ element.setAttribute('class', 'MPElement');
211
+ if (placeholderInnerHTML) {
212
+ element.setAttribute('data-placeholder-text', placeholderInnerHTML);
213
+ }
214
+ const contents = (0, w3c_xmlserializer_1.default)(element);
215
+ return {
216
+ _id,
217
+ objectType: manuscripts_json_schema_1.ObjectTypes.ParagraphElement,
218
+ elementType: 'p',
219
+ contents,
220
+ placeholderInnerHTML,
221
+ };
222
+ };
223
+ exports.buildParagraph = buildParagraph;
224
+ const buildColor = (value, priority) => ({
225
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Color),
226
+ objectType: manuscripts_json_schema_1.ObjectTypes.Color,
227
+ priority,
228
+ value,
229
+ });
230
+ exports.buildColor = buildColor;
231
+ const buildHighlight = () => ({
232
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Highlight),
233
+ objectType: manuscripts_json_schema_1.ObjectTypes.Highlight,
234
+ });
235
+ exports.buildHighlight = buildHighlight;
236
+ const buildHighlightMarker = (highlightID, start, offset, field) => ({
237
+ highlightID,
238
+ objectType: manuscripts_json_schema_1.ObjectTypes.HighlightMarker,
239
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.HighlightMarker),
240
+ start,
241
+ offset,
242
+ field,
243
+ });
244
+ exports.buildHighlightMarker = buildHighlightMarker;
245
+ const buildContribution = (profileID) => ({
246
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Contribution),
247
+ objectType: manuscripts_json_schema_1.ObjectTypes.Contribution,
248
+ profileID,
249
+ timestamp: (0, timestamp_1.timestamp)(),
250
+ });
251
+ exports.buildContribution = buildContribution;
252
+ const buildContributorRole = (name) => ({
253
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.ContributorRole),
254
+ objectType: manuscripts_json_schema_1.ObjectTypes.ContributorRole,
255
+ name,
256
+ });
257
+ exports.buildContributorRole = buildContributorRole;
258
+ const buildInlineStyle = (priority, title) => ({
259
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.InlineStyle),
260
+ objectType: manuscripts_json_schema_1.ObjectTypes.InlineStyle,
261
+ priority,
262
+ title,
263
+ });
264
+ exports.buildInlineStyle = buildInlineStyle;
265
+ const buildAttribution = () => ({
266
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Attribution),
267
+ objectType: manuscripts_json_schema_1.ObjectTypes.Attribution,
268
+ });
269
+ exports.buildAttribution = buildAttribution;
270
+ const buildSubmission = () => ({
271
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Submission),
272
+ objectType: manuscripts_json_schema_1.ObjectTypes.Submission,
273
+ });
274
+ exports.buildSubmission = buildSubmission;
275
+ const buildJournal = () => ({
276
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.Journal),
277
+ objectType: manuscripts_json_schema_1.ObjectTypes.Journal,
278
+ });
279
+ exports.buildJournal = buildJournal;
280
+ const buildStatusLabel = (name) => ({
281
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.StatusLabel),
282
+ objectType: manuscripts_json_schema_1.ObjectTypes.StatusLabel,
283
+ name,
284
+ });
285
+ exports.buildStatusLabel = buildStatusLabel;
286
+ const buildUserFootNote = (noteId, content) => ({
287
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.UserProfileFootNote),
288
+ objectType: manuscripts_json_schema_1.ObjectTypes.UserProfileFootNote,
289
+ noteId,
290
+ content,
291
+ });
292
+ exports.buildUserFootNote = buildUserFootNote;
293
+ exports.auxiliaryObjectTypes = new Set([
294
+ schema_1.schema.nodes.figure_element,
295
+ schema_1.schema.nodes.table_element,
296
+ schema_1.schema.nodes.equation_element,
297
+ schema_1.schema.nodes.listing_element,
298
+ ]);
299
+ const buildElementsOrder = (elementType) => ({
300
+ _id: (0, id_1.generateID)(manuscripts_json_schema_1.ObjectTypes.ElementsOrder),
301
+ objectType: manuscripts_json_schema_1.ObjectTypes.ElementsOrder,
302
+ elementType: elementType,
303
+ elements: [],
304
+ });
305
+ exports.buildElementsOrder = buildElementsOrder;