@fiduswriter/document 0.1.0-alpha.2 → 0.1.0-alpha.4

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 (410) hide show
  1. package/README.md +22 -1
  2. package/dist/bibliography/common.d.ts +92 -0
  3. package/dist/bibliography/common.d.ts.map +1 -0
  4. package/dist/bibliography/common.js +85 -0
  5. package/dist/bibliography/common.js.map +1 -0
  6. package/dist/bibliography/csl_bib.d.ts +3 -0
  7. package/dist/bibliography/csl_bib.d.ts.map +1 -0
  8. package/dist/bibliography/csl_bib.js +131 -0
  9. package/dist/bibliography/csl_bib.js.map +1 -0
  10. package/dist/citations/citeproc_sys.d.ts +13 -0
  11. package/dist/citations/citeproc_sys.d.ts.map +1 -0
  12. package/dist/citations/citeproc_sys.js +43 -0
  13. package/dist/citations/citeproc_sys.js.map +1 -0
  14. package/dist/citations/format.d.ts +23 -0
  15. package/dist/citations/format.d.ts.map +1 -0
  16. package/dist/citations/format.js +161 -0
  17. package/dist/citations/format.js.map +1 -0
  18. package/dist/editor/e2ee/encryptor.d.ts +123 -0
  19. package/dist/editor/e2ee/encryptor.d.ts.map +1 -0
  20. package/dist/editor/e2ee/encryptor.js +201 -0
  21. package/dist/editor/e2ee/encryptor.js.map +1 -0
  22. package/dist/exporter/docx/citations.d.ts +21 -0
  23. package/dist/exporter/docx/citations.d.ts.map +1 -0
  24. package/dist/exporter/docx/citations.js +154 -0
  25. package/dist/exporter/docx/citations.js.map +1 -0
  26. package/dist/exporter/docx/comments.d.ts +18 -0
  27. package/dist/exporter/docx/comments.d.ts.map +1 -0
  28. package/dist/exporter/docx/comments.js +137 -0
  29. package/dist/exporter/docx/comments.js.map +1 -0
  30. package/dist/exporter/docx/footnotes.d.ts +42 -0
  31. package/dist/exporter/docx/footnotes.d.ts.map +1 -0
  32. package/dist/exporter/docx/footnotes.js +182 -0
  33. package/dist/exporter/docx/footnotes.js.map +1 -0
  34. package/dist/exporter/docx/images.d.ts +14 -0
  35. package/dist/exporter/docx/images.d.ts.map +1 -0
  36. package/dist/exporter/docx/images.js +86 -0
  37. package/dist/exporter/docx/images.js.map +1 -0
  38. package/dist/exporter/docx/index.d.ts +22 -0
  39. package/dist/exporter/docx/index.d.ts.map +1 -0
  40. package/dist/exporter/docx/index.js +107 -0
  41. package/dist/exporter/docx/index.js.map +1 -0
  42. package/dist/exporter/docx/lists.d.ts +33 -0
  43. package/dist/exporter/docx/lists.d.ts.map +1 -0
  44. package/dist/exporter/docx/lists.js +229 -0
  45. package/dist/exporter/docx/lists.js.map +1 -0
  46. package/dist/exporter/docx/math.d.ts +13 -0
  47. package/dist/exporter/docx/math.d.ts.map +1 -0
  48. package/dist/exporter/docx/math.js +42 -0
  49. package/dist/exporter/docx/math.js.map +1 -0
  50. package/dist/exporter/docx/metadata.d.ts +14 -0
  51. package/dist/exporter/docx/metadata.d.ts.map +1 -0
  52. package/dist/exporter/docx/metadata.js +239 -0
  53. package/dist/exporter/docx/metadata.js.map +1 -0
  54. package/dist/exporter/docx/rels.d.ts +25 -0
  55. package/dist/exporter/docx/rels.d.ts.map +1 -0
  56. package/dist/exporter/docx/rels.js +168 -0
  57. package/dist/exporter/docx/rels.js.map +1 -0
  58. package/dist/exporter/docx/render.d.ts +20 -0
  59. package/dist/exporter/docx/render.d.ts.map +1 -0
  60. package/dist/exporter/docx/render.js +774 -0
  61. package/dist/exporter/docx/render.js.map +1 -0
  62. package/dist/exporter/docx/richtext.d.ts +25 -0
  63. package/dist/exporter/docx/richtext.d.ts.map +1 -0
  64. package/dist/exporter/docx/richtext.js +1052 -0
  65. package/dist/exporter/docx/richtext.js.map +1 -0
  66. package/dist/exporter/docx/tables.d.ts +14 -0
  67. package/dist/exporter/docx/tables.d.ts.map +1 -0
  68. package/dist/exporter/docx/tables.js +109 -0
  69. package/dist/exporter/docx/tables.js.map +1 -0
  70. package/dist/exporter/docx/tools.d.ts +3 -0
  71. package/dist/exporter/docx/tools.d.ts.map +1 -0
  72. package/dist/exporter/docx/tools.js +48 -0
  73. package/dist/exporter/docx/tools.js.map +1 -0
  74. package/dist/exporter/epub/index.d.ts +11 -0
  75. package/dist/exporter/epub/index.d.ts.map +1 -0
  76. package/dist/exporter/epub/index.js +102 -0
  77. package/dist/exporter/epub/index.js.map +1 -0
  78. package/dist/exporter/epub/templates.d.ts +32 -0
  79. package/dist/exporter/epub/templates.d.ts.map +1 -0
  80. package/dist/exporter/epub/templates.js +95 -0
  81. package/dist/exporter/epub/templates.js.map +1 -0
  82. package/dist/exporter/epub/tools.d.ts +5 -0
  83. package/dist/exporter/epub/tools.d.ts.map +1 -0
  84. package/dist/exporter/epub/tools.js +81 -0
  85. package/dist/exporter/epub/tools.js.map +1 -0
  86. package/dist/exporter/html/citations.d.ts +27 -0
  87. package/dist/exporter/html/citations.d.ts.map +1 -0
  88. package/dist/exporter/html/citations.js +91 -0
  89. package/dist/exporter/html/citations.js.map +1 -0
  90. package/dist/exporter/html/convert.d.ts +100 -0
  91. package/dist/exporter/html/convert.d.ts.map +1 -0
  92. package/dist/exporter/html/convert.js +718 -0
  93. package/dist/exporter/html/convert.js.map +1 -0
  94. package/dist/exporter/html/index.d.ts +61 -0
  95. package/dist/exporter/html/index.d.ts.map +1 -0
  96. package/dist/exporter/html/index.js +134 -0
  97. package/dist/exporter/html/index.js.map +1 -0
  98. package/dist/exporter/html/templates.d.ts +10 -0
  99. package/dist/exporter/html/templates.d.ts.map +1 -0
  100. package/dist/exporter/html/templates.js +21 -0
  101. package/dist/exporter/html/templates.js.map +1 -0
  102. package/dist/exporter/html/tools.d.ts +2 -0
  103. package/dist/exporter/html/tools.d.ts.map +1 -0
  104. package/dist/exporter/html/tools.js +49 -0
  105. package/dist/exporter/html/tools.js.map +1 -0
  106. package/dist/exporter/jats/bibliography.d.ts +2 -0
  107. package/dist/exporter/jats/bibliography.d.ts.map +1 -0
  108. package/dist/exporter/jats/bibliography.js +153 -0
  109. package/dist/exporter/jats/bibliography.js.map +1 -0
  110. package/dist/exporter/jats/citations.d.ts +14 -0
  111. package/dist/exporter/jats/citations.d.ts.map +1 -0
  112. package/dist/exporter/jats/citations.js +83 -0
  113. package/dist/exporter/jats/citations.js.map +1 -0
  114. package/dist/exporter/jats/convert.d.ts +45 -0
  115. package/dist/exporter/jats/convert.d.ts.map +1 -0
  116. package/dist/exporter/jats/convert.js +799 -0
  117. package/dist/exporter/jats/convert.js.map +1 -0
  118. package/dist/exporter/jats/index.d.ts +19 -0
  119. package/dist/exporter/jats/index.d.ts.map +1 -0
  120. package/dist/exporter/jats/index.js +66 -0
  121. package/dist/exporter/jats/index.js.map +1 -0
  122. package/dist/exporter/jats/templates.d.ts +16 -0
  123. package/dist/exporter/jats/templates.d.ts.map +1 -0
  124. package/dist/exporter/jats/templates.js +25 -0
  125. package/dist/exporter/jats/templates.js.map +1 -0
  126. package/dist/exporter/jats/text.d.ts +3 -0
  127. package/dist/exporter/jats/text.d.ts.map +1 -0
  128. package/dist/exporter/jats/text.js +72 -0
  129. package/dist/exporter/jats/text.js.map +1 -0
  130. package/dist/exporter/latex/convert.d.ts +27 -0
  131. package/dist/exporter/latex/convert.d.ts.map +1 -0
  132. package/dist/exporter/latex/convert.js +865 -0
  133. package/dist/exporter/latex/convert.js.map +1 -0
  134. package/dist/exporter/latex/escape_latex.d.ts +2 -0
  135. package/dist/exporter/latex/escape_latex.d.ts.map +1 -0
  136. package/dist/exporter/latex/escape_latex.js +20 -0
  137. package/dist/exporter/latex/escape_latex.js.map +1 -0
  138. package/dist/exporter/latex/index.d.ts +23 -0
  139. package/dist/exporter/latex/index.d.ts.map +1 -0
  140. package/dist/exporter/latex/index.js +57 -0
  141. package/dist/exporter/latex/index.js.map +1 -0
  142. package/dist/exporter/latex/readme.d.ts +2 -0
  143. package/dist/exporter/latex/readme.d.ts.map +1 -0
  144. package/dist/exporter/latex/readme.js +23 -0
  145. package/dist/exporter/latex/readme.js.map +1 -0
  146. package/dist/exporter/native/shrink.d.ts +21 -0
  147. package/dist/exporter/native/shrink.d.ts.map +1 -0
  148. package/dist/exporter/native/shrink.js +115 -0
  149. package/dist/exporter/native/shrink.js.map +1 -0
  150. package/dist/exporter/odt/citations.d.ts +18 -0
  151. package/dist/exporter/odt/citations.d.ts.map +1 -0
  152. package/dist/exporter/odt/citations.js +87 -0
  153. package/dist/exporter/odt/citations.js.map +1 -0
  154. package/dist/exporter/odt/footnotes.d.ts +25 -0
  155. package/dist/exporter/odt/footnotes.d.ts.map +1 -0
  156. package/dist/exporter/odt/footnotes.js +112 -0
  157. package/dist/exporter/odt/footnotes.js.map +1 -0
  158. package/dist/exporter/odt/images.d.ts +13 -0
  159. package/dist/exporter/odt/images.d.ts.map +1 -0
  160. package/dist/exporter/odt/images.js +98 -0
  161. package/dist/exporter/odt/images.js.map +1 -0
  162. package/dist/exporter/odt/index.d.ts +23 -0
  163. package/dist/exporter/odt/index.d.ts.map +1 -0
  164. package/dist/exporter/odt/index.js +99 -0
  165. package/dist/exporter/odt/index.js.map +1 -0
  166. package/dist/exporter/odt/math.d.ts +13 -0
  167. package/dist/exporter/odt/math.d.ts.map +1 -0
  168. package/dist/exporter/odt/math.js +48 -0
  169. package/dist/exporter/odt/math.js.map +1 -0
  170. package/dist/exporter/odt/metadata.d.ts +14 -0
  171. package/dist/exporter/odt/metadata.d.ts.map +1 -0
  172. package/dist/exporter/odt/metadata.js +203 -0
  173. package/dist/exporter/odt/metadata.js.map +1 -0
  174. package/dist/exporter/odt/render.d.ts +24 -0
  175. package/dist/exporter/odt/render.d.ts.map +1 -0
  176. package/dist/exporter/odt/render.js +644 -0
  177. package/dist/exporter/odt/render.js.map +1 -0
  178. package/dist/exporter/odt/richtext.d.ts +22 -0
  179. package/dist/exporter/odt/richtext.d.ts.map +1 -0
  180. package/dist/exporter/odt/richtext.js +728 -0
  181. package/dist/exporter/odt/richtext.js.map +1 -0
  182. package/dist/exporter/odt/styles.d.ts +33 -0
  183. package/dist/exporter/odt/styles.d.ts.map +1 -0
  184. package/dist/exporter/odt/styles.js +348 -0
  185. package/dist/exporter/odt/styles.js.map +1 -0
  186. package/dist/exporter/odt/track.d.ts +11 -0
  187. package/dist/exporter/odt/track.d.ts.map +1 -0
  188. package/dist/exporter/odt/track.js +59 -0
  189. package/dist/exporter/odt/track.js.map +1 -0
  190. package/dist/exporter/pandoc/citations.d.ts +17 -0
  191. package/dist/exporter/pandoc/citations.d.ts.map +1 -0
  192. package/dist/exporter/pandoc/citations.js +85 -0
  193. package/dist/exporter/pandoc/citations.js.map +1 -0
  194. package/dist/exporter/pandoc/convert.d.ts +38 -0
  195. package/dist/exporter/pandoc/convert.d.ts.map +1 -0
  196. package/dist/exporter/pandoc/convert.js +881 -0
  197. package/dist/exporter/pandoc/convert.js.map +1 -0
  198. package/dist/exporter/pandoc/index.d.ts +38 -0
  199. package/dist/exporter/pandoc/index.d.ts.map +1 -0
  200. package/dist/exporter/pandoc/index.js +67 -0
  201. package/dist/exporter/pandoc/index.js.map +1 -0
  202. package/dist/exporter/pandoc/readme.d.ts +2 -0
  203. package/dist/exporter/pandoc/readme.d.ts.map +1 -0
  204. package/dist/exporter/pandoc/readme.js +9 -0
  205. package/dist/exporter/pandoc/readme.js.map +1 -0
  206. package/dist/exporter/pandoc/tools.d.ts +6 -0
  207. package/dist/exporter/pandoc/tools.d.ts.map +1 -0
  208. package/dist/exporter/pandoc/tools.js +52 -0
  209. package/dist/exporter/pandoc/tools.js.map +1 -0
  210. package/dist/exporter/print/index.d.ts +9 -0
  211. package/dist/exporter/print/index.d.ts.map +1 -0
  212. package/dist/exporter/print/index.js +140 -0
  213. package/dist/exporter/print/index.js.map +1 -0
  214. package/dist/exporter/tools/doc_content.d.ts +7 -0
  215. package/dist/exporter/tools/doc_content.d.ts.map +1 -0
  216. package/dist/exporter/tools/doc_content.js +129 -0
  217. package/dist/exporter/tools/doc_content.js.map +1 -0
  218. package/dist/exporter/tools/file.d.ts +2 -0
  219. package/dist/exporter/tools/file.d.ts.map +1 -0
  220. package/dist/exporter/tools/file.js +10 -0
  221. package/dist/exporter/tools/file.js.map +1 -0
  222. package/dist/exporter/tools/json.d.ts +7 -0
  223. package/dist/exporter/tools/json.d.ts.map +1 -0
  224. package/dist/exporter/tools/json.js +82 -0
  225. package/dist/exporter/tools/json.js.map +1 -0
  226. package/dist/exporter/tools/svg.d.ts +2 -0
  227. package/dist/exporter/tools/svg.d.ts.map +1 -0
  228. package/dist/exporter/tools/svg.js +26 -0
  229. package/dist/exporter/tools/svg.js.map +1 -0
  230. package/dist/exporter/tools/xml.d.ts +41 -0
  231. package/dist/exporter/tools/xml.d.ts.map +1 -0
  232. package/dist/exporter/tools/xml.js +440 -0
  233. package/dist/exporter/tools/xml.js.map +1 -0
  234. package/dist/exporter/tools/xml_zip.d.ts +20 -0
  235. package/dist/exporter/tools/xml_zip.d.ts.map +1 -0
  236. package/dist/exporter/tools/xml_zip.js +86 -0
  237. package/dist/exporter/tools/xml_zip.js.map +1 -0
  238. package/dist/exporter/tools/zip.d.ts +21 -0
  239. package/dist/exporter/tools/zip.d.ts.map +1 -0
  240. package/dist/exporter/tools/zip.js +71 -0
  241. package/dist/exporter/tools/zip.js.map +1 -0
  242. package/dist/exporter/tools/zotero_csl.d.ts +10 -0
  243. package/dist/exporter/tools/zotero_csl.d.ts.map +1 -0
  244. package/dist/exporter/tools/zotero_csl.js +78 -0
  245. package/dist/exporter/tools/zotero_csl.js.map +1 -0
  246. package/dist/importer/citations.d.ts +25 -0
  247. package/dist/importer/citations.d.ts.map +1 -0
  248. package/dist/importer/citations.js +116 -0
  249. package/dist/importer/citations.js.map +1 -0
  250. package/dist/importer/docx/citations.d.ts +65 -0
  251. package/dist/importer/docx/citations.d.ts.map +1 -0
  252. package/dist/importer/docx/citations.js +106 -0
  253. package/dist/importer/docx/citations.js.map +1 -0
  254. package/dist/importer/docx/convert.d.ts +228 -0
  255. package/dist/importer/docx/convert.d.ts.map +1 -0
  256. package/dist/importer/docx/convert.js +1226 -0
  257. package/dist/importer/docx/convert.js.map +1 -0
  258. package/dist/importer/docx/helpers.d.ts +2 -0
  259. package/dist/importer/docx/helpers.d.ts.map +1 -0
  260. package/dist/importer/docx/helpers.js +10 -0
  261. package/dist/importer/docx/helpers.js.map +1 -0
  262. package/dist/importer/docx/omml2mathml.d.ts +7 -0
  263. package/dist/importer/docx/omml2mathml.d.ts.map +1 -0
  264. package/dist/importer/docx/omml2mathml.js +1239 -0
  265. package/dist/importer/docx/omml2mathml.js.map +1 -0
  266. package/dist/importer/docx/parse.d.ts +205 -0
  267. package/dist/importer/docx/parse.d.ts.map +1 -0
  268. package/dist/importer/docx/parse.js +663 -0
  269. package/dist/importer/docx/parse.js.map +1 -0
  270. package/dist/importer/native/get_images.d.ts +11 -0
  271. package/dist/importer/native/get_images.d.ts.map +1 -0
  272. package/dist/importer/native/get_images.js +64 -0
  273. package/dist/importer/native/get_images.js.map +1 -0
  274. package/dist/importer/native/update.d.ts +6 -0
  275. package/dist/importer/native/update.d.ts.map +1 -0
  276. package/dist/importer/native/update.js +26 -0
  277. package/dist/importer/native/update.js.map +1 -0
  278. package/dist/importer/odt/citations.d.ts +47 -0
  279. package/dist/importer/odt/citations.d.ts.map +1 -0
  280. package/dist/importer/odt/citations.js +79 -0
  281. package/dist/importer/odt/citations.js.map +1 -0
  282. package/dist/importer/odt/convert.d.ts +330 -0
  283. package/dist/importer/odt/convert.d.ts.map +1 -0
  284. package/dist/importer/odt/convert.js +1506 -0
  285. package/dist/importer/odt/convert.js.map +1 -0
  286. package/dist/importer/pandoc/convert.d.ts +84 -0
  287. package/dist/importer/pandoc/convert.d.ts.map +1 -0
  288. package/dist/importer/pandoc/convert.js +777 -0
  289. package/dist/importer/pandoc/convert.js.map +1 -0
  290. package/dist/importer/pandoc/helpers.d.ts +4 -0
  291. package/dist/importer/pandoc/helpers.d.ts.map +1 -0
  292. package/dist/importer/pandoc/helpers.js +75 -0
  293. package/dist/importer/pandoc/helpers.js.map +1 -0
  294. package/dist/importer/zip_analyzer.d.ts +25 -0
  295. package/dist/importer/zip_analyzer.d.ts.map +1 -0
  296. package/dist/importer/zip_analyzer.js +84 -0
  297. package/dist/importer/zip_analyzer.js.map +1 -0
  298. package/dist/index.d.ts +2 -0
  299. package/dist/index.d.ts.map +1 -0
  300. package/dist/index.js +2 -0
  301. package/dist/index.js.map +1 -0
  302. package/dist/mathlive/opf_includes.d.ts +2 -0
  303. package/dist/mathlive/opf_includes.d.ts.map +1 -0
  304. package/dist/mathlive/opf_includes.js +25 -0
  305. package/dist/mathlive/opf_includes.js.map +1 -0
  306. package/dist/schema/common/annotate.d.ts +59 -0
  307. package/dist/schema/common/annotate.d.ts.map +1 -0
  308. package/dist/schema/common/annotate.js +75 -0
  309. package/dist/schema/common/annotate.js.map +1 -0
  310. package/dist/schema/common/base.d.ts +109 -0
  311. package/dist/schema/common/base.d.ts.map +1 -0
  312. package/dist/schema/common/base.js +109 -0
  313. package/dist/schema/common/base.js.map +1 -0
  314. package/dist/schema/common/citation.d.ts +29 -0
  315. package/dist/schema/common/citation.d.ts.map +1 -0
  316. package/dist/schema/common/citation.js +62 -0
  317. package/dist/schema/common/citation.js.map +1 -0
  318. package/dist/schema/common/equation.d.ts +18 -0
  319. package/dist/schema/common/equation.d.ts.map +1 -0
  320. package/dist/schema/common/equation.js +32 -0
  321. package/dist/schema/common/equation.js.map +1 -0
  322. package/dist/schema/common/figure.d.ts +108 -0
  323. package/dist/schema/common/figure.d.ts.map +1 -0
  324. package/dist/schema/common/figure.js +176 -0
  325. package/dist/schema/common/figure.js.map +1 -0
  326. package/dist/schema/common/heading.d.ts +33 -0
  327. package/dist/schema/common/heading.d.ts.map +1 -0
  328. package/dist/schema/common/heading.js +41 -0
  329. package/dist/schema/common/heading.js.map +1 -0
  330. package/dist/schema/common/index.d.ts +11 -0
  331. package/dist/schema/common/index.d.ts.map +1 -0
  332. package/dist/schema/common/index.js +11 -0
  333. package/dist/schema/common/index.js.map +1 -0
  334. package/dist/schema/common/list.d.ts +83 -0
  335. package/dist/schema/common/list.d.ts.map +1 -0
  336. package/dist/schema/common/list.js +92 -0
  337. package/dist/schema/common/list.js.map +1 -0
  338. package/dist/schema/common/reference.d.ts +78 -0
  339. package/dist/schema/common/reference.d.ts.map +1 -0
  340. package/dist/schema/common/reference.js +97 -0
  341. package/dist/schema/common/reference.js.map +1 -0
  342. package/dist/schema/common/table.d.ts +92 -0
  343. package/dist/schema/common/table.d.ts.map +1 -0
  344. package/dist/schema/common/table.js +85 -0
  345. package/dist/schema/common/table.js.map +1 -0
  346. package/dist/schema/common/track.d.ts +131 -0
  347. package/dist/schema/common/track.d.ts.map +1 -0
  348. package/dist/schema/common/track.js +184 -0
  349. package/dist/schema/common/track.js.map +1 -0
  350. package/dist/schema/const.d.ts +3 -0
  351. package/dist/schema/const.d.ts.map +1 -0
  352. package/{src → dist}/schema/const.js +3 -3
  353. package/dist/schema/const.js.map +1 -0
  354. package/dist/schema/convert.d.ts +3 -0
  355. package/dist/schema/convert.d.ts.map +1 -0
  356. package/dist/schema/convert.js +1215 -0
  357. package/dist/schema/convert.js.map +1 -0
  358. package/dist/schema/document/content.d.ts +137 -0
  359. package/dist/schema/document/content.d.ts.map +1 -0
  360. package/dist/schema/document/content.js +177 -0
  361. package/dist/schema/document/content.js.map +1 -0
  362. package/dist/schema/document/index.d.ts +879 -0
  363. package/dist/schema/document/index.d.ts.map +1 -0
  364. package/dist/schema/document/index.js +68 -0
  365. package/dist/schema/document/index.js.map +1 -0
  366. package/dist/schema/document/structure.d.ts +273 -0
  367. package/dist/schema/document/structure.d.ts.map +1 -0
  368. package/dist/schema/document/structure.js +445 -0
  369. package/dist/schema/document/structure.js.map +1 -0
  370. package/dist/schema/export.d.ts +880 -0
  371. package/dist/schema/export.d.ts.map +1 -0
  372. package/dist/schema/export.js +16 -0
  373. package/dist/schema/export.js.map +1 -0
  374. package/dist/schema/footnotes.d.ts +499 -0
  375. package/dist/schema/footnotes.d.ts.map +1 -0
  376. package/dist/schema/footnotes.js +88 -0
  377. package/dist/schema/footnotes.js.map +1 -0
  378. package/dist/schema/footnotes_convert.d.ts +5 -0
  379. package/dist/schema/footnotes_convert.d.ts.map +1 -0
  380. package/dist/schema/footnotes_convert.js +26 -0
  381. package/dist/schema/footnotes_convert.js.map +1 -0
  382. package/dist/schema/i18n.d.ts +586 -0
  383. package/dist/schema/i18n.d.ts.map +1 -0
  384. package/dist/schema/i18n.js +585 -0
  385. package/dist/schema/i18n.js.map +1 -0
  386. package/dist/schema/index.d.ts +6 -0
  387. package/dist/schema/index.d.ts.map +1 -0
  388. package/dist/schema/index.js +6 -0
  389. package/dist/schema/index.js.map +1 -0
  390. package/dist/schema/mini_json.d.ts +5 -0
  391. package/dist/schema/mini_json.d.ts.map +1 -0
  392. package/dist/schema/mini_json.js +50 -0
  393. package/dist/schema/mini_json.js.map +1 -0
  394. package/dist/schema/text.d.ts +2 -0
  395. package/dist/schema/text.d.ts.map +1 -0
  396. package/dist/schema/text.js +23 -0
  397. package/dist/schema/text.js.map +1 -0
  398. package/dist/types.d.ts +122 -0
  399. package/dist/types.d.ts.map +1 -0
  400. package/dist/types.js +9 -0
  401. package/dist/types.js.map +1 -0
  402. package/package.json +48 -16
  403. package/scripts/export-schema.js +1 -1
  404. package/src/exporter/tools/{file.js → file.ts} +1 -1
  405. package/src/exporter/tools/{json.js → json.ts} +30 -19
  406. package/src/global.d.ts +11 -0
  407. package/src/schema/const.ts +58 -0
  408. package/src/types.ts +136 -0
  409. package/jest.config.js +0 -24
  410. /package/src/{index.js → index.ts} +0 -0
