unaltraweb 0.3.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 (444) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +20 -0
  3. data/Makefile +412 -0
  4. data/README.md +226 -0
  5. data/_config.yml +842 -0
  6. data/_data/i18n/ca.yml +278 -0
  7. data/_data/i18n/en.yml +278 -0
  8. data/_data/i18n/es.yml +278 -0
  9. data/_includes/audio.liquid +30 -0
  10. data/_includes/bib_search.liquid +5 -0
  11. data/_includes/blog-list.liquid +66 -0
  12. data/_includes/book-citation.liquid +33 -0
  13. data/_includes/citation.liquid +26 -0
  14. data/_includes/custom_head.liquid +3 -0
  15. data/_includes/custom_scripts.liquid +5 -0
  16. data/_includes/cv/list.liquid +5 -0
  17. data/_includes/cv/list_groups.liquid +51 -0
  18. data/_includes/cv/map.liquid +29 -0
  19. data/_includes/cv/nested_list.liquid +16 -0
  20. data/_includes/cv/time_table.liquid +118 -0
  21. data/_includes/cv-download-card.liquid +26 -0
  22. data/_includes/developer-mode-switcher.liquid +24 -0
  23. data/_includes/disqus.liquid +13 -0
  24. data/_includes/distill_scripts.liquid +298 -0
  25. data/_includes/documentation-download-detail.liquid +76 -0
  26. data/_includes/documentation-downloads.liquid +71 -0
  27. data/_includes/documentation-profile-attributes.liquid +4 -0
  28. data/_includes/documentation-section-toc.liquid +9 -0
  29. data/_includes/documentation-sidebar.liquid +112 -0
  30. data/_includes/figure.liquid +87 -0
  31. data/_includes/footer.liquid +66 -0
  32. data/_includes/giscus.liquid +25 -0
  33. data/_includes/head.liquid +220 -0
  34. data/_includes/header.liquid +544 -0
  35. data/_includes/latest_posts.liquid +61 -0
  36. data/_includes/localized-date.liquid +5 -0
  37. data/_includes/manual-bibliography.liquid +2 -0
  38. data/_includes/manual-featured-readings.liquid +12 -0
  39. data/_includes/manual-other-readings.liquid +12 -0
  40. data/_includes/manual-page-toc.liquid +11 -0
  41. data/_includes/manual-sidebar.liquid +58 -0
  42. data/_includes/manual-teachers.liquid +74 -0
  43. data/_includes/metadata.liquid +278 -0
  44. data/_includes/news.liquid +48 -0
  45. data/_includes/newsletter.liquid +68 -0
  46. data/_includes/page-hero.liquid +96 -0
  47. data/_includes/page-link.liquid +8 -0
  48. data/_includes/pagination.liquid +22 -0
  49. data/_includes/post-reading-time.liquid +29 -0
  50. data/_includes/previous-next.liquid +37 -0
  51. data/_includes/profile-card.liquid +49 -0
  52. data/_includes/profile-feature-matrix.liquid +75 -0
  53. data/_includes/profile-highlights.liquid +122 -0
  54. data/_includes/project-grid.liquid +26 -0
  55. data/_includes/project-resource-link.liquid +45 -0
  56. data/_includes/project-resources.liquid +21 -0
  57. data/_includes/projects.liquid +38 -0
  58. data/_includes/projects_horizontal.liquid +37 -0
  59. data/_includes/publications-metrics-summary.liquid +69 -0
  60. data/_includes/publications-summary.liquid +127 -0
  61. data/_includes/reading-biblio-controls.liquid +65 -0
  62. data/_includes/reading-cover-card.liquid +93 -0
  63. data/_includes/reading-rating.liquid +11 -0
  64. data/_includes/recommended-readings.liquid +30 -0
  65. data/_includes/related_posts.liquid +39 -0
  66. data/_includes/repository/repo.liquid +48 -0
  67. data/_includes/repository/repo_trophies.liquid +44 -0
  68. data/_includes/repository/repo_user.liquid +35 -0
  69. data/_includes/resume/awards.liquid +19 -0
  70. data/_includes/resume/basics.liquid +28 -0
  71. data/_includes/resume/certificates.liquid +35 -0
  72. data/_includes/resume/education.liquid +54 -0
  73. data/_includes/resume/interests.liquid +34 -0
  74. data/_includes/resume/languages.liquid +31 -0
  75. data/_includes/resume/projects.liquid +32 -0
  76. data/_includes/resume/publications.liquid +28 -0
  77. data/_includes/resume/references.liquid +31 -0
  78. data/_includes/resume/skills.liquid +33 -0
  79. data/_includes/resume/volunteer.liquid +52 -0
  80. data/_includes/resume/work.liquid +52 -0
  81. data/_includes/scripts.liquid +364 -0
  82. data/_includes/search-data.js.liquid +341 -0
  83. data/_includes/selected_papers.liquid +3 -0
  84. data/_includes/t.liquid +31 -0
  85. data/_includes/team-grid.liquid +172 -0
  86. data/_includes/video.liquid +97 -0
  87. data/_layouts/about.liquid +93 -0
  88. data/_layouts/archive.liquid +45 -0
  89. data/_layouts/bib.liquid +677 -0
  90. data/_layouts/book-review.liquid +225 -0
  91. data/_layouts/book-shelf.liquid +66 -0
  92. data/_layouts/cv.liquid +127 -0
  93. data/_layouts/default.liquid +70 -0
  94. data/_layouts/distill.liquid +132 -0
  95. data/_layouts/documentation-download-detail.liquid +5 -0
  96. data/_layouts/documentation-home.liquid +100 -0
  97. data/_layouts/documentation-page.liquid +45 -0
  98. data/_layouts/manual-bib.liquid +73 -0
  99. data/_layouts/manual-chapter.liquid +99 -0
  100. data/_layouts/manual-featured-bib.liquid +100 -0
  101. data/_layouts/manual-home.liquid +120 -0
  102. data/_layouts/none.liquid +1 -0
  103. data/_layouts/outputs.liquid +29 -0
  104. data/_layouts/page.liquid +52 -0
  105. data/_layouts/post.liquid +95 -0
  106. data/_layouts/profile.liquid +36 -0
  107. data/_layouts/profiles.liquid +36 -0
  108. data/_layouts/project.liquid +7 -0
  109. data/_layouts/repositories.liquid +58 -0
  110. data/_layouts/theses.liquid +126 -0
  111. data/_plugins/bibliography_profiles.rb +164 -0
  112. data/_plugins/callouts.rb +104 -0
  113. data/_plugins/code_blocks.rb +277 -0
  114. data/_plugins/computation_figure_images.rb +266 -0
  115. data/_plugins/computation_sources.rb +42 -0
  116. data/_plugins/content_search_index.rb +210 -0
  117. data/_plugins/details.rb +23 -0
  118. data/_plugins/external-posts.rb +124 -0
  119. data/_plugins/figure_captions.rb +800 -0
  120. data/_plugins/file-exists.rb +22 -0
  121. data/_plugins/google-scholar-citations.rb +86 -0
  122. data/_plugins/hide-custom-bibtex.rb +18 -0
  123. data/_plugins/inspirehep-citations.rb +57 -0
  124. data/_plugins/localized_visual_sources.rb +145 -0
  125. data/_plugins/manual_release_metadata.rb +47 -0
  126. data/_plugins/mermaid_mmd_images.rb +233 -0
  127. data/_plugins/profile-pages.rb +28 -0
  128. data/_plugins/remove-accents.rb +32 -0
  129. data/_plugins/reproducible_build_time.rb +55 -0
  130. data/_plugins/search-data.rb +83 -0
  131. data/_plugins/theme-cache-bust.rb +56 -0
  132. data/_plugins/vega_visual_images.rb +290 -0
  133. data/_plugins/web_capture_images.rb +154 -0
  134. data/_sass/_base.scss +2133 -0
  135. data/_sass/_blog.scss +67 -0
  136. data/_sass/_callouts.scss +100 -0
  137. data/_sass/_custom.scss +437 -0
  138. data/_sass/_cv.scss +274 -0
  139. data/_sass/_developer.scss +97 -0
  140. data/_sass/_distill.scss +185 -0
  141. data/_sass/_documentation.scss +2220 -0
  142. data/_sass/_layout.scss +218 -0
  143. data/_sass/_manual.scss +2691 -0
  144. data/_sass/_profile.scss +323 -0
  145. data/_sass/_projects.scss +163 -0
  146. data/_sass/_reading.scss +465 -0
  147. data/_sass/_site-custom.scss +3 -0
  148. data/_sass/_tabs.scss +48 -0
  149. data/_sass/_team.scss +230 -0
  150. data/_sass/_themes.scss +254 -0
  151. data/_sass/_typograms.scss +132 -0
  152. data/_sass/_variables.scss +52 -0
  153. data/_sass/font-awesome/_animated.scss +152 -0
  154. data/_sass/font-awesome/_bordered-pulled.scss +20 -0
  155. data/_sass/font-awesome/_core.scss +49 -0
  156. data/_sass/font-awesome/_fixed-width.scss +7 -0
  157. data/_sass/font-awesome/_functions.scss +57 -0
  158. data/_sass/font-awesome/_icons.scss +13 -0
  159. data/_sass/font-awesome/_list.scss +18 -0
  160. data/_sass/font-awesome/_mixins.scss +65 -0
  161. data/_sass/font-awesome/_rotated-flipped.scss +31 -0
  162. data/_sass/font-awesome/_screen-reader.scss +14 -0
  163. data/_sass/font-awesome/_shims.scss +1578 -0
  164. data/_sass/font-awesome/_sizing.scss +16 -0
  165. data/_sass/font-awesome/_stacked.scss +32 -0
  166. data/_sass/font-awesome/_variables.scss +5044 -0
  167. data/_sass/font-awesome/brands.scss +30 -0
  168. data/_sass/font-awesome/fontawesome.scss +21 -0
  169. data/_sass/font-awesome/regular.scss +27 -0
  170. data/_sass/font-awesome/solid.scss +27 -0
  171. data/_sass/font-awesome/v4-shims.scss +11 -0
  172. data/_sass/tabler-icons/tabler-icons-filled.scss +1646 -0
  173. data/_sass/tabler-icons/tabler-icons-outline.scss +9859 -0
  174. data/_sass/tabler-icons/tabler-icons.scss +11463 -0
  175. data/_scripts/cronitor-analytics-setup.js +9 -0
  176. data/_scripts/giscus-setup.js +48 -0
  177. data/_scripts/google-analytics-setup.js +9 -0
  178. data/_scripts/open-panel-analytics-setup.js +14 -0
  179. data/_scripts/photoswipe-setup.js +11 -0
  180. data/assets/audio/epicaly-short-113909.mp3 +0 -0
  181. data/assets/bibliography/2018-12-22-distill.bib +7 -0
  182. data/assets/css/academicons.min.css +1 -0
  183. data/assets/css/bootstrap-toc.min.css +4 -0
  184. data/assets/css/bootstrap.min.css +7 -0
  185. data/assets/css/bootstrap.min.css.map +1 -0
  186. data/assets/css/jekyll-pygments-themes-github.css +209 -0
  187. data/assets/css/jekyll-pygments-themes-native.css +232 -0
  188. data/assets/css/jupyter-grade3.css +3758 -0
  189. data/assets/css/jupyter-monokai.css +3758 -0
  190. data/assets/css/jupyter.css +383 -0
  191. data/assets/css/main.scss +36 -0
  192. data/assets/css/mdb.min.css +48 -0
  193. data/assets/css/mdb.min.css.map +1 -0
  194. data/assets/css/scholar-icons.css +386 -0
  195. data/assets/fonts/academicons.ttf +0 -0
  196. data/assets/fonts/academicons.woff +0 -0
  197. data/assets/fonts/scholar-icons.ttf +0 -0
  198. data/assets/fonts/scholar-icons.woff +0 -0
  199. data/assets/fonts/tabler-icons-filled.ttf +0 -0
  200. data/assets/fonts/tabler-icons-filled.woff +0 -0
  201. data/assets/fonts/tabler-icons-filled.woff2 +0 -0
  202. data/assets/fonts/tabler-icons-outline.ttf +0 -0
  203. data/assets/fonts/tabler-icons-outline.woff +0 -0
  204. data/assets/fonts/tabler-icons-outline.woff2 +0 -0
  205. data/assets/fonts/tabler-icons.ttf +0 -0
  206. data/assets/fonts/tabler-icons.woff +0 -0
  207. data/assets/fonts/tabler-icons.woff2 +0 -0
  208. data/assets/html/relativity.html +15 -0
  209. data/assets/img/1.jpg +0 -0
  210. data/assets/img/10.jpg +0 -0
  211. data/assets/img/11.jpg +0 -0
  212. data/assets/img/12.jpg +0 -0
  213. data/assets/img/2.jpg +0 -0
  214. data/assets/img/3.jpg +0 -0
  215. data/assets/img/4.jpg +0 -0
  216. data/assets/img/5.jpg +0 -0
  217. data/assets/img/6.jpg +0 -0
  218. data/assets/img/7.jpg +0 -0
  219. data/assets/img/8.jpg +0 -0
  220. data/assets/img/9.jpg +0 -0
  221. data/assets/img/book_covers/the_godfather.jpg +0 -0
  222. data/assets/img/brand/dosquartsdedocs-logo-cafe.svg +31 -0
  223. data/assets/img/brand/dosquartsdedocs-logo-footer-cafe.svg +31 -0
  224. data/assets/img/brand/dosquartsdedocs-logo-white.svg +31 -0
  225. data/assets/img/brand/dosquartsdedocs-logo.svg +31 -0
  226. data/assets/img/prof_pic.jpg +0 -0
  227. data/assets/img/prof_pic_color.png +0 -0
  228. data/assets/img/profile-placeholder.svg +8 -0
  229. data/assets/img/publication_preview/brownian-motion.gif +0 -0
  230. data/assets/img/publication_preview/goodchild1992-gis-cover.jpg +0 -0
  231. data/assets/img/publication_preview/gutierrez2020-jtrg-preview.jpg +0 -0
  232. data/assets/img/publication_preview/harvey1989-postmodernity-cover.jpg +0 -0
  233. data/assets/img/publication_preview/tobler1970-economic-geography-cover.jpg +0 -0
  234. data/assets/img/publication_preview/tuan1977-space-place-cover.jpg +0 -0
  235. data/assets/img/publication_preview/wave-mechanics.gif +0 -0
  236. data/assets/img/publication_preview/zaragozi2025-rooftop-pv-preview.jpg +0 -0
  237. data/assets/img/rhino.png +0 -0
  238. data/assets/img/team/aaron-gutierrez.png +0 -0
  239. data/assets/img/team/alba-font.png +0 -0
  240. data/assets/img/team/alba-viana.png +0 -0
  241. data/assets/img/team/alejandro-gonzalez.png +0 -0
  242. data/assets/img/team/ana-pastor.png +0 -0
  243. data/assets/img/team/antoni-domenech.png +0 -0
  244. data/assets/img/team/benito-zaragozi.png +0 -0
  245. data/assets/img/team/cinta-sanz.png +0 -0
  246. data/assets/img/team/daniel-miravet.png +0 -0
  247. data/assets/img/team/eugenia-altamirano.png +0 -0
  248. data/assets/img/team/fiammetta-brandajs.png +0 -0
  249. data/assets/img/team/francesc-gonzalez.png +0 -0
  250. data/assets/img/team/isabel-paulino.png +0 -0
  251. data/assets/img/team/joan-borras.png +0 -0
  252. data/assets/img/team/julie-wilson.png +0 -0
  253. data/assets/img/team/liliana-sole.png +0 -0
  254. data/assets/img/team/maria-casado.png +0 -0
  255. data/assets/img/team/maria-medina.png +0 -0
  256. data/assets/img/team/marta-nello.png +0 -0
  257. data/assets/img/team/mogrify +1 -0
  258. data/assets/img/team/oscar-saladie.png +0 -0
  259. data/assets/img/team/paolo-russo.png +0 -0
  260. data/assets/img/team/raquel-santos.png +0 -0
  261. data/assets/img/team/salvador-anton.png +0 -0
  262. data/assets/img/team/sunsi-huertas.png +0 -0
  263. data/assets/img/team/user-placeholder.png +0 -0
  264. data/assets/img/team/wilbert-den-hoed.png +0 -0
  265. data/assets/img/team/xavier-delclos.png +0 -0
  266. data/assets/img/template_error.png +0 -0
  267. data/assets/js/bibsearch.js +70 -0
  268. data/assets/js/bootstrap-toc.min.js +5 -0
  269. data/assets/js/bootstrap.bundle.min.js +7 -0
  270. data/assets/js/bootstrap.bundle.min.js.map +1 -0
  271. data/assets/js/callouts.js +115 -0
  272. data/assets/js/chartjs-setup.js +14 -0
  273. data/assets/js/common.js +117 -0
  274. data/assets/js/content-search-match.js +159 -0
  275. data/assets/js/content-search.js +441 -0
  276. data/assets/js/copy_code.js +60 -0
  277. data/assets/js/custom.js +6 -0
  278. data/assets/js/developer-mode.js +103 -0
  279. data/assets/js/diff2html-setup.js +20 -0
  280. data/assets/js/distillpub/overrides.js +27 -0
  281. data/assets/js/distillpub/template.v2.js +9616 -0
  282. data/assets/js/distillpub/template.v2.js.map +1 -0
  283. data/assets/js/distillpub/transforms.v2.js +14557 -0
  284. data/assets/js/distillpub/transforms.v2.js.map +1 -0
  285. data/assets/js/documentation.js +435 -0
  286. data/assets/js/echarts-setup.js +29 -0
  287. data/assets/js/highlight-search-term.js +110 -0
  288. data/assets/js/jupyter_new_tab.js +18 -0
  289. data/assets/js/leaflet-setup.js +22 -0
  290. data/assets/js/manual.js +308 -0
  291. data/assets/js/masonry.js +12 -0
  292. data/assets/js/mathjax-setup.js +46 -0
  293. data/assets/js/mermaid-setup.js +37 -0
  294. data/assets/js/newsletter.js +105 -0
  295. data/assets/js/no_defer.js +24 -0
  296. data/assets/js/plotly-setup.js +52 -0
  297. data/assets/js/profile-nav.js +92 -0
  298. data/assets/js/progress-bar.js +73 -0
  299. data/assets/js/pseudocode-setup.js +18 -0
  300. data/assets/js/search/base-styles.min.js +286 -0
  301. data/assets/js/search/command-score.min.js +7 -0
  302. data/assets/js/search/hotkeys-js/hotkeys.esm.min.js +18 -0
  303. data/assets/js/search/lit/decorators.min.js +7 -0
  304. data/assets/js/search/lit/directives/class-map.min.js +7 -0
  305. data/assets/js/search/lit/directives/join.min.js +7 -0
  306. data/assets/js/search/lit/directives/live.min.js +7 -0
  307. data/assets/js/search/lit/directives/ref.min.js +7 -0
  308. data/assets/js/search/lit/directives/repeat.min.js +7 -0
  309. data/assets/js/search/lit/directives/unsafe-html.min.js +7 -0
  310. data/assets/js/search/lit/index.min.js +7 -0
  311. data/assets/js/search/lit-element/lit-element.min.js +12 -0
  312. data/assets/js/search/lit-html/directives/class-map.min.js +22 -0
  313. data/assets/js/search/lit-html/directives/join.min.js +12 -0
  314. data/assets/js/search/lit-html/directives/live.min.js +28 -0
  315. data/assets/js/search/lit-html/directives/ref.min.js +32 -0
  316. data/assets/js/search/lit-html/directives/repeat.min.js +27 -0
  317. data/assets/js/search/lit-html/directives/unsafe-html.min.js +22 -0
  318. data/assets/js/search/lit-html/is-server.min.js +12 -0
  319. data/assets/js/search/lit-html/lit-html.min.js +12 -0
  320. data/assets/js/search/ninja-action.min.js +101 -0
  321. data/assets/js/search/ninja-footer.min.js +62 -0
  322. data/assets/js/search/ninja-header.min.js +78 -0
  323. data/assets/js/search/ninja-keys.min.js +39 -0
  324. data/assets/js/search/reactive-element/decorators/custom-element.min.js +12 -0
  325. data/assets/js/search/reactive-element/decorators/event-options.min.js +12 -0
  326. data/assets/js/search/reactive-element/decorators/property.min.js +22 -0
  327. data/assets/js/search/reactive-element/decorators/query-all.min.js +17 -0
  328. data/assets/js/search/reactive-element/decorators/query-assigned-elements.min.js +17 -0
  329. data/assets/js/search/reactive-element/decorators/query-assigned-nodes.min.js +17 -0
  330. data/assets/js/search/reactive-element/decorators/query-async.min.js +17 -0
  331. data/assets/js/search/reactive-element/decorators/query.min.js +17 -0
  332. data/assets/js/search/reactive-element/decorators/state.min.js +27 -0
  333. data/assets/js/search/reactive-element/reactive-element.min.js +17 -0
  334. data/assets/js/search-setup.js +17 -0
  335. data/assets/js/shortcut-key.js +11 -0
  336. data/assets/js/tabs.min.js +5 -0
  337. data/assets/js/theme.js +314 -0
  338. data/assets/js/tooltips-setup.js +3 -0
  339. data/assets/js/typograms.js +1341 -0
  340. data/assets/js/vanilla-back-to-top.min.js +1 -0
  341. data/assets/js/vega-setup.js +24 -0
  342. data/assets/js/venobox-setup.js +5 -0
  343. data/assets/js/wechat.js +14 -0
  344. data/assets/js/zoom.js +15 -0
  345. data/assets/json/resume.json +98 -0
  346. data/assets/json/table_data.json +128 -0
  347. data/assets/jupyter/blog.ipynb +48 -0
  348. data/assets/pdf/example_pdf.pdf +0 -0
  349. data/assets/plotly/demo.html +72 -0
  350. data/assets/video/pexels-engin-akyurt-6069112-960x540-30fps.mp4 +0 -0
  351. data/assets/webfonts/fa-brands-400.ttf +0 -0
  352. data/assets/webfonts/fa-brands-400.woff2 +0 -0
  353. data/assets/webfonts/fa-regular-400.ttf +0 -0
  354. data/assets/webfonts/fa-regular-400.woff2 +0 -0
  355. data/assets/webfonts/fa-solid-900.ttf +0 -0
  356. data/assets/webfonts/fa-solid-900.woff2 +0 -0
  357. data/assets/webfonts/fa-v4compatibility.ttf +0 -0
  358. data/assets/webfonts/fa-v4compatibility.woff2 +0 -0
  359. data/docs/Gemfile +5 -0
  360. data/docs/_config.yml +83 -0
  361. data/docs/_documentation/en/01-quick-start.md +115 -0
  362. data/docs/_documentation/en/02-tools.md +146 -0
  363. data/docs/_documentation/en/03-usage.md +107 -0
  364. data/docs/_documentation/en/04-jekyll-basics.md +51 -0
  365. data/docs/_documentation/en/05-pages-collections.md +68 -0
  366. data/docs/_documentation/en/06-github-web-editing.md +92 -0
  367. data/docs/_documentation/en/10-profiles.md +125 -0
  368. data/docs/_documentation/en/11-unaltreselfie.md +39 -0
  369. data/docs/_documentation/en/12-unaltreprojecte.md +38 -0
  370. data/docs/_documentation/en/13-unaltremanual.md +237 -0
  371. data/docs/_documentation/en/14-unaltredocs.md +92 -0
  372. data/docs/_documentation/en/15-profile-checklist.md +39 -0
  373. data/docs/_documentation/en/20-syntax.md +353 -0
  374. data/docs/_documentation/en/21-themes.md +103 -0
  375. data/docs/_documentation/en/22-feature-reference.md +56 -0
  376. data/docs/_documentation/en/23-front-matter.md +51 -0
  377. data/docs/_documentation/en/24-data-files.md +28 -0
  378. data/docs/_documentation/en/30-customization.md +448 -0
  379. data/docs/_documentation/en/31-template.md +55 -0
  380. data/docs/_documentation/en/32-development.md +108 -0
  381. data/docs/_documentation/en/33-reusable-workflows.md +136 -0
  382. data/docs/_documentation/en/40-distribution.md +164 -0
  383. data/docs/_documentation/en/41-bibliometrics.md +137 -0
  384. data/docs/_documentation/en/42-docker-image.md +185 -0
  385. data/docs/_documentation/en/50-faq.md +33 -0
  386. data/docs/_pages/ca/index.md +35 -0
  387. data/docs/_pages/en/index.md +35 -0
  388. data/docs/_pages/es/index.md +35 -0
  389. data/docs/agents/action-prompts/00-start-site-session.txt +10 -0
  390. data/docs/agents/action-prompts/05-create-new-web.txt +5 -0
  391. data/docs/agents/action-prompts/10-content-update.txt +9 -0
  392. data/docs/agents/action-prompts/15-edit-default-content.txt +8 -0
  393. data/docs/agents/action-prompts/20-manual-teaching-materials.txt +18 -0
  394. data/docs/agents/action-prompts/22-manual-style-audit.txt +14 -0
  395. data/docs/agents/action-prompts/23-manual-structure-audit.txt +17 -0
  396. data/docs/agents/action-prompts/25-translation-prepublish.txt +8 -0
  397. data/docs/agents/action-prompts/30-project-site-update.txt +7 -0
  398. data/docs/agents/action-prompts/40-documentation-update.txt +7 -0
  399. data/docs/agents/action-prompts/50-bibliography-entry.txt +7 -0
  400. data/docs/agents/action-prompts/60-bibliometrics-refresh.txt +7 -0
  401. data/docs/agents/action-prompts/70-build-and-review.txt +12 -0
  402. data/docs/agents/manual-authoring-components.md +255 -0
  403. data/docs/agents/mcp-contract.md +162 -0
  404. data/docs/agents/quarto-computation-adoption.md +102 -0
  405. data/docs/assets/img/unaltraweb-docs-hero.svg +36 -0
  406. data/lib/unaltraweb/version.rb +8 -0
  407. data/lib/unaltraweb.rb +31 -0
  408. data/requirements.txt +5 -0
  409. data/scripts/biblio/fetch_scimago_csv.sh +126 -0
  410. data/scripts/biblio/metrics_common.py +154 -0
  411. data/scripts/biblio/metrics_merge_meta.py +73 -0
  412. data/scripts/biblio/metrics_update.py +826 -0
  413. data/scripts/computations/python/Dockerfile +37 -0
  414. data/scripts/computations/r/Dockerfile +31 -0
  415. data/scripts/computations/render.py +1267 -0
  416. data/scripts/cv/render_pdf_preview.sh +36 -0
  417. data/scripts/deploy/publish_branch.sh +80 -0
  418. data/scripts/generate_logo_variants.py +47 -0
  419. data/scripts/manual/Dockerfile +31 -0
  420. data/scripts/manual/build_pdf.py +1780 -0
  421. data/scripts/manual/filters/bibliography.lua +164 -0
  422. data/scripts/manual/filters/code-blocks.lua +102 -0
  423. data/scripts/manual/filters/figure-captions.lua +35 -0
  424. data/scripts/manual/publish_release.sh +281 -0
  425. data/scripts/manual/templates/manual.tex +494 -0
  426. data/scripts/manual/verify_release_assets.py +650 -0
  427. data/scripts/test_gem_build.py +128 -0
  428. data/scripts/test_reproducible_jekyll_build.py +191 -0
  429. data/scripts/test_wheel_install.py +282 -0
  430. data/scripts/unaltraweb-docker-mount.sh +36 -0
  431. data/scripts/unaltraweb-mcp-bootstrap.sh +105 -0
  432. data/scripts/unaltraweb-mcp-cleanup.sh +73 -0
  433. data/scripts/unaltraweb-mcp-project-id.sh +34 -0
  434. data/scripts/validate_distribution.py +563 -0
  435. data/scripts/validate_workflows.py +1285 -0
  436. data/scripts/web_captures/Dockerfile +31 -0
  437. data/scripts/web_captures/capture.mjs +157 -0
  438. data/scripts/web_captures/package-lock.json +56 -0
  439. data/scripts/web_captures/package.json +9 -0
  440. data/scripts/web_captures/render.py +867 -0
  441. data/src/unaltraweb_mcp/component-contract.json +153 -0
  442. data/src/unaltraweb_mcp/component-contract.schema.json +87 -0
  443. data/src/unaltraweb_mcp/docker_mount.py +19 -0
  444. metadata +861 -0