@@ -0,0 +1,881 @@
1
+ import { convertContributor, convertText } from "./tools.js";
2
+ export class PandocExporterConvert {
3
+ constructor(exporter, imageDB, bibDB, settings) {
4
+ this.exporter = exporter;
5
+ this.settings = settings;
6
+ this.imageDB = imageDB;
7
+ this.bibDB = bibDB;
8
+ this.imageIds = [];
9
+ this.usedBibDB = {};
10
+ this.internalLinks = [];
11
+ this.categoryCounter = {}; // counters for each type of figure (figure/table/photo)
12
+ this.metaData = {
13
+ toc: []
14
+ };
15
+ }
16
+ init(doc) {
17
+ this.preWalkJson(doc);
18
+ const meta = {
19
+ lang: {
20
+ t: "MetaInlines",
21
+ c: [{ t: "Str", c: this.settings.language.split("-")[0] }]
22
+ }
23
+ };
24
+ const json = {
25
+ "pandoc-api-version": [1, 23, 1],
26
+ meta,
27
+ blocks: this.convertContent(doc.content, meta)
28
+ };
29
+ const returnObject = {
30
+ json,
31
+ imageIds: this.imageIds,
32
+ usedBibDB: this.usedBibDB
33
+ };
34
+ return returnObject;
35
+ }
36
+ // Find information for meta tags in header
37
+ preWalkJson(node) {
38
+ switch (node.type) {
39
+ case "heading1":
40
+ case "heading2":
41
+ case "heading3":
42
+ case "heading4":
43
+ case "heading5":
44
+ case "heading6": {
45
+ const level = Number.parseInt(node.type.slice(-1));
46
+ this.metaData.toc.push({
47
+ t: "Header",
48
+ c: [
49
+ level,
50
+ [node.attrs.id || "", [], []],
51
+ this.convertContent(node.content || [])
52
+ ]
53
+ });
54
+ break;
55
+ }
56
+ default:
57
+ break;
58
+ }
59
+ if (node.content) {
60
+ node.content.forEach(child => this.preWalkJson(child));
61
+ }
62
+ }
63
+ // Function to convert Fidus Writer content to Pandoc format
64
+ convertContent(docContent, meta, options = { inFootnote: false, inCode: false }) {
65
+ const pandocContent = [];
66
+ for (const node of docContent) {
67
+ switch (node.type) {
68
+ case "doc":
69
+ // We only handle doc children
70
+ break;
71
+ case "blockquote": {
72
+ pandocContent.push({
73
+ t: "BlockQuote",
74
+ c: this.convertContent(node.content, meta, options)
75
+ });
76
+ break;
77
+ }
78
+ case "bullet_list": {
79
+ const c = [];
80
+ pandocContent.push({
81
+ t: "BulletList",
82
+ c
83
+ });
84
+ if (node.content) {
85
+ node.content.forEach(listItem => c.push(this.convertContent(listItem.content || [], meta, options)));
86
+ }
87
+ break;
88
+ }
89
+ case "citation": {
90
+ if (options.inFootnote) {
91
+ // TODO: handle citations in footnotes
92
+ break;
93
+ }
94
+ const cit = this.exporter.citations.pmCits.shift();
95
+ const pandocReferences = node.attrs.references
96
+ .map(reference => {
97
+ const bibDBEntry = this.bibDB.db[reference.id];
98
+ if (!bibDBEntry) {
99
+ // Not present in bibliography database, skip it.
100
+ return false;
101
+ }
102
+ if (!this.usedBibDB[reference.id]) {
103
+ const citationKey = this.createUniqueCitationKey(bibDBEntry.entry_key);
104
+ this.usedBibDB[reference.id] = Object.assign({}, bibDBEntry);
105
+ this.usedBibDB[reference.id].entry_key =
106
+ citationKey;
107
+ }
108
+ return {
109
+ citationId: this.usedBibDB[reference.id].entry_key,
110
+ citationPrefix: convertText(reference.prefix || ""),
111
+ citationSuffix: convertText(reference.locator || ""),
112
+ citationMode: {
113
+ t: node.attrs.format === "textcite"
114
+ ? "AuthorInText"
115
+ : "NormalCitation"
116
+ },
117
+ citationNoteNum: 1,
118
+ citationHash: 0
119
+ };
120
+ })
121
+ .filter(reference => reference);
122
+ if (!pandocReferences.length) {
123
+ break;
124
+ }
125
+ const pandocRendering = this.convertContent(cit.content, meta, options);
126
+ const pandocElement = {
127
+ t: "Cite",
128
+ c: [pandocReferences, pandocRendering]
129
+ };
130
+ if (node.content) {
131
+ this.convertContent(node.content, meta, options).forEach(el => pandocElement.c.push(el));
132
+ }
133
+ pandocContent.push(pandocElement);
134
+ break;
135
+ }
136
+ case "code_block": {
137
+ options = Object.assign({}, options);
138
+ options.inCode = true;
139
+ const classes = node.attrs.language
140
+ ? [node.attrs.language]
141
+ : [];
142
+ const keyValuePairs = [];
143
+ // Add caption if title is present
144
+ if (node.attrs.title) {
145
+ keyValuePairs.push(["caption", node.attrs.title]);
146
+ }
147
+ // Add category as custom attribute for round-trip fidelity
148
+ if (node.attrs.category) {
149
+ keyValuePairs.push(["category", node.attrs.category]);
150
+ }
151
+ // Use id if present, otherwise empty string
152
+ const id = node.attrs.id || "";
153
+ const attrs = [id, classes, keyValuePairs];
154
+ pandocContent.push({
155
+ t: "CodeBlock",
156
+ c: [
157
+ attrs,
158
+ this.convertContent(node.content, meta, options)
159
+ .map(item => {
160
+ if (item.t === "Str") {
161
+ return item.c;
162
+ }
163
+ else if (item.t === "Space") {
164
+ return " ";
165
+ }
166
+ else if (item.t === "SoftBreak" ||
167
+ item.t === "LineBreak") {
168
+ return "\n";
169
+ }
170
+ return "";
171
+ })
172
+ .join("")
173
+ ]
174
+ });
175
+ break;
176
+ }
177
+ case "contributor":
178
+ // dealt with in contributors_part
179
+ break;
180
+ case "contributors_part": {
181
+ if (!node.content || !node.content.length) {
182
+ break;
183
+ }
184
+ if (node.attrs.metadata === "authors") {
185
+ if (!meta.author) {
186
+ meta.author = { t: "MetaList", c: [] };
187
+ }
188
+ const convertedContributors = node.content
189
+ .map(contributor => convertContributor(contributor.attrs))
190
+ .filter(convertedContributor => convertedContributor);
191
+ convertedContributors.forEach(contributor => meta.author.c.push(contributor));
192
+ }
193
+ else {
194
+ pandocContent.push({
195
+ t: "Div",
196
+ c: [
197
+ [
198
+ node.attrs.id || "",
199
+ [
200
+ "doc-part",
201
+ "doc-contributors",
202
+ node.attrs.id
203
+ ? `doc-${node.attrs.id}`
204
+ : "doc-div",
205
+ `doc-${node.attrs.metadata || "other"}`
206
+ ],
207
+ []
208
+ ],
209
+ [
210
+ {
211
+ t: "Para",
212
+ c: convertText(node.content
213
+ .map(contributor => `${contributor.attrs.firstname} ${contributor.attrs.lastname}, ${contributor.attrs.institution}, ${contributor.attrs.email}`)
214
+ .join("; "))
215
+ }
216
+ ]
217
+ ]
218
+ });
219
+ }
220
+ break;
221
+ }
222
+ case "cross_reference": {
223
+ // TODO: use real cross reference instead of link.
224
+ pandocContent.push({
225
+ t: "Link",
226
+ c: [
227
+ ["", ["reference"], []],
228
+ convertText(node.attrs.title || "MISSING TARGET"),
229
+ [`#${node.attrs.id || ""}`, ""]
230
+ ]
231
+ });
232
+ break;
233
+ }
234
+ case "heading_part": {
235
+ if (!node.content || !node.content.length) {
236
+ break;
237
+ }
238
+ if (node.attrs?.metadata === "subtitle" && !meta.subtitle) {
239
+ if (node.content?.length && node.content[0].content) {
240
+ meta.subtitle = {
241
+ t: "MetaInlines",
242
+ c: this.convertContent(node.content[0].content, meta, options)
243
+ };
244
+ }
245
+ }
246
+ else {
247
+ const pandocElement = {
248
+ t: "Header",
249
+ c: [2, [node.attrs?.metadata || "", [], []]]
250
+ };
251
+ if (node.content) {
252
+ this.convertContent(node.content, meta, options).forEach(el => pandocElement.c.push(el));
253
+ }
254
+ pandocContent.push({
255
+ t: "Div",
256
+ c: [
257
+ [
258
+ node.attrs.id || "",
259
+ [
260
+ "doc-part",
261
+ "doc-heading",
262
+ node.attrs.id
263
+ ? `doc-${node.attrs.id}`
264
+ : "doc-div",
265
+ `doc-${node.attrs.metadata || "other"}`
266
+ ],
267
+ []
268
+ ],
269
+ [pandocElement]
270
+ ]
271
+ });
272
+ }
273
+ break;
274
+ }
275
+ case "equation": {
276
+ pandocContent.push({
277
+ t: "Span",
278
+ c: [
279
+ ["", ["equation"], []],
280
+ [
281
+ {
282
+ t: "Math",
283
+ c: [{ t: "InlineMath" }, node.attrs.equation]
284
+ }
285
+ ]
286
+ ]
287
+ });
288
+ break;
289
+ }
290
+ case "figure": {
291
+ const image = node.content.find(node => node.type === "image")?.attrs
292
+ .image || false;
293
+ const caption = node.attrs.caption
294
+ ? node.content.find(node => node.type === "figure_caption")?.content || []
295
+ : [];
296
+ const equation = node.content.find(node => node.type === "figure_equation")?.attrs.equation;
297
+ if (image !== false) {
298
+ this.imageIds.push(image);
299
+ const imageDBEntry = this.imageDB.db[image], filePathName = imageDBEntry.image;
300
+ const copyright = imageDBEntry.copyright;
301
+ const imageFilename = filePathName.split("/").pop();
302
+ if (node.attrs.category === "none" &&
303
+ imageFilename &&
304
+ !caption.length &&
305
+ (!copyright || !copyright.holder)) {
306
+ pandocContent.push({
307
+ t: "Plain",
308
+ c: [
309
+ {
310
+ t: "Image",
311
+ c: [
312
+ [
313
+ node.attrs.id || "",
314
+ [],
315
+ [
316
+ [
317
+ "data-width",
318
+ String(node.attrs.width)
319
+ ],
320
+ [
321
+ "width",
322
+ `${node.attrs.width}%`
323
+ ]
324
+ ]
325
+ ],
326
+ [],
327
+ [imageFilename, ""]
328
+ ]
329
+ }
330
+ ]
331
+ });
332
+ }
333
+ else {
334
+ pandocContent.push({
335
+ t: "Figure",
336
+ c: [
337
+ [
338
+ node.attrs.id || "",
339
+ [
340
+ `aligned-${node.attrs.aligned}`,
341
+ `image-width-${node.attrs.width}`
342
+ ],
343
+ [
344
+ ["aligned", node.attrs.aligned],
345
+ [
346
+ "data-width",
347
+ String(node.attrs.width)
348
+ ],
349
+ ["width", `${node.attrs.width}%`],
350
+ ["category", node.attrs.category]
351
+ ]
352
+ ],
353
+ [
354
+ null,
355
+ caption.length
356
+ ? [
357
+ {
358
+ t: "Para",
359
+ c: this.convertContent(caption, meta, options)
360
+ }
361
+ ]
362
+ : []
363
+ ],
364
+ [
365
+ {
366
+ t: "Plain",
367
+ c: [
368
+ {
369
+ t: "Image",
370
+ c: [
371
+ [
372
+ "",
373
+ [],
374
+ [
375
+ [
376
+ "width",
377
+ `${node.attrs.width}%`
378
+ ]
379
+ ]
380
+ ],
381
+ [],
382
+ [imageFilename, ""]
383
+ ]
384
+ }
385
+ ]
386
+ }
387
+ ]
388
+ ]
389
+ });
390
+ }
391
+ }
392
+ else if (equation) {
393
+ pandocContent.push({
394
+ t: "Figure",
395
+ c: [
396
+ [
397
+ node.attrs.id || "",
398
+ [
399
+ `aligned-${node.attrs.aligned}`,
400
+ `image-width-${node.attrs.width}`
401
+ ],
402
+ [
403
+ ["aligned", node.attrs.aligned],
404
+ [
405
+ "data-width",
406
+ String(node.attrs.width)
407
+ ],
408
+ ["width", `${node.attrs.width}%`],
409
+ ["category", node.attrs.category]
410
+ ]
411
+ ],
412
+ [
413
+ null,
414
+ caption.length
415
+ ? [
416
+ {
417
+ t: "Para",
418
+ c: this.convertContent(caption, meta, options)
419
+ }
420
+ ]
421
+ : []
422
+ ],
423
+ [
424
+ {
425
+ t: "Math",
426
+ c: [
427
+ { t: "DisplayMath" },
428
+ node.attrs.equation
429
+ ]
430
+ }
431
+ ]
432
+ ]
433
+ });
434
+ }
435
+ // TODO: figure attributes like copyright info etc.
436
+ break;
437
+ }
438
+ case "figure_caption":
439
+ case "figure_equation":
440
+ // Dealt with in figure
441
+ break;
442
+ case "footnote": {
443
+ options = Object.assign({}, options);
444
+ options.inFootnote = true;
445
+ pandocContent.push({
446
+ t: "Note",
447
+ c: this.convertContent(node.attrs.footnote, meta, options)
448
+ });
449
+ break;
450
+ }
451
+ case "footnotecontainer":
452
+ // Dealt with in footnote
453
+ break;
454
+ case "hard_break":
455
+ pandocContent.push({ t: "LineBreak" });
456
+ break;
457
+ case "heading1":
458
+ case "heading2":
459
+ case "heading3":
460
+ case "heading4":
461
+ case "heading5":
462
+ case "heading6": {
463
+ const level = Number.parseInt(node.type.slice(-1));
464
+ pandocContent.push({
465
+ t: "Header",
466
+ c: [
467
+ level,
468
+ [node.attrs.id || "", [], []],
469
+ this.convertContent(node.content || [], meta, options)
470
+ ]
471
+ });
472
+ break;
473
+ }
474
+ case "image":
475
+ // Handled by figure
476
+ break;
477
+ case "list_item":
478
+ // handled by ordered_list and bullet_list
479
+ break;
480
+ case "ordered_list": {
481
+ const c = [];
482
+ pandocContent.push({
483
+ t: "OrderedList",
484
+ c: [
485
+ [
486
+ node.attrs?.order || 1,
487
+ { t: "DefaultStyle" },
488
+ { t: "DefaultDelim" }
489
+ ], // list attributes
490
+ c
491
+ ]
492
+ });
493
+ if (node.content) {
494
+ node.content.forEach(listItem => c.push(this.convertContent(listItem.content || [], meta, options)));
495
+ }
496
+ break;
497
+ }
498
+ case "paragraph": {
499
+ pandocContent.push({
500
+ t: "Para",
501
+ c: node.content
502
+ ? this.convertContent(node.content, meta, options)
503
+ : []
504
+ });
505
+ break;
506
+ }
507
+ case "richtext_part": {
508
+ if (!node.content || !node.content.length) {
509
+ break;
510
+ }
511
+ if (node.attrs?.metadata === "abstract" && !meta.abstract) {
512
+ meta.abstract = {
513
+ t: "MetaBlocks",
514
+ c: this.convertContent(node.content, meta, options)
515
+ };
516
+ }
517
+ else {
518
+ pandocContent.push({
519
+ t: "Div",
520
+ c: [
521
+ [
522
+ node.attrs.id || "",
523
+ [
524
+ "doc-part",
525
+ "doc-richtext",
526
+ node.attrs.id
527
+ ? `doc-${node.attrs.id}`
528
+ : "doc-div",
529
+ `doc-${node.attrs.metadata || "other"}`
530
+ ],
531
+ []
532
+ ],
533
+ this.convertContent(node.content, meta, options)
534
+ ]
535
+ });
536
+ }
537
+ break;
538
+ }
539
+ case "separator_part":
540
+ pandocContent.push({
541
+ t: "HorizontalRule",
542
+ c: [
543
+ [
544
+ node.attrs.id || "",
545
+ [
546
+ "doc-part",
547
+ "doc-separator",
548
+ node.attrs.id
549
+ ? `doc-${node.attrs.id}`
550
+ : "doc-hr",
551
+ `doc-${node.attrs.metadata || "other"}`
552
+ ],
553
+ []
554
+ ],
555
+ []
556
+ ]
557
+ });
558
+ break;
559
+ case "tag":
560
+ // Handled by tags_part
561
+ break;
562
+ case "tags_part": {
563
+ if (!node.content || !node.content.length) {
564
+ break;
565
+ }
566
+ pandocContent.push({
567
+ t: "Div",
568
+ c: [
569
+ [
570
+ node.attrs.id || "",
571
+ [
572
+ "doc-part",
573
+ "doc-tags",
574
+ node.attrs.id
575
+ ? `doc-${node.attrs.id}`
576
+ : "doc-div",
577
+ `doc-${node.attrs.metadata || "other"}`
578
+ ],
579
+ []
580
+ ],
581
+ [
582
+ {
583
+ t: "Para",
584
+ c: convertText(node.content
585
+ .map(tag => tag.attrs.tag)
586
+ .join("; "))
587
+ }
588
+ ]
589
+ ]
590
+ });
591
+ break;
592
+ }
593
+ case "table": {
594
+ // Tables seem to have this structure in pandoc json:
595
+ // If table has no rows with content, skip.
596
+ const tableBodyNode = node.content.find(childNode => childNode.type === "table_body" &&
597
+ childNode.content &&
598
+ childNode.content.length);
599
+ const tableFirstRow = tableBodyNode
600
+ ? tableBodyNode.content.find(childNode => childNode.type === "table_row" &&
601
+ childNode.content &&
602
+ childNode.content.length)
603
+ : false;
604
+ if (!tableFirstRow) {
605
+ break;
606
+ }
607
+ const c = [];
608
+ pandocContent.push({
609
+ t: "Table",
610
+ c
611
+ });
612
+ // child 0: attributes of the table.
613
+ c.push([
614
+ node.attrs.id || "",
615
+ [
616
+ `table-${node.attrs.width}`,
617
+ `table-${node.attrs.aligned}`,
618
+ `table-${node.attrs.layout}`
619
+ ],
620
+ [
621
+ ["data-width", String(node.attrs.width)],
622
+ ["width", `${node.attrs.width}%`],
623
+ ["aligned", node.attrs.aligned],
624
+ ["layout", node.attrs.layout],
625
+ ["category", node.attrs.category]
626
+ ]
627
+ ]);
628
+ // child 1: table caption
629
+ const tableCaptionNode = node.content.find(childNode => childNode.type === "table_caption" &&
630
+ childNode.content &&
631
+ childNode.content.length);
632
+ if (tableCaptionNode) {
633
+ c.push([
634
+ null,
635
+ [
636
+ {
637
+ t: "Plain",
638
+ c: this.convertContent(tableCaptionNode.content, meta, options)
639
+ }
640
+ ]
641
+ ]);
642
+ }
643
+ else {
644
+ c.push([null, []]);
645
+ }
646
+ // child 2: settings for each column
647
+ c.push(tableFirstRow.content.map(_column => [
648
+ { t: "AlignDefault" },
649
+ { t: "ColWidthDefault" }
650
+ ]));
651
+ // child 3: ?
652
+ c.push([["", [], []], []]);
653
+ // child 4: Each child represents one table row
654
+ const tableHead = [];
655
+ const tableBody = [];
656
+ c.push([[["", [], []], 0, tableHead, tableBody]]);
657
+ let currentTablePart = tableHead;
658
+ this.convertContent(tableBodyNode.content, meta, options).forEach((row, index) => {
659
+ if (currentTablePart === tableHead &&
660
+ tableBodyNode.content[index].content?.find(node => node.type === "table_cell")) {
661
+ // If at least one regular table cell is found in the row, we assume the table header hs finished.
662
+ currentTablePart = tableBody;
663
+ }
664
+ currentTablePart.push(row);
665
+ });
666
+ // last child: Unclear meaning
667
+ c.push([["", [], []], []]);
668
+ // Don't process content as we do that by calling convertContent above already.
669
+ //processContent = false
670
+ break;
671
+ }
672
+ case "table_body":
673
+ case "table_caption":
674
+ // Handled directly through table tag.
675
+ break;
676
+ case "table_cell":
677
+ case "table_header": {
678
+ if (node.content) {
679
+ pandocContent.push([
680
+ ["", [], []],
681
+ { t: "AlignDefault" },
682
+ node.attrs?.rowspan || 1,
683
+ node.attrs?.colspan || 1,
684
+ this.convertContent(node.content, meta, options)
685
+ ]);
686
+ }
687
+ break;
688
+ }
689
+ case "table_part":
690
+ pandocContent.push({
691
+ t: "Div",
692
+ c: [
693
+ [
694
+ node.attrs.id || "",
695
+ [
696
+ "doc-part",
697
+ "doc-table",
698
+ node.attrs.id
699
+ ? `doc-${node.attrs.id}`
700
+ : "doc-div",
701
+ `doc-${node.attrs.metadata || "other"}`
702
+ ],
703
+ []
704
+ ],
705
+ this.convertContent(node.content, meta, options)
706
+ ]
707
+ });
708
+ break;
709
+ case "table_of_contents": {
710
+ pandocContent.push({
711
+ t: "Div",
712
+ c: [
713
+ [
714
+ node.attrs.id || "",
715
+ [
716
+ "doc-part",
717
+ "doc-table-of-contents",
718
+ node.attrs.id
719
+ ? `doc-${node.attrs.id}`
720
+ : "doc-div",
721
+ `doc-${node.attrs.metadata || "other"}`
722
+ ],
723
+ []
724
+ ],
725
+ [
726
+ {
727
+ t: "Header",
728
+ c: [
729
+ 1,
730
+ ["", ["toc"], []],
731
+ convertText(node.attrs.title)
732
+ ]
733
+ }
734
+ ].concat(this.metaData.toc)
735
+ ]
736
+ });
737
+ break;
738
+ }
739
+ case "table_row": {
740
+ pandocContent.push([
741
+ ["", [], []],
742
+ this.convertContent(node.content, meta, options)
743
+ ]);
744
+ break;
745
+ }
746
+ case "text": {
747
+ if (node.text) {
748
+ let containerContent = pandocContent;
749
+ let strong, em, underline, hyperlink, anchor, sup, sub, code;
750
+ if (node.marks) {
751
+ strong = node.marks.find(mark => mark.type === "strong");
752
+ em = node.marks.find(mark => mark.type === "em");
753
+ underline = node.marks.find(mark => mark.type === "underline");
754
+ hyperlink = node.marks.find(mark => mark.type === "link");
755
+ anchor = node.marks.find(mark => mark.type === "anchor");
756
+ sup = node.marks.find(mark => mark.type === "sup");
757
+ sub = node.marks.find(mark => mark.type === "sub");
758
+ code = node.marks.find(mark => mark.type === "code");
759
+ }
760
+ if (em) {
761
+ const c = [];
762
+ containerContent.push({
763
+ t: "Emph",
764
+ c
765
+ });
766
+ containerContent = c;
767
+ }
768
+ if (strong) {
769
+ const c = [];
770
+ containerContent.push({
771
+ t: "Strong",
772
+ c
773
+ });
774
+ containerContent = c;
775
+ }
776
+ if (underline) {
777
+ const c = [];
778
+ containerContent.push({
779
+ t: "Underline",
780
+ c
781
+ });
782
+ containerContent = c;
783
+ }
784
+ if (sup) {
785
+ const c = [];
786
+ containerContent.push({
787
+ t: "Superscript",
788
+ c
789
+ });
790
+ containerContent = c;
791
+ }
792
+ if (sub) {
793
+ const c = [];
794
+ containerContent.push({
795
+ t: "Subscript",
796
+ c
797
+ });
798
+ containerContent = c;
799
+ }
800
+ if (code && !options.inCode) {
801
+ containerContent.push({
802
+ t: "Code",
803
+ c: [["", [], []], node.text]
804
+ });
805
+ break;
806
+ }
807
+ if (hyperlink) {
808
+ const c = [];
809
+ containerContent.push({
810
+ t: "Link",
811
+ c: [["", [], []], c, [hyperlink.attrs.href, ""]]
812
+ });
813
+ containerContent = c;
814
+ }
815
+ if (anchor) {
816
+ const c = [];
817
+ containerContent.push({
818
+ t: "Span",
819
+ c: [[anchor.attrs.id, [], []], c]
820
+ });
821
+ containerContent = c;
822
+ }
823
+ if (options.inCode) {
824
+ containerContent.push({
825
+ t: "Code",
826
+ c: [["", [], []], node.text]
827
+ });
828
+ }
829
+ else {
830
+ containerContent.push(...convertText(node.text || ""));
831
+ }
832
+ }
833
+ break;
834
+ }
835
+ case "title": {
836
+ if (!node.content || !node.content.length) {
837
+ break;
838
+ }
839
+ if (!meta.title) {
840
+ meta.title = {
841
+ t: "MetaInlines",
842
+ c: this.convertContent(node.content, meta, options)
843
+ };
844
+ }
845
+ else {
846
+ const pandocElement = {
847
+ t: "Header",
848
+ c: [1, ["title", [], []]]
849
+ };
850
+ if (node.content) {
851
+ this.convertContent(node.content, meta, options).forEach(el => pandocElement.c.push(el));
852
+ }
853
+ pandocContent.push(pandocElement);
854
+ }
855
+ break;
856
+ }
857
+ default: {
858
+ console.warn(`Not handled: ${node.type}`, { node });
859
+ break;
860
+ }
861
+ }
862
+ }
863
+ return pandocContent;
864
+ }
865
+ // The database doesn't ensure that citation keys are unique.
866
+ // So here we need to make sure that the same key is not used twice in one
867
+ // document.
868
+ createUniqueCitationKey(suggestedKey) {
869
+ const usedKeys = Object.keys(this.usedBibDB).map(key => {
870
+ return this.usedBibDB[key].entry_key;
871
+ });
872
+ if (usedKeys.includes(suggestedKey)) {
873
+ suggestedKey += "X";
874
+ return this.createUniqueCitationKey(suggestedKey);
875
+ }
876
+ else {
877
+ return suggestedKey;
878
+ }
879
+ }
880
+ }
881
+ //# sourceMappingURL=convert.js.map