@@ -0,0 +1,1341 @@
1
+ // based on the original typograms code from https://github.com/google/typograms/blob/main/src/typograms.js
2
+ // only moved the css to its own file (_sass/_typograms.scss), commented the last line of the file (module.exports = create;)
3
+ // and added the last function to the end of the file
4
+ const ratio = 2;
5
+
6
+ function grid(width, height) {
7
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
8
+
9
+ const vertical = document.createElementNS("http://www.w3.org/2000/svg", "line");
10
+ vertical.setAttribute("x1", 15);
11
+ vertical.setAttribute("y1", 0);
12
+ vertical.setAttribute("x2", 15);
13
+ vertical.setAttribute("y2", 54);
14
+ vertical.setAttribute("class", "center");
15
+ //result.appendChild(vertical);
16
+
17
+ const horizontal = document.createElementNS("http://www.w3.org/2000/svg", "line");
18
+ horizontal.setAttribute("x1", 0);
19
+ horizontal.setAttribute("y1", 30);
20
+ horizontal.setAttribute("x2", 30);
21
+ horizontal.setAttribute("y2", 54);
22
+ horizontal.setAttribute("class", "center");
23
+ //result.appendChild(horizontal);
24
+
25
+ for (let i = 0; i <= width * 30; i += 3) {
26
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
27
+ line.setAttribute("x1", i);
28
+ line.setAttribute("y1", 0);
29
+ line.setAttribute("x2", i);
30
+ line.setAttribute("y2", 54 * height);
31
+ line.setAttribute("class", "grid");
32
+ result.appendChild(line);
33
+ }
34
+
35
+ for (let i = 0; i <= height * 54; i += 3) {
36
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
37
+ line.setAttribute("x1", 0);
38
+ line.setAttribute("y1", i);
39
+ line.setAttribute("x2", 30 * width);
40
+ line.setAttribute("y2", i);
41
+ line.setAttribute("class", "grid");
42
+ result.appendChild(line);
43
+ }
44
+
45
+ return result;
46
+ }
47
+
48
+ const glyphs = {};
49
+
50
+ glyphs["|"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
51
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
52
+ if (right == "_") {
53
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
54
+ line.setAttribute("x1", "18");
55
+ line.setAttribute("y1", "51");
56
+ line.setAttribute("x2", "30");
57
+ line.setAttribute("y2", "51");
58
+ line.setAttribute("class", "part");
59
+ result.appendChild(line);
60
+ }
61
+ if (left == "_") {
62
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
63
+ line.setAttribute("x1", "0");
64
+ line.setAttribute("y1", "51");
65
+ line.setAttribute("x2", "12");
66
+ line.setAttribute("y2", "51");
67
+ line.setAttribute("class", "part");
68
+ result.appendChild(line);
69
+ }
70
+ if (topRight == "_") {
71
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
72
+ line.setAttribute("x1", "12");
73
+ line.setAttribute("y1", "-3");
74
+ line.setAttribute("x2", "30");
75
+ line.setAttribute("y2", "-3");
76
+ line.setAttribute("class", "part");
77
+ result.appendChild(line);
78
+ }
79
+ if (topLeft == "_") {
80
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
81
+ line.setAttribute("x1", "0");
82
+ line.setAttribute("y1", "-3");
83
+ line.setAttribute("x2", "18");
84
+ line.setAttribute("y2", "-3");
85
+ line.setAttribute("class", "part");
86
+ result.appendChild(line);
87
+ }
88
+ // const leg = && ;
89
+ // const head = && ;
90
+ //console.log(!(bottomLeft == "/" && bottomRight == "\\"));
91
+ //console.log(!(topRight == "/" && topLeft == "\\"));
92
+ result.appendChild(
93
+ cross([
94
+ !(topRight == "/" && topLeft == "\\"), // top
95
+ ["-"].includes(right), // right
96
+ !(bottomLeft == "/" && bottomRight == "\\"), // bottom
97
+ ["-"].includes(left), // left
98
+ topRight == "/", // topRight
99
+ bottomRight == "\\", // bottomRight
100
+ bottomLeft == "/", // bottomLeft
101
+ topLeft == "\\", // topLeft
102
+ ])
103
+ );
104
+ return result;
105
+ };
106
+
107
+ glyphs["-"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
108
+ return cross([
109
+ ["|"].includes(top), // top
110
+ true, // right
111
+ ["|"].includes(bottom), // bottom
112
+ true, // left
113
+ false, // topRight
114
+ false, // bottomRight
115
+ false, // bottomLeft
116
+ false, // topLeft
117
+ ]);
118
+ };
119
+
120
+ glyphs["~"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
121
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
122
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
123
+ line.setAttribute("x1", "9");
124
+ line.setAttribute("y1", "27");
125
+ line.setAttribute("x2", "24");
126
+ line.setAttribute("y2", "27");
127
+ line.setAttribute("class", "part");
128
+ result.appendChild(line);
129
+ return result;
130
+ };
131
+
132
+ glyphs["_"] = (around) => {
133
+ const line = glyphs["-"](around);
134
+ line.setAttribute("transform", "translate(0 24)");
135
+ return line;
136
+ };
137
+
138
+ glyphs[":"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
139
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
140
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
141
+ line.setAttribute("x1", "15");
142
+ line.setAttribute("y1", "0");
143
+ line.setAttribute("x2", "15");
144
+ line.setAttribute("y2", "60");
145
+ line.setAttribute("class", "part");
146
+ line.setAttribute("style", "stroke-dasharray: 15; stroke-dashoffset: 0;");
147
+ result.appendChild(line);
148
+ if (top == "+") {
149
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
150
+ line.setAttribute("x1", "15");
151
+ line.setAttribute("y1", "-24");
152
+ line.setAttribute("x2", "15");
153
+ line.setAttribute("y2", "-15");
154
+ line.setAttribute("class", "part");
155
+ result.appendChild(line);
156
+ }
157
+ if (bottom == "+") {
158
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
159
+ line.setAttribute("x1", "15");
160
+ line.setAttribute("y1", "60");
161
+ line.setAttribute("x2", "15");
162
+ line.setAttribute("y2", "78");
163
+ line.setAttribute("class", "part");
164
+ result.appendChild(line);
165
+ }
166
+ return result;
167
+ };
168
+
169
+ glyphs["="] = (around) => {
170
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
171
+ const first = document.createElementNS("http://www.w3.org/2000/svg", "line");
172
+ first.setAttribute("x1", "0");
173
+ first.setAttribute("y1", "21");
174
+ first.setAttribute("x2", "30");
175
+ first.setAttribute("y2", "21");
176
+ first.setAttribute("class", "part");
177
+ result.appendChild(first);
178
+ const second = document.createElementNS("http://www.w3.org/2000/svg", "line");
179
+ second.setAttribute("x1", "0");
180
+ second.setAttribute("y1", "30");
181
+ second.setAttribute("x2", "30");
182
+ second.setAttribute("y2", "30");
183
+ second.setAttribute("class", "part");
184
+ result.appendChild(second);
185
+ return result;
186
+ };
187
+
188
+ glyphs["*"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
189
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
190
+ const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
191
+ circle.setAttribute("cx", "0");
192
+ circle.setAttribute("cy", "0");
193
+ circle.setAttribute("r", "21");
194
+ circle.setAttribute("stroke", "none");
195
+ circle.setAttribute("transform", "translate(15, 27)");
196
+ result.appendChild(circle);
197
+
198
+ result.appendChild(
199
+ cross([
200
+ ["+", "|"].includes(top),
201
+ ["+", "-"].includes(right),
202
+ ["+", "|"].includes(bottom),
203
+ ["+", "-"].includes(left),
204
+ ["/"].includes(topRight),
205
+ ["\\"].includes(bottomRight),
206
+ ["/"].includes(bottomLeft),
207
+ ["\\"].includes(topLeft),
208
+ ])
209
+ );
210
+
211
+ return result;
212
+ };
213
+
214
+ glyphs["o"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
215
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
216
+ const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
217
+ circle.setAttribute("cx", "0");
218
+ circle.setAttribute("cy", "0");
219
+ circle.setAttribute("r", "18");
220
+ circle.setAttribute("stroke-width", "6");
221
+ circle.setAttribute("fill", "none");
222
+ circle.setAttribute("stroke", "var(--global-text-color)");
223
+ circle.setAttribute("transform", "translate(15, 27)");
224
+ result.appendChild(circle);
225
+
226
+ const connectors = cross([
227
+ ["+", "|"].includes(top),
228
+ ["+", "-"].includes(right),
229
+ ["+", "|"].includes(bottom),
230
+ ["+", "-"].includes(left),
231
+ ["/"].includes(topRight),
232
+ ["\\"].includes(bottomRight),
233
+ ["/"].includes(bottomLeft),
234
+ ["\\"].includes(topLeft),
235
+ ]);
236
+
237
+ result.appendChild(connectors);
238
+
239
+ const inner = document.createElementNS("http://www.w3.org/2000/svg", "circle");
240
+ inner.setAttribute("cx", "0");
241
+ inner.setAttribute("cy", "0");
242
+ inner.setAttribute("r", "15");
243
+ inner.setAttribute("fill", "white");
244
+ inner.setAttribute("opacity", "100%");
245
+ inner.setAttribute("transform", "translate(15, 27)");
246
+ result.appendChild(inner);
247
+
248
+ return result;
249
+ };
250
+
251
+ glyphs["/"] = (around) => {
252
+ const [top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft] = around;
253
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
254
+ result.appendChild(
255
+ cross([
256
+ ["|"].includes(top), // top
257
+ false, // right
258
+ ["|"].includes(bottom), // bottom
259
+ false, // left
260
+ true, // topRight
261
+ false, // bottomRight
262
+ true, // bottomLeft
263
+ false, // topLeft
264
+ ])
265
+ );
266
+ if (right == "\\") {
267
+ const tip = cross([
268
+ false,
269
+ false,
270
+ false,
271
+ false,
272
+ false,
273
+ false,
274
+ true, // bottomLeft
275
+ false,
276
+ ]);
277
+ tip.setAttribute("transform", "translate(30 -54)");
278
+ tip.setAttribute("clip-path", "polygon(-3 0, 0 0, 0 54, -3 54)");
279
+ result.appendChild(tip);
280
+ }
281
+ if (left == "\\") {
282
+ const tip = cross([
283
+ false,
284
+ false,
285
+ false,
286
+ false,
287
+ true, // topRight
288
+ false,
289
+ false, // bottomLeft
290
+ false,
291
+ ]);
292
+ tip.setAttribute("transform", "translate(-30 54)");
293
+ tip.setAttribute("clip-path", "polygon(15 -6, 33 -6, 33 6, 15 6)");
294
+ result.appendChild(tip);
295
+ }
296
+
297
+ if (right == "_") {
298
+ const line = glyphs["_"](around);
299
+ result.appendChild(line);
300
+ }
301
+
302
+ return result;
303
+ };
304
+
305
+ glyphs["\\"] = (around) => {
306
+ const [top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft] = around;
307
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
308
+ result.appendChild(
309
+ cross([
310
+ ["|"].includes(top), // top
311
+ false, // right
312
+ ["|"].includes(bottom), // bottom
313
+ false, // left
314
+ false, // topRight
315
+ true, // bottomRight
316
+ false, // bottomLeft
317
+ true, // topLeft
318
+ ])
319
+ );
320
+ if (left == "/") {
321
+ const tip = cross([
322
+ false,
323
+ false,
324
+ false,
325
+ false,
326
+ false,
327
+ true, // bottomRight
328
+ false,
329
+ false,
330
+ ]);
331
+ tip.setAttribute("transform", "translate(-30 -54)");
332
+ tip.setAttribute("clip-path", "polygon(15 0, 30 0, 30 54, 15 54)");
333
+ result.appendChild(tip);
334
+ }
335
+ if (right == "/") {
336
+ const tip = cross([false, false, false, false, false, false, false, true]);
337
+ tip.setAttribute("transform", "translate(30 54)");
338
+ tip.setAttribute("clip-path", "polygon(-3 0, 0 0, 0 6, -3 6)");
339
+ result.appendChild(tip);
340
+ }
341
+
342
+ if (left == "_") {
343
+ const line = glyphs["_"](around);
344
+ result.appendChild(line);
345
+ }
346
+
347
+ return result;
348
+ };
349
+
350
+ glyphs["#"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
351
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
352
+ const polygon = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
353
+ const points = [
354
+ [0, 0],
355
+ [42, 0],
356
+ [42, 42],
357
+ [0, 42],
358
+ ];
359
+ polygon.setAttribute("points", points.map(([x, y]) => `${x},${y}`).join(" "));
360
+ polygon.setAttribute("transform", "translate(-6, 6)");
361
+ result.appendChild(polygon);
362
+
363
+ result.appendChild(
364
+ cross([
365
+ ["+", "|"].includes(top),
366
+ ["+", "-"].includes(right),
367
+ ["+", "|"].includes(bottom),
368
+ ["+", "-"].includes(left),
369
+ ["/"].includes(topRight),
370
+ ["\\"].includes(bottomRight),
371
+ ["/"].includes(bottomLeft),
372
+ ["\\"].includes(topLeft),
373
+ ])
374
+ );
375
+
376
+ return result;
377
+ };
378
+
379
+ glyphs["+"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
380
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
381
+ const r = ["*", "#", "-", "+", "~", ">", ".", "'", "`"].includes(right);
382
+ const l = ["*", "#", "-", "+", "~", "<", ".", "'", "`"].includes(left);
383
+ const t = ["*", "#", "|", "+", ".", "`", "^"].includes(top);
384
+ const b = ["*", "#", "|", "+", "'", "`", "v"].includes(bottom);
385
+ const tR = ["/", "*", "#"].includes(topRight);
386
+ const bR = ["\\", "*", "#"].includes(bottomRight);
387
+ const tL = ["\\", "*", "#"].includes(topLeft);
388
+ const bL = ["/", "*", "#"].includes(bottomLeft);
389
+
390
+ // cross
391
+ result.appendChild(cross([t, r, b, l, tR, bR, bL, tL]));
392
+
393
+ // center
394
+ if ((l || r) && (b || t)) {
395
+ const center = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
396
+ center.setAttribute("points", "0,0 6,0 6,6 0,6");
397
+ center.setAttribute("transform", "translate(-3 -3) translate(15 27)");
398
+ result.appendChild(center);
399
+ }
400
+
401
+ // tip
402
+ if (tR || tL) {
403
+ const center = cross([
404
+ false, // top
405
+ false, // right
406
+ false, // bottom
407
+ false, // left
408
+ false, // topRight
409
+ tL, // bottomRight
410
+ tR, // bottomLeft
411
+ false, // topLeft
412
+ ]);
413
+ center.setAttribute("clip-path", "polygon(0 -3, 30 -3, 30 0, 0 0)");
414
+ result.appendChild(center);
415
+ }
416
+
417
+ if (bR || bL) {
418
+ const center = cross([
419
+ false, // top
420
+ false, // right
421
+ false, // bottom
422
+ false, // left
423
+ bL, // topRight
424
+ false, // bottomRight
425
+ false, // bottomLeft
426
+ bR, // topLeft
427
+ ]);
428
+ center.setAttribute("clip-path", "polygon(0 27, 15 27, 15 30, 0 30)");
429
+ result.appendChild(center);
430
+ }
431
+
432
+ if (bL || tL) {
433
+ const center = cross([
434
+ false, // top
435
+ false, // right
436
+ false, // bottom
437
+ false, // left
438
+ bL && bR, // topRight
439
+ tL && tR, // bottomRight
440
+ false, // bottomLeft
441
+ false, // topLeft
442
+ ]);
443
+ center.setAttribute("clip-path", "polygon(-3 0, 0 0, 0 54, -3 54)");
444
+ result.appendChild(center);
445
+ }
446
+
447
+ if (bR || tR) {
448
+ const center = cross([
449
+ false, // top
450
+ false, // right
451
+ false, // bottom
452
+ false, // left
453
+ false, // topRight
454
+ false, // bottomRight
455
+ tR && tL, // bottomLeft
456
+ bR && bL, // topLeft
457
+ ]);
458
+ //console.log(center);
459
+ center.setAttribute("clip-path", "polygon(15 0, 30 0, 30 54, 15 54)");
460
+ result.appendChild(center);
461
+ }
462
+
463
+ if (r || l) {
464
+ const center = cross([
465
+ false, // top
466
+ false, // right
467
+ false, // bottom
468
+ false, // left
469
+ r || bL, // topRight
470
+ tL, // bottomRight
471
+ tR, // bottomLeft
472
+ l || bR, // topLeft
473
+ ]);
474
+ center.setAttribute("clip-path", "polygon(-3 24, 30 24, 30 30, -3 30)");
475
+ result.appendChild(center);
476
+ }
477
+ return result;
478
+ };
479
+
480
+ glyphs["."] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
481
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
482
+
483
+ // top-right
484
+ if ((right == "-" || right == "+") && (bottom == "|" || bottom == "'" || bottom == "`" || bottom == "+")) {
485
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
486
+ path.setAttribute(
487
+ "d",
488
+ `
489
+ M 30 24
490
+ A 18 18, 0, 0, 0, 12 42
491
+ L 12 54
492
+ L 18 54
493
+ L 18 42
494
+ A 12 12, 0, 0, 1, 30 30
495
+ Z`
496
+ );
497
+ result.appendChild(path);
498
+ }
499
+
500
+ // top-left
501
+ if ((left == "-" || left == "+") && (bottom == "|" || bottom == "'" || bottom == "`" || bottom == "+")) {
502
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
503
+ path.setAttribute(
504
+ "d",
505
+ `
506
+ M 0 24
507
+ A 18 18, 0, 0, 1, 18 42
508
+ L 18 54
509
+ L 12 54
510
+ L 12 42
511
+ A 12 12, 0, 0, 0, 0 30
512
+ Z`
513
+ );
514
+ result.appendChild(path);
515
+ }
516
+
517
+ // top-right
518
+ if ((right == "-" || right == "+") && (top == "|" || top == "." || top == "+")) {
519
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
520
+ path.setAttribute(
521
+ "d",
522
+ `
523
+ M 30 30
524
+ A 18 18, 0, 0, 1, 12 12
525
+ L 12 0
526
+ L 18 0
527
+ L 18 12
528
+ A 12 12, 0, 0, 0, 30 24
529
+ Z`
530
+ );
531
+ result.appendChild(path);
532
+ }
533
+
534
+ // bottom-left
535
+ if ((left == "-" || left == "+") && (top == "|" || top == "." || top == "+")) {
536
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
537
+ path.setAttribute(
538
+ "d",
539
+ `
540
+ M 0 30
541
+ A 18 18, 0, 0, 0, 18 12
542
+ L 18 0
543
+ L 12 0
544
+ L 12 12
545
+ A 12 12, 0, 0, 1, 0 24
546
+ Z`
547
+ );
548
+ result.appendChild(path);
549
+ }
550
+
551
+ // bottom right-topRight
552
+ if (right == "-" && topRight == "/") {
553
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
554
+ path.setAttribute(
555
+ "d",
556
+ `
557
+ M 30 30
558
+ A 12 12, 0, 0, 1, 18 18
559
+ L 18 15
560
+ L 24 15
561
+ L 24 18
562
+ A 6 6, 0, 0, 0, 30 24
563
+ Z`
564
+ );
565
+ result.appendChild(path);
566
+ const line = cross([
567
+ false, // top
568
+ false, // right
569
+ false, // bottom
570
+ false, // left
571
+ true, // topRight
572
+ false, // bottomRight
573
+ false, // bottomLeft
574
+ false, // topLeft
575
+ ]);
576
+ line.setAttribute("clip-path", "polygon(15px -10px, 30px -10px, 30px 30px, 2px 15px)");
577
+ result.appendChild(line);
578
+ }
579
+
580
+ // right-topLeft
581
+ if (right == "-" && topLeft == "\\") {
582
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
583
+ path.setAttribute(
584
+ "d",
585
+ `
586
+ M -3 0
587
+ A 60 60, 0, 0, 0, 30 30
588
+ L 30 24
589
+ A 60 60, 0, 0, 1, 0 -6
590
+ Z`
591
+ );
592
+ result.appendChild(path);
593
+ }
594
+
595
+ // left-topRight
596
+ if (left == "-" && topRight == "/") {
597
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
598
+ path.setAttribute(
599
+ "d",
600
+ `
601
+ M 0 30
602
+ A 60 60, 0, 0, 0, 33 0
603
+ L 30 -6
604
+ A 60 60, 0, 0, 1, 0 24
605
+ Z`
606
+ );
607
+ result.appendChild(path);
608
+ }
609
+
610
+ // bottom left-topLeft
611
+ if (left == "-" && topLeft == "\\") {
612
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
613
+ path.setAttribute(
614
+ "d",
615
+ `
616
+ M 0 30
617
+ A 12 12, 0, 0, 0, 12 18
618
+ L 12 15
619
+ L 6 15
620
+ L 6 18
621
+ A 6 6, 0, 0, 1, 0 24
622
+ Z`
623
+ );
624
+ result.appendChild(path);
625
+ const line = cross([
626
+ false, // top
627
+ false, // right
628
+ false, // bottom
629
+ false, // left
630
+ false, // topRight
631
+ false, // bottomRight
632
+ false, // bottomLeft
633
+ true, // topLeft
634
+ ]);
635
+ line.setAttribute("clip-path", "polygon(-3 -3, 12 -3, 12 18, -3 18)");
636
+ result.appendChild(line);
637
+ }
638
+
639
+ // bottom-topRight
640
+ if (bottom == "|" && topRight == "/") {
641
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
642
+ path.setAttribute(
643
+ "d",
644
+ `
645
+ M 12 54
646
+ A 120 120, 0, 0, 1, 30 -6
647
+ L 37 -6
648
+ A 120 120, 0, 0, 0, 18 54
649
+ Z`
650
+ );
651
+ result.appendChild(path);
652
+ }
653
+
654
+ // top-bottomRight
655
+ if (top == "|" && bottomRight == "\\") {
656
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
657
+ path.setAttribute(
658
+ "d",
659
+ `
660
+ M 30 60
661
+ A 120 120, 0, 0, 1, 12 0
662
+ L 18 0
663
+ A 120 120, 0, 0, 0, 37 60
664
+ Z`
665
+ );
666
+ result.appendChild(path);
667
+ }
668
+
669
+ // top-bottomLeft
670
+ if (top == "|" && bottomLeft == "/") {
671
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
672
+ path.setAttribute(
673
+ "d",
674
+ `
675
+ M 0 60
676
+ A 120 120, 0, 0, 0, 18 0
677
+ L 12 0
678
+ A 120 120, 0, 0, 1, -7 60
679
+ Z`
680
+ );
681
+ result.appendChild(path);
682
+ }
683
+
684
+ // bottom-topLeft
685
+ if (bottom == "|" && topLeft == "\\") {
686
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
687
+ path.setAttribute(
688
+ "d",
689
+ `
690
+ M 12 54
691
+ A 120 120, 0, 0, 0, -7 -6
692
+ L 0 -6
693
+ A 120 120, 0, 0, 1, 18 54
694
+ Z`
695
+ );
696
+ result.appendChild(path);
697
+ }
698
+
699
+ // right-bottomLeft
700
+ if (right == "-" && bottomLeft == "/") {
701
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
702
+ path.setAttribute(
703
+ "d",
704
+ `
705
+ M 0 48
706
+ A 42 42, 0, 0, 1, 30 24
707
+ L 30 30
708
+ A 42 42, 0, 0, 0, 6 48
709
+ Z`
710
+ );
711
+ result.appendChild(path);
712
+ const line = cross([
713
+ false, // top
714
+ false, // right
715
+ false, // bottom
716
+ false, // left
717
+ false, // topRight
718
+ false, // bottomRight
719
+ true, // bottomLeft
720
+ false, // topLeft
721
+ ]);
722
+ line.setAttribute("clip-path", "polygon(-3 15, 12 15, 12 30, -3 30)");
723
+ result.appendChild(line);
724
+ }
725
+
726
+ // left-bottomRight
727
+ if (left == "-" && bottomRight == "\\") {
728
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
729
+ path.setAttribute(
730
+ "d",
731
+ `
732
+ M 0 24
733
+ A 42 42, 0, 0, 1, 30 48
734
+ L 24 48
735
+ A 42 42, 0, 0, 0, 0 30
736
+ Z`
737
+ );
738
+
739
+ result.appendChild(path);
740
+ const line = cross([
741
+ false, // top
742
+ false, // right
743
+ false, // bottom
744
+ false, // left
745
+ false, // topRight
746
+ true, // bottomRight
747
+ false, // bottomLeft
748
+ false, // topLeft
749
+ ]);
750
+ line.setAttribute("clip-path", "polygon(-3 15, 12 15, 21 30, -3 30)");
751
+ result.appendChild(line);
752
+ }
753
+
754
+ // left-bottomLeft
755
+ if (left == "-" && bottomLeft == "/") {
756
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
757
+ path.setAttribute(
758
+ "d",
759
+ `
760
+ M 0 24
761
+ A 12 12, 0, 0, 1, 12 39
762
+ L 6 39
763
+ A 6 6, 0, 0, 0, 0 30
764
+ Z`
765
+ );
766
+ result.appendChild(path);
767
+ const line = cross([
768
+ false, // top
769
+ false, // right
770
+ false, // bottom
771
+ false, // left
772
+ false, // topRight
773
+ false, // bottomRight
774
+ true, // bottomLeft
775
+ false, // topLeft
776
+ ]);
777
+ line.setAttribute("clip-path", "polygon(-3 6, 12 6, 12 30, -3 30)");
778
+ result.appendChild(line);
779
+ }
780
+
781
+ // right-bottomRight
782
+ if (right == "-" && bottomRight == "\\") {
783
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
784
+ path.setAttribute(
785
+ "d",
786
+ `
787
+ M 30 24
788
+ A 12 12, 0, 0, 0, 18 39
789
+ L 24 39
790
+ A 6 6, 0, 0, 1, 30 30
791
+ Z`
792
+ );
793
+ result.appendChild(path);
794
+ const line = cross([
795
+ false, // top
796
+ false, // right
797
+ false, // bottom
798
+ false, // left
799
+ false, // topRight
800
+ true, // bottomRight
801
+ false, // bottomLeft
802
+ false, // topLeft
803
+ ]);
804
+ line.setAttribute("clip-path", "polygon(3 6, 18 6, 18 30, 3 30)");
805
+ result.appendChild(line);
806
+ }
807
+
808
+ // bottomLeft-bottomRight
809
+ if (bottomLeft == "/" && bottomRight == "\\") {
810
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
811
+ path.setAttribute(
812
+ "d",
813
+ `
814
+ M 3 42
815
+ A 15 15, 0, 0, 1, 27 42
816
+ L 25 51
817
+ A 9 9, 0, 0, 0, 5 51
818
+ Z`
819
+ );
820
+ result.appendChild(path);
821
+ const line = cross([
822
+ false, // top
823
+ false, // right
824
+ false, // bottom
825
+ false, // left
826
+ false, // topRight
827
+ true, // bottomRight
828
+ true, // bottomLeft
829
+ false, // topLeft
830
+ ]);
831
+ line.setAttribute("clip-path", "polygon(-3 15, 33 15, 33 30, -3 30)");
832
+ result.appendChild(line);
833
+ }
834
+
835
+ // topLeft-topRight
836
+ if (topLeft == "\\" && topRight == "/") {
837
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
838
+ path.setAttribute(
839
+ "d",
840
+ `
841
+ M 3 12
842
+ A 15 15, 0, 0, 0, 27 12
843
+ L 22 9
844
+ A 9 9, 0, 0, 1, 8 9
845
+ Z`
846
+ );
847
+ result.appendChild(path);
848
+ const line = cross([
849
+ false, // top
850
+ false, // right
851
+ false, // bottom
852
+ false, // left
853
+ true, // topRight
854
+ false, // bottomRight
855
+ false, // bottomLeft
856
+ true, // topLeft
857
+ ]);
858
+ line.setAttribute("clip-path", "polygon(-3 -3, 33 -3, 33 12, -3 12)");
859
+ result.appendChild(line);
860
+ }
861
+
862
+ // topRight-bottomRight
863
+ if (topRight == "/" && bottomRight == "\\") {
864
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
865
+ path.setAttribute(
866
+ "d",
867
+ `
868
+ M 22 9
869
+ A 30 30, 0, 0, 0, 22 45
870
+ L 28 45
871
+ A 30 30, 0, 0, 1, 28 9
872
+ Z`
873
+ );
874
+ result.appendChild(path);
875
+ const line = cross([
876
+ false, // top
877
+ false, // right
878
+ false, // bottom
879
+ false, // left
880
+ true, // topRight
881
+ true, // bottomRight
882
+ false, // bottomLeft
883
+ false, // topLeft
884
+ ]);
885
+ line.setAttribute("clip-path", "polygon(6 -3, 33 -3, 33 57, 6 57)");
886
+ result.appendChild(line);
887
+ }
888
+
889
+ // topLeft-bottomLeft
890
+ if (topLeft == "\\" && bottomLeft == "/") {
891
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
892
+ path.setAttribute(
893
+ "d",
894
+ `
895
+ M 8 9
896
+ A 30 30, 0, 0, 1, 8 45
897
+ L 2 45
898
+ A 30 30, 0, 0, 0, 2 9
899
+ Z`
900
+ );
901
+ result.appendChild(path);
902
+ const line = cross([
903
+ false, // top
904
+ false, // right
905
+ false, // bottom
906
+ false, // left
907
+ false, // topRight
908
+ false, // bottomRight
909
+ true, // bottomLeft
910
+ true, // topLeft
911
+ ]);
912
+ line.setAttribute("clip-path", "polygon(-3 -3, 9 -3, 9 57, -3 57)");
913
+ result.appendChild(line);
914
+ }
915
+
916
+ return result;
917
+ };
918
+
919
+ const alias = {
920
+ "┌": "+",
921
+ "┐": "+",
922
+ "└": "+",
923
+ "┘": "+",
924
+ "─": "-",
925
+ "►": ">",
926
+ "'": ".",
927
+ "`": ".",
928
+ V: "v",
929
+ };
930
+
931
+ for (const [key, value] of Object.entries(alias)) {
932
+ glyphs[key] = (around) => {
933
+ return glyphs[value](around);
934
+ };
935
+ }
936
+
937
+ glyphs[">"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
938
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
939
+ const arrow = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
940
+ arrow.setAttribute("points", "0,0 42,18 0,36");
941
+ let reach = 0;
942
+ if (right == "*" || right == "o" || right == "#") {
943
+ reach -= 18;
944
+ }
945
+ arrow.setAttribute("transform", `translate(${reach} 9)`);
946
+ result.appendChild(arrow);
947
+ return result;
948
+ const center = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
949
+ center.setAttribute("points", "-3,0 6,0 6,6 -3,6");
950
+ center.setAttribute("transform", "translate(15 24)");
951
+ result.appendChild(center);
952
+ result.appendChild(
953
+ cross([
954
+ false, // top
955
+ false, // right
956
+ false, // bottom
957
+ ["-", "+"].includes(left), // left
958
+ false, // topRight
959
+ false, // bottomRight
960
+ ["/"].includes(bottomLeft), // bottomLeft
961
+ ["\\"].includes(topLeft), // topLeft
962
+ ])
963
+ );
964
+ return result;
965
+ };
966
+
967
+ glyphs["<"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
968
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
969
+ const arrow = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
970
+ arrow.setAttribute("points", "0,0 42,18 0,36");
971
+ let reach = 30;
972
+ if (left == "*" || left == "o" || left == "#") {
973
+ reach += 18;
974
+ }
975
+ arrow.setAttribute("transform", `translate(${reach} 9) translate(0 36) rotate(180)`);
976
+ result.appendChild(arrow);
977
+ return result;
978
+ //const center = document.createElementNS(
979
+ // "http://www.w3.org/2000/svg", "polygon");
980
+ //center.setAttribute("points", "0,0 9,0 9,6 0,6");
981
+ //center.setAttribute("transform", "translate(9 24)");
982
+ //result.appendChild(center);
983
+ result.appendChild(
984
+ cross([
985
+ false, // top
986
+ ["-", "+"].includes(right), // right
987
+ false, // bottom
988
+ false, // left
989
+ ["/"].includes(topRight), // topRight
990
+ ["\\"].includes(bottomRight), // bottomRight
991
+ false, // bottomLeft
992
+ false, // topLeft
993
+ ])
994
+ );
995
+ return result;
996
+ };
997
+
998
+ glyphs["v"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
999
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
1000
+ const arrow = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
1001
+ arrow.setAttribute("points", "0,0 42,18 0,36");
1002
+ let reach = 36;
1003
+ if (bottom == " ") {
1004
+ reach = 12;
1005
+ } else if (bottom == "_") {
1006
+ reach += 18;
1007
+ } else if (bottom == "*" || bottom == "o" || bottom == "#") {
1008
+ reach -= 18;
1009
+ }
1010
+ if (topRight == "/") {
1011
+ arrow.setAttribute("transform", `translate(-36 33) rotate(${90 + 22.5}, 42, 18)`);
1012
+ } else if (topLeft == "\\") {
1013
+ arrow.setAttribute("transform", `translate(-18 33) rotate(${90 - 22.5}, 42, 18)`);
1014
+ } else {
1015
+ arrow.setAttribute("transform", `translate(33 ${reach}) rotate(90)`);
1016
+ }
1017
+ result.appendChild(arrow);
1018
+ result.appendChild(
1019
+ cross([
1020
+ ["|", "+"].includes(top), // top
1021
+ false, // right
1022
+ ["|", "+"].includes(top), // bottom
1023
+ false, // left
1024
+ ["/"].includes(topRight), // topRight
1025
+ false, // bottomRight
1026
+ false, // bottomLeft
1027
+ ["\\"].includes(topLeft), // topLeft
1028
+ ])
1029
+ );
1030
+ return result;
1031
+ };
1032
+
1033
+ glyphs["^"] = ([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) => {
1034
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
1035
+ const arrow = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
1036
+ arrow.setAttribute("points", "0,0 42,18 0,36");
1037
+ let reach = 42;
1038
+ if (top == "-") {
1039
+ reach -= 15;
1040
+ }
1041
+ if (bottomLeft == "/") {
1042
+ arrow.setAttribute("transform", `translate(-18 -15) rotate(${-45 - 22.5}, 42, 18)`);
1043
+ } else if (bottomRight == "\\") {
1044
+ arrow.setAttribute("transform", `translate(-36 -15) rotate(${-90 - 22.5}, 42, 18)`);
1045
+ } else {
1046
+ arrow.setAttribute("transform", `translate(-3 ${reach}) rotate(-90)`);
1047
+ }
1048
+ result.appendChild(arrow);
1049
+ result.appendChild(
1050
+ cross([
1051
+ false, // top
1052
+ false, // right
1053
+ ["+", "|"].includes(bottom), // bottom
1054
+ false, // left
1055
+ false, // topRight
1056
+ ["\\"].includes(bottomRight), // bottomRight
1057
+ ["/"].includes(bottomLeft), // bottomLeft
1058
+ false, // topLeft
1059
+ ])
1060
+ );
1061
+ return result;
1062
+ };
1063
+
1064
+ function cross([top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft]) {
1065
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
1066
+ if (top) {
1067
+ // {
1068
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
1069
+ line.setAttribute("x1", 15);
1070
+ line.setAttribute("y1", 0);
1071
+ line.setAttribute("x2", 15);
1072
+ line.setAttribute("y2", 27);
1073
+ line.setAttribute("class", "part");
1074
+ result.appendChild(line);
1075
+ }
1076
+
1077
+ if (right) {
1078
+ //{
1079
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
1080
+ line.setAttribute("x1", 15);
1081
+ line.setAttribute("y1", 27);
1082
+ line.setAttribute("x2", 30);
1083
+ line.setAttribute("y2", 27);
1084
+ line.setAttribute("class", "part");
1085
+ result.appendChild(line);
1086
+ }
1087
+
1088
+ if (bottom) {
1089
+ //{
1090
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
1091
+ line.setAttribute("x1", 15);
1092
+ line.setAttribute("y1", 27);
1093
+ line.setAttribute("x2", 15);
1094
+ line.setAttribute("y2", 54);
1095
+ line.setAttribute("class", "part");
1096
+ result.appendChild(line);
1097
+ }
1098
+
1099
+ if (left) {
1100
+ //{
1101
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
1102
+ line.setAttribute("x1", 0);
1103
+ line.setAttribute("y1", 27);
1104
+ line.setAttribute("x2", 15);
1105
+ line.setAttribute("y2", 27);
1106
+ line.setAttribute("class", "part");
1107
+ result.appendChild(line);
1108
+ }
1109
+
1110
+ const diagonal = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
1111
+
1112
+ diagonal.setAttribute(
1113
+ "points",
1114
+ [
1115
+ [0, 0],
1116
+ [20.6, 0],
1117
+ [20.6, 3],
1118
+ [0, 3],
1119
+ ]
1120
+ .map(([x, y]) => `${x},${y}`)
1121
+ .join(" ")
1122
+ );
1123
+
1124
+ if (topRight) {
1125
+ //{
1126
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
1127
+ line.setAttribute("x1", 30);
1128
+ line.setAttribute("y1", 0);
1129
+ line.setAttribute("x2", 15);
1130
+ line.setAttribute("y2", 27);
1131
+ line.setAttribute("class", "part");
1132
+ // line.setAttribute("transform", "scale(1, 1)");
1133
+ // line.setAttribute("clip-path", "polygon(-6 -6, 15 -6, 15 30, -6 30)");
1134
+ // line.setAttribute("stroke-linecap", "square !important");
1135
+ result.appendChild(line);
1136
+ //const mask = document.createElementNS(
1137
+ // "http://www.w3.org/2000/svg", "polygon");
1138
+ //mask.setAttribute("points", "0 0, 15 0, 15 18, 0 18");
1139
+ //result.appendChild(mask);
1140
+ //console.log("hi");
1141
+ }
1142
+
1143
+ if (bottomRight) {
1144
+ //{
1145
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
1146
+ line.setAttribute("x1", 15);
1147
+ line.setAttribute("y1", 27);
1148
+ line.setAttribute("x2", 30);
1149
+ line.setAttribute("y2", 54);
1150
+ line.setAttribute("class", "part");
1151
+ result.appendChild(line);
1152
+ }
1153
+
1154
+ if (bottomLeft) {
1155
+ // {
1156
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
1157
+ line.setAttribute("x1", 15);
1158
+ line.setAttribute("y1", 27);
1159
+ line.setAttribute("x2", 0);
1160
+ line.setAttribute("y2", 54);
1161
+ line.setAttribute("class", "part");
1162
+ result.appendChild(line);
1163
+ }
1164
+
1165
+ if (topLeft) {
1166
+ //{
1167
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "line");
1168
+ line.setAttribute("x1", 0);
1169
+ line.setAttribute("y1", 0);
1170
+ line.setAttribute("x2", 15);
1171
+ line.setAttribute("y2", 27);
1172
+ line.setAttribute("class", "part");
1173
+ result.appendChild(line);
1174
+ }
1175
+
1176
+ return result;
1177
+ }
1178
+
1179
+ function text(char, reserved) {
1180
+ const g = document.createElementNS("http://www.w3.org/2000/svg", "g");
1181
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "text");
1182
+ //result.setAttribute("xml:space", "preserve");
1183
+ //result.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
1184
+ const value = document.createTextNode(char);
1185
+ result.appendChild(value);
1186
+ if (reserved) {
1187
+ result.setAttribute("class", "reserved");
1188
+ }
1189
+ const translation = [
1190
+ [15, 24],
1191
+ //[1.5, 1.5 * ratio]
1192
+ ];
1193
+ result.setAttribute("transform", translation.map(([x, y]) => `translate(${x}, ${y})`).join(" "));
1194
+ g.appendChild(result);
1195
+ return g;
1196
+ }
1197
+
1198
+ function render(diagram) {
1199
+ const result = document.createElementNS("http://www.w3.org/2000/svg", "g");
1200
+
1201
+ for (let y = 0; y < diagram.length; y++) {
1202
+ for (let x = 0; x < diagram[y].length; x++) {
1203
+ const char = diagram[y][x];
1204
+
1205
+ if (char == " " || char == '"') {
1206
+ continue;
1207
+ }
1208
+
1209
+ let reserved = glyphs[char];
1210
+
1211
+ const g = document.createElementNS("http://www.w3.org/2000/svg", "g");
1212
+
1213
+ let str = false;
1214
+ for (let i = 0; i < x; i++) {
1215
+ if (diagram[y][i] == '"') {
1216
+ str = !str;
1217
+ }
1218
+ }
1219
+
1220
+ const neighbors = around(diagram, [x, y]);
1221
+
1222
+ if (char.match(/[A-Za-z0-9]/)) {
1223
+ const [, right, , left] = neighbors;
1224
+ // We special case "v", which is a down arrow, and also a text character.
1225
+ str = str || left.match(/[A-Za-uw-z0-9]/) || right.match(/[A-Za-uw-z0-9]/);
1226
+ }
1227
+
1228
+ reserved = reserved && !str;
1229
+
1230
+ if (reserved) {
1231
+ g.appendChild(glyphs[char](neighbors));
1232
+ }
1233
+
1234
+ g.appendChild(text(char, reserved));
1235
+
1236
+ g.setAttribute("transform", `translate(${x * 30} ${y * 54})`);
1237
+ result.appendChild(g);
1238
+ }
1239
+ }
1240
+ return result;
1241
+ }
1242
+
1243
+ function create(source, zoom, debug) {
1244
+ const diagram = source.split("\n").map((line) => line.trimEnd().split(""));
1245
+
1246
+ diagram.shift();
1247
+ diagram.splice(-1);
1248
+
1249
+ let width = 0;
1250
+ const height = diagram.length;
1251
+
1252
+ for (let y = 0; y < diagram.length; y++) {
1253
+ for (let x = 0; x < diagram[y].length; x++) {
1254
+ if (diagram[y].length > width) {
1255
+ width = diagram[x].length;
1256
+ }
1257
+ }
1258
+ }
1259
+
1260
+ var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1261
+ svg.setAttribute("width", width * 30 * zoom);
1262
+ svg.setAttribute("height", height * 54 * zoom);
1263
+ svg.setAttribute("debug", debug);
1264
+ const padding = 0;
1265
+
1266
+ svg.setAttribute("viewBox", `${-padding} ${-padding} ${width * 30 + 2 * padding} ${height * 54 + 2 * padding}`);
1267
+ svg.setAttribute("class", "debug");
1268
+ svg.appendChild(render(diagram));
1269
+
1270
+ if (debug) {
1271
+ svg.appendChild(grid(width, height));
1272
+ }
1273
+
1274
+ return svg;
1275
+ }
1276
+
1277
+ function around(diagram, [x, y]) {
1278
+ let left = " ";
1279
+ let top = " ";
1280
+ let right = " ";
1281
+ let bottom = " ";
1282
+ let topRight = " ";
1283
+ let bottomRight = " ";
1284
+ let bottomLeft = " ";
1285
+ let topLeft = " ";
1286
+ if (y > 0) {
1287
+ top = diagram[y - 1][x] || " ";
1288
+ }
1289
+ if (x < diagram[y].length - 1) {
1290
+ right = diagram[y][x + 1] || " ";
1291
+ }
1292
+ if (y < diagram.length - 1) {
1293
+ bottom = diagram[y + 1][x] || " ";
1294
+ }
1295
+ if (x > 0) {
1296
+ left = diagram[y][x - 1] || " ";
1297
+ }
1298
+ if (y > 0 && x < diagram[y - 1].length - 1) {
1299
+ // console.log(`@${diagram[y][x]}: ${diagram[y - 1][x + 1]}`);
1300
+ topRight = diagram[y - 1][x + 1] || " ";
1301
+ }
1302
+ //if (diagram[y][x] == ".") {
1303
+ //console.log(`${diagram[y][x]}}: ${(y + 1) < (diagram.length)}`);
1304
+ //console.log(diagram[y + 1]);
1305
+ //throw new Error("hi");
1306
+ //}
1307
+ if (y + 1 < diagram.length && x < diagram[y + 1].length) {
1308
+ bottomRight = diagram[y + 1][x + 1] || " ";
1309
+ //console.log(diagram[y + 1]);
1310
+ //console.log(`${diagram[y][x]}: ${x} ${y} ${bottomRight}`);
1311
+ //throw new Error("hi");
1312
+ }
1313
+ if (y < diagram.length - 1 && x > 0) {
1314
+ bottomLeft = diagram[y + 1][x - 1] || " ";
1315
+ }
1316
+ if (y > 0 && x > 0) {
1317
+ topLeft = diagram[y - 1][x - 1] || " ";
1318
+ }
1319
+ return [top, right, bottom, left, topRight, bottomRight, bottomLeft, topLeft];
1320
+ //.map((el) => alias[el] ? alias[el] : el);
1321
+ }
1322
+
1323
+ // module.exports = create;
1324
+
1325
+ /* Create typogram as another node and hide the code block, appending the typogram node after it
1326
+ this is done to enable retrieving the code again when changing theme between light/dark */
1327
+ document.addEventListener("readystatechange", () => {
1328
+ if (document.readyState === "complete") {
1329
+ document.querySelectorAll("pre>code.language-typograms").forEach((elem) => {
1330
+ const texData = elem.textContent;
1331
+ const parent = elem.parentElement.parentElement;
1332
+ /* create typograms node */
1333
+ let typogram = document.createElement("pre");
1334
+ typogram.classList.add("typogram");
1335
+ const svg = create("\n" + texData, 0.3, false);
1336
+ typogram.appendChild(svg);
1337
+ parent.appendChild(typogram);
1338
+ parent.removeChild(elem.parentElement);
1339
+ });
1340
+ }
1341
+ });