rendercv-ts 0.1.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.
- package/LICENSE +26 -0
- package/README.md +112 -0
- package/assets/fonts/EB Garamond/EBGaramond-Bold.ttf +0 -0
- package/assets/fonts/EB Garamond/EBGaramond-BoldItalic.ttf +0 -0
- package/assets/fonts/EB Garamond/EBGaramond-Italic.ttf +0 -0
- package/assets/fonts/EB Garamond/EBGaramond-Regular.ttf +0 -0
- package/assets/fonts/Fontin/Fontin-Bold.otf +0 -0
- package/assets/fonts/Fontin/Fontin-Italic.otf +0 -0
- package/assets/fonts/Fontin/Fontin-Regular.otf +0 -0
- package/assets/fonts/Gentium Book Plus/GentiumBookPlus-Bold.ttf +0 -0
- package/assets/fonts/Gentium Book Plus/GentiumBookPlus-BoldItalic.ttf +0 -0
- package/assets/fonts/Gentium Book Plus/GentiumBookPlus-Italic.ttf +0 -0
- package/assets/fonts/Gentium Book Plus/GentiumBookPlus-Regular.ttf +0 -0
- package/assets/fonts/Lato/Lato-Bold.ttf +0 -0
- package/assets/fonts/Lato/Lato-BoldItalic.ttf +0 -0
- package/assets/fonts/Lato/Lato-Italic.ttf +0 -0
- package/assets/fonts/Lato/Lato-Regular.ttf +0 -0
- package/assets/fonts/Raleway/Raleway-Bold.ttf +0 -0
- package/assets/fonts/Raleway/Raleway-BoldItalic.ttf +0 -0
- package/assets/fonts/Raleway/Raleway-Italic.ttf +0 -0
- package/assets/fonts/Raleway/Raleway-Regular.ttf +0 -0
- package/assets/fonts/Source Sans 3/SourceSans3-Bold.ttf +0 -0
- package/assets/fonts/Source Sans 3/SourceSans3-BoldItalic.ttf +0 -0
- package/assets/fonts/Source Sans 3/SourceSans3-Italic.ttf +0 -0
- package/assets/fonts/Source Sans 3/SourceSans3-Regular.ttf +0 -0
- package/assets/fonts/Ubuntu/Ubuntu-Bold.ttf +0 -0
- package/assets/fonts/Ubuntu/Ubuntu-BoldItalic.ttf +0 -0
- package/assets/fonts/Ubuntu/Ubuntu-Italic.ttf +0 -0
- package/assets/fonts/Ubuntu/Ubuntu-Regular.ttf +0 -0
- package/assets/fonts/Vazirmatn/Vazirmatn-Black.ttf +0 -0
- package/assets/fonts/Vazirmatn/Vazirmatn-Bold.ttf +0 -0
- package/assets/fonts/Vazirmatn/Vazirmatn-ExtraBold.ttf +0 -0
- package/assets/fonts/Vazirmatn/Vazirmatn-ExtraLight.ttf +0 -0
- package/assets/fonts/Vazirmatn/Vazirmatn-Light.ttf +0 -0
- package/assets/fonts/Vazirmatn/Vazirmatn-Medium.ttf +0 -0
- package/assets/fonts/Vazirmatn/Vazirmatn-Regular.ttf +0 -0
- package/assets/fonts/Vazirmatn/Vazirmatn-SemiBold.ttf +0 -0
- package/assets/fonts/Vazirmatn/Vazirmatn-Thin.ttf +0 -0
- package/assets/fonts/XCharter/XCharter-Bold.otf +0 -0
- package/assets/fonts/XCharter/XCharter-BoldItalic.otf +0 -0
- package/assets/fonts/XCharter/XCharter-Italic.otf +0 -0
- package/assets/fonts/XCharter/XCharter-Regular.otf +0 -0
- package/assets/wasm/typst_ts_renderer_bg.wasm +0 -0
- package/assets/wasm/typst_ts_web_compiler_bg.wasm +0 -0
- package/dist/asset_paths-Q3SHUESH.js +12 -0
- package/dist/asset_paths-Q3SHUESH.js.map +1 -0
- package/dist/chunk-CJBTP63L.js +94 -0
- package/dist/chunk-CJBTP63L.js.map +1 -0
- package/dist/chunk-EVM6BVMO.js +16 -0
- package/dist/chunk-EVM6BVMO.js.map +1 -0
- package/dist/chunk-QZVXUQ72.js +91 -0
- package/dist/chunk-QZVXUQ72.js.map +1 -0
- package/dist/chunk-VZSMPOAA.js +1012 -0
- package/dist/chunk-VZSMPOAA.js.map +1 -0
- package/dist/font_cache-BZENGUJA.js +84 -0
- package/dist/font_cache-BZENGUJA.js.map +1 -0
- package/dist/font_registry-TJ7PJJTJ.js +183 -0
- package/dist/font_registry-TJ7PJJTJ.js.map +1 -0
- package/dist/index.cjs +9979 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +195 -0
- package/dist/index.d.ts +195 -0
- package/dist/index.js +8396 -0
- package/dist/index.js.map +1 -0
- package/dist/renderer/worker/pdf_worker.cjs +1518 -0
- package/dist/renderer/worker/pdf_worker.cjs.map +1 -0
- package/dist/renderer/worker/pdf_worker.d.cts +24 -0
- package/dist/renderer/worker/pdf_worker.d.ts +24 -0
- package/dist/renderer/worker/pdf_worker.js +51 -0
- package/dist/renderer/worker/pdf_worker.js.map +1 -0
- package/dist/typst_font_cache-LYHXH5UA.js +60 -0
- package/dist/typst_font_cache-LYHXH5UA.js.map +1 -0
- package/dist/typst_setup-SW3GQFSL.js +30 -0
- package/dist/typst_setup-SW3GQFSL.js.map +1 -0
- package/dist/typst_setup-WebjDI32.d.cts +266 -0
- package/dist/typst_setup-WebjDI32.d.ts +266 -0
- package/package.json +80 -0
|
@@ -0,0 +1,1012 @@
|
|
|
1
|
+
// src/renderer/typst_setup.ts
|
|
2
|
+
import {
|
|
3
|
+
createTypstCompiler,
|
|
4
|
+
createTypstFontBuilder,
|
|
5
|
+
createTypstRenderer,
|
|
6
|
+
initOptions
|
|
7
|
+
} from "@myriaddreamin/typst.ts";
|
|
8
|
+
|
|
9
|
+
// src/renderer/assets/rendercv_typst/icons.typ?raw
|
|
10
|
+
var icons_default = '// Auto-generated by scripts/generate-connection-icons.mjs \u2014 do not edit.\n\n#let rendercv-icon-map = (\n "envelope": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M2 4h20v16H2V4zm2 2v.01L12 13l8-6.99V6H4zm16 10V8.5l-8 5.5-8-5.5V16h16z\\"/></svg>",\n "phone": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M6.6 10.8c1.4 2.8 3.8 5.1 6.6 6.6l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.6.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1C10.6 21 3 13.4 3 4c0-.6.4-1 1-1h3.5c.6 0 1 .4 1 1 0 1.3.2 2.5.6 3.6.1.3 0 .7-.2 1L6.6 10.8z\\"/></svg>",\n "link": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M3.9 12c0-1.7 1.3-3 3-3h4V7H6.9C4.2 7 2 9.2 2 11.9c0 2.7 2.2 4.9 4.9 4.9H11v-2H6.9c-1.7 0-3-1.3-3-3zm16.2-5H13v2h4.1c1.7 0 3 1.3 3 3s-1.3 3-3 3H13v2h7.1c2.7 0 4.9-2.2 4.9-4.9 0-2.7-2.2-4.9-4.8-4.9zM8 11h8v2H8v-2z\\"/></svg>",\n "location-dot": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5A2.5 2.5 0 1 1 12 6a2.5 2.5 0 0 1 0 5.5z\\"/></svg>",\n "linkedin": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 1 1 0-4.124 2.062 2.062 0 0 1 0 4.124zM7.119 20.452H3.555V9h3.564v11.452z\\"/></svg>",\n "github": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\\"/></svg>",\n "gitlab": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"m23.6004 9.5927-.0337-.0862L20.3.9814a.851.851 0 0 0-.3362-.405.8748.8748 0 0 0-.9997.0539.8748.8748 0 0 0-.29.4399l-2.2055 6.748H7.5375l-2.2057-6.748a.8573.8573 0 0 0-.29-.4412.8748.8748 0 0 0-.9997-.0537.8585.8585 0 0 0-.3362.4049L.4332 9.5015l-.0325.0862a6.0657 6.0657 0 0 0 2.0119 7.0105l.0113.0087.03.0213 4.976 3.7264 2.462 1.8633 1.4995 1.1321a1.0085 1.0085 0 0 0 1.2197 0l1.4995-1.1321 2.4619-1.8633 5.006-3.7489.0125-.01a6.0682 6.0682 0 0 0 2.0094-7.003z\\"/></svg>",\n "imdb": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M22.3781 0H1.6218C.7411.0583.0587.7437.0018 1.5953l-.001 20.783c.0585.8761.7125 1.543 1.5559 1.6191A.337.337 0 0 0 1.6016 24h20.7971a.4579.4579 0 0 0 .0437-.002c.8727-.0768 1.5568-.8271 1.5568-1.7085V1.7098c0-.8914-.696-1.6416-1.584-1.7078A.3294.3294 0 0 0 22.3781 0zm0 .496a1.2144 1.2144 0 0 1 1.1252 1.2139v20.5797c0 .6377-.4875 1.1602-1.1045 1.2145H1.6016c-.5967-.0543-1.0645-.5297-1.1053-1.1258V1.6284C.5371 1.0185 1.0184.5364 1.6217.496h20.7564zM4.7954 8.2603v7.3636H2.8899V8.2603h1.9055zm6.5367 0v7.3636H9.6707v-4.9704l-.6711 4.9704H7.813l-.6986-4.8618-.0066 4.8618h-1.668V8.2603h2.468c.0748.4476.1492.9694.2307 1.5734l.2712 1.8713.4407-3.4447h2.4817zm2.9772 1.3289c.0742.0404.122.108.1417.2034.0279.0953.0345.3118.0345.6442v2.8548c0 .4881-.0345.7867-.0955.8954-.0609.1152-.2304.1695-.5018.1695V9.5211c.204 0 .3457.0205.4211.0681zm-.0211 6.0347c.4543 0 .8006-.0265 1.0245-.0742.2304-.0477.4204-.1357.5694-.2648.1556-.1218.2642-.298.3251-.5219.0611-.2238.1021-.6648.1021-1.3224v-2.5832c0-.6986-.0271-1.1668-.0742-1.4039-.041-.237-.1431-.4543-.3126-.6437-.1695-.1973-.4198-.3324-.7456-.421-.3191-.0808-.8542-.1285-1.7694-.1285h-1.4244v7.3636h2.3051zm5.14-1.7827c0 .3523-.0199.5762-.0544.6708-.033.0947-.1894.1424-.3046.1424-.1086 0-.19-.0477-.2238-.1351-.041-.0887-.0609-.2986-.0609-.6238v-1.9469c0-.3324.0199-.5423.0543-.6237.0338-.0808.1086-.122.2171-.122.1153 0 .2709.0412.3114.1425.041.0947.0609.2986.0609.6032v1.8926zm-2.4747-5.5809v7.3636h1.7157l.1152-.4675c.1556.1894.3251.3324.5152.4271.1828.0881.4608.1357.678.1357.3047 0 .5629-.0748.7802-.237.2165-.1562.3589-.3462.4198-.5628.0543-.2173.0887-.543.0887-.9841v-2.0675c0-.4409-.0139-.7324-.0344-.8681-.0199-.1357-.0742-.2781-.1695-.4204-.1021-.1425-.2437-.251-.4272-.3325-.1834-.0742-.3999-.1152-.6576-.1152-.2172 0-.4952.0477-.6846.1285-.1835.0887-.353.2238-.5086.4007V8.2603h-1.8309z\\"/></svg>",\n "instagram": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077\\"/></svg>",\n "mastodon": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z\\"/></svg>",\n "orcid": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M12 0C5.372 0 0 5.372 0 12s5.372 12 12 12 12-5.372 12-12S18.628 0 12 0zM7.369 4.378c.525 0 .947.431.947.947s-.422.947-.947.947a.95.95 0 0 1-.947-.947c0-.525.422-.947.947-.947zm-.722 3.038h1.444v10.041H6.647V7.416zm3.562 0h3.9c3.712 0 5.344 2.653 5.344 5.025 0 2.578-2.016 5.025-5.325 5.025h-3.919V7.416zm1.444 1.303v7.444h2.297c3.272 0 4.022-2.484 4.022-3.722 0-2.016-1.284-3.722-4.097-3.722h-2.222z\\"/></svg>",\n "stack-overflow": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M15.725 0l-1.72 1.277 6.39 8.588 1.716-1.277L15.725 0zm-3.94 3.418l-1.369 1.644 8.225 6.85 1.369-1.644-8.225-6.85zm-3.15 4.465l-.905 1.94 9.702 4.517.904-1.94-9.701-4.517zm-1.85 4.86l-.44 2.093 10.473 2.201.44-2.092-10.473-2.203zM1.89 15.47V24h19.19v-8.53h-2.133v6.397H4.021v-6.396H1.89zm4.265 2.133v2.13h10.66v-2.13H6.154Z\\"/></svg>",\n "researchgate": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M19.586 0c-.818 0-1.508.19-2.073.565-.563.377-.97.936-1.213 1.68a3.193 3.193 0 0 0-.112.437 8.365 8.365 0 0 0-.078.53 9 9 0 0 0-.05.727c-.01.282-.013.621-.013 1.016a31.121 31.123 0 0 0 .014 1.017 9 9 0 0 0 .05.727 7.946 7.946 0 0 0 .077.53h-.005a3.334 3.334 0 0 0 .113.438c.245.743.65 1.303 1.214 1.68.565.376 1.256.564 2.075.564.8 0 1.536-.213 2.105-.603.57-.39.94-.916 1.175-1.65.076-.235.135-.558.177-.93a10.9 10.9 0 0 0 .043-1.207v-.82c0-.095-.047-.142-.14-.142h-3.064c-.094 0-.14.047-.14.141v.956c0 .094.046.14.14.14h1.666c.056 0 .084.03.084.086 0 .36 0 .62-.036.865-.038.244-.1.447-.147.606-.108.385-.348.664-.638.876-.29.212-.738.35-1.227.35-.545 0-.901-.15-1.21-.353-.306-.203-.517-.454-.67-.915a3.136 3.136 0 0 1-.147-.762 17.366 17.367 0 0 1-.034-.656c-.01-.26-.014-.572-.014-.939a26.401 26.403 0 0 1 .014-.938 15.821 15.822 0 0 1 .035-.656 3.19 3.19 0 0 1 .148-.76 1.89 1.89 0 0 1 .742-1.01c.344-.244.593-.352 1.137-.352.508 0 .815.096 1.144.303.33.207.528.492.764.925.047.094.111.118.198.07l1.044-.43c.075-.048.09-.115.042-.199a3.549 3.549 0 0 0-.466-.742 3 3 0 0 0-.679-.607 3.313 3.313 0 0 0-.903-.41A4.068 4.068 0 0 0 19.586 0zM8.217 5.836c-1.69 0-3.036.086-4.297.086-1.146 0-2.291 0-3.007-.029v.831l1.088.2c.744.144 1.174.488 1.174 2.264v11.288c0 1.777-.43 2.12-1.174 2.263l-1.088.2v.832c.773-.029 2.12-.086 3.465-.086 1.29 0 2.951.057 3.667.086v-.831l-1.49-.2c-.773-.115-1.174-.487-1.174-2.264v-4.784c.688.057 1.29.057 2.206.057 1.748 3.123 3.41 5.472 4.355 6.56.86 1.032 2.177 1.691 3.839 1.691.487 0 1.003-.086 1.318-.23v-.744c-1.031 0-2.063-.716-2.808-1.518-1.26-1.376-2.95-3.582-4.355-6.074 2.32-.545 4.04-2.722 4.04-4.9 0-3.208-2.492-4.698-5.758-4.698zm-.515 1.29c2.406 0 3.839 1.26 3.839 3.552 0 2.263-1.547 3.782-4.097 3.782-.974 0-1.404-.03-2.063-.086v-7.19c.66-.059 1.547-.059 2.32-.059z\\"/></svg>",\n "youtube": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z\\"/></svg>",\n "graduation-cap": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M12 3 1 9l4 2.2V17c0 .6.4 1 1 1h12c.6 0 1-.4 1-1v-5.8L23 9 12 3zm0 2.2 6.5 3.6L12 12.4 5.5 8.8 12 5.2zM7 17v-4.8l5 2.8 5-2.8V17H7z\\"/></svg>",\n "telegram": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z\\"/></svg>",\n "whatsapp": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z\\"/></svg>",\n "code": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M8.7 15.9 4.8 12l3.9-3.9L7 6.3 2.3 11 7 15.7l1.7-1.8zm6.6 0 1.7 1.8L21.7 12l-4.7-4.7-1.7 1.8L19.2 12l-3.9 3.9z\\"/></svg>",\n "x-twitter": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z\\"/></svg>",\n "bluesky": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M5.202 2.857C7.954 4.922 10.913 9.11 12 11.358c1.087-2.247 4.046-6.436 6.798-8.501C20.783 1.366 24 .213 24 3.883c0 .732-.42 6.156-.667 7.037-.856 3.061-3.978 3.842-6.755 3.37 4.854.826 6.089 3.562 3.422 6.299-5.065 5.196-7.28-1.304-7.847-2.97-.104-.305-.152-.448-.153-.327 0-.121-.05.022-.153.327-.568 1.666-2.782 8.166-7.847 2.97-2.667-2.737-1.432-5.473 3.422-6.3-2.777.473-5.899-.308-6.755-3.369C.42 10.04 0 4.615 0 3.883c0-3.67 3.217-2.517 5.202-1.026\\"/></svg>",\n "reddit": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z\\"/></svg>",\n "external-link": "<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\"><path fill=\\"__FILL__\\" d=\\"M14 3h7v7h-2V6.4l-9.2 9.2-1.4-1.4L17.6 5H14V3zM5 5h6v2H7v10h10v-4h2v6H5V5z\\"/></svg>",\n)\n\n#let rendercv-icon(name, size: 0.9em, fill: rgb(0, 0, 0)) = {\n let svg-template = rendercv-icon-map.at(name, default: rendercv-icon-map.at("link"))\n let svg = svg-template.replace("__FILL__", fill.to-hex())\n box(\n image(bytes(svg), format: "svg", width: size, height: size, alt: ""),\n width: size,\n height: size,\n baseline: 22%,\n )\n}\n';
|
|
11
|
+
|
|
12
|
+
// src/renderer/assets/rendercv_typst/lib.typ?raw
|
|
13
|
+
var lib_default = `#import "icons.typ": rendercv-icon
|
|
14
|
+
|
|
15
|
+
// State to hold rendercv configuration for use by components
|
|
16
|
+
#let rendercv-config = state("rendercv-config", (:))
|
|
17
|
+
|
|
18
|
+
// Direction-aware inset: maps logical start/end to physical left/right.
|
|
19
|
+
// Must be called from within a \`context\` scope.
|
|
20
|
+
#let directional-inset(start: 0cm, end: 0cm) = {
|
|
21
|
+
let is-rtl = rendercv-config.get().at("is-rtl")
|
|
22
|
+
if is-rtl {
|
|
23
|
+
(left: end, right: start)
|
|
24
|
+
} else {
|
|
25
|
+
(left: start, right: end)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#let headline(headline) = {
|
|
30
|
+
metadata("skip-content-area")
|
|
31
|
+
context {
|
|
32
|
+
let config = rendercv-config.get()
|
|
33
|
+
let typography-font-size-headline = config.at("typography-font-size-headline")
|
|
34
|
+
let typography-font-family-headline = config.at("typography-font-family-headline")
|
|
35
|
+
let typography-bold-headline = config.at("typography-bold-headline")
|
|
36
|
+
let colors-headline = config.at("colors-headline")
|
|
37
|
+
let typography-small-caps-headline = config.at("typography-small-caps-headline")
|
|
38
|
+
let header-alignment = config.at("header-alignment")
|
|
39
|
+
let header-space-below-headline = config.at("header-space-below-headline")
|
|
40
|
+
set text(
|
|
41
|
+
fill: colors-headline,
|
|
42
|
+
font: typography-font-family-headline,
|
|
43
|
+
size: typography-font-size-headline,
|
|
44
|
+
weight: if typography-bold-headline { 700 } else { 400 },
|
|
45
|
+
)
|
|
46
|
+
set align(header-alignment)
|
|
47
|
+
block(
|
|
48
|
+
if typography-small-caps-headline { smallcaps(headline) } else { headline },
|
|
49
|
+
width: 100%,
|
|
50
|
+
height: auto,
|
|
51
|
+
)
|
|
52
|
+
v(header-space-below-headline, weak: true)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#let connections(..connections) = {
|
|
57
|
+
metadata("skip-content-area")
|
|
58
|
+
|
|
59
|
+
context {
|
|
60
|
+
let config = rendercv-config.get()
|
|
61
|
+
let typography-line-spacing = config.at("typography-line-spacing")
|
|
62
|
+
let header-connections-space-between-connections = config.at("header-connections-space-between-connections")
|
|
63
|
+
let header-connections-separator = config.at("header-connections-separator")
|
|
64
|
+
let page-left-margin = config.at("page-left-margin")
|
|
65
|
+
let page-right-margin = config.at("page-right-margin")
|
|
66
|
+
let header-space-below-connections = config.at("header-space-below-connections")
|
|
67
|
+
let section-titles-space-above = config.at("section-titles-space-above")
|
|
68
|
+
let colors-connections = config.at("colors-connections")
|
|
69
|
+
let typography-font-family-connections = config.at("typography-font-family-connections")
|
|
70
|
+
let typography-font-size-connections = config.at("typography-font-size-connections")
|
|
71
|
+
let typography-small-caps-connections = config.at("typography-small-caps-connections")
|
|
72
|
+
let typography-bold-connections = config.at("typography-bold-connections")
|
|
73
|
+
let header-alignment = config.at("header-alignment")
|
|
74
|
+
|
|
75
|
+
set par(spacing: 0pt, leading: typography-line-spacing * 1.7, justify: false)
|
|
76
|
+
set text(
|
|
77
|
+
fill: colors-connections,
|
|
78
|
+
font: typography-font-family-connections,
|
|
79
|
+
size: typography-font-size-connections,
|
|
80
|
+
weight: if typography-bold-connections { 700 } else { 400 },
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
let separator = (
|
|
84
|
+
h(header-connections-space-between-connections / 2, weak: true)
|
|
85
|
+
+ header-connections-separator
|
|
86
|
+
+ h(header-connections-space-between-connections / 2, weak: true)
|
|
87
|
+
)
|
|
88
|
+
let separator-width = (
|
|
89
|
+
measure(header-connections-separator).width + header-connections-space-between-connections
|
|
90
|
+
)
|
|
91
|
+
if connections.pos().len() > 0 {
|
|
92
|
+
set align(header-alignment)
|
|
93
|
+
box(
|
|
94
|
+
{
|
|
95
|
+
layout(size => {
|
|
96
|
+
let line-width = 0cm
|
|
97
|
+
for (i, connection) in connections.pos().enumerate() {
|
|
98
|
+
let connection-body = if typography-small-caps-connections { smallcaps(connection) } else { connection }
|
|
99
|
+
let connection-width = measure(connection-body).width
|
|
100
|
+
let is-last = i == connections.pos().len() - 1
|
|
101
|
+
|
|
102
|
+
// Check if adding this connection + separator would exceed the line
|
|
103
|
+
if (
|
|
104
|
+
line-width + connection-width + separator-width > size.width and line-width > 0cm
|
|
105
|
+
) {
|
|
106
|
+
linebreak()
|
|
107
|
+
line-width = 0cm
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Add separator only if we're not at the start of a line
|
|
111
|
+
if line-width > 0cm {
|
|
112
|
+
separator
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
box(connection-body, width: auto)
|
|
116
|
+
line-width = line-width + connection-width + (if line-width > 0cm { separator-width } else { 0cm })
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
},
|
|
120
|
+
width: 100%,
|
|
121
|
+
height: auto,
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
v(header-space-below-connections - section-titles-space-above)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#let original-link = link
|
|
129
|
+
#let link(dest, body, icon: none, if-underline: none, if-color: none) = context {
|
|
130
|
+
let config = rendercv-config.get()
|
|
131
|
+
let links-underline = config.at("links-underline")
|
|
132
|
+
let links-show-external-link-icon = config.at("links-show-external-link-icon")
|
|
133
|
+
let typography-font-size-body = config.at("typography-font-size-body")
|
|
134
|
+
let colors-links = config.at("colors-links")
|
|
135
|
+
|
|
136
|
+
let icon = icon
|
|
137
|
+
if icon == none {
|
|
138
|
+
if links-show-external-link-icon {
|
|
139
|
+
icon = true
|
|
140
|
+
} else {
|
|
141
|
+
icon = false
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
let if-underline = if-underline
|
|
145
|
+
if if-underline == none {
|
|
146
|
+
if links-underline {
|
|
147
|
+
if-underline = true
|
|
148
|
+
} else {
|
|
149
|
+
if-underline = false
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
let if-color = if-color
|
|
153
|
+
if if-color == none {
|
|
154
|
+
if-color = true
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let body = [#if if-underline [#underline(body)] else [#body]]
|
|
158
|
+
if icon {
|
|
159
|
+
let ext-icon-content = rendercv-icon("external-link", size: 0.65em)
|
|
160
|
+
let icon-width = measure(ext-icon-content).width
|
|
161
|
+
// Zero-height box reserves horizontal space but doesn't affect line height
|
|
162
|
+
// or baseline. place() renders the icon out of flow, positioned above the
|
|
163
|
+
// baseline to align visually with text.
|
|
164
|
+
let ext-icon = box(
|
|
165
|
+
width: icon-width,
|
|
166
|
+
height: 0pt,
|
|
167
|
+
baseline: 0pt,
|
|
168
|
+
place(dy: -0.75em, ext-icon-content),
|
|
169
|
+
)
|
|
170
|
+
// Wrap body in box to create BiDi isolation \u2014 the box becomes a neutral
|
|
171
|
+
// atomic inline, so the paragraph direction controls the icon's placement.
|
|
172
|
+
body = [#box[#body]#h(typography-font-size-body / 4)#ext-icon]
|
|
173
|
+
}
|
|
174
|
+
body = [#if if-color [#set text(fill: colors-links);#body] else [#body]]
|
|
175
|
+
original-link(dest, body)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Box around body creates BiDi isolation \u2014 the icon and body are both neutral
|
|
179
|
+
// atomic inlines, so the paragraph direction controls their relative order.
|
|
180
|
+
#let connection-with-icon(icon-name, body) = context {
|
|
181
|
+
let config = rendercv-config.get()
|
|
182
|
+
let colors-connections = config.at("colors-connections")
|
|
183
|
+
let typography-font-size-connections = config.at("typography-font-size-connections")
|
|
184
|
+
let icon-size = typography-font-size-connections * 0.85
|
|
185
|
+
|
|
186
|
+
box(width: auto, baseline: 18%)[
|
|
187
|
+
#rendercv-icon(icon-name, size: icon-size, fill: colors-connections)
|
|
188
|
+
#h(0.1em, weak: true)
|
|
189
|
+
#box(baseline: 0pt)[#body]
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
#let content-area(content) = context {
|
|
194
|
+
let config = rendercv-config.get()
|
|
195
|
+
let entries-side-space = config.at("entries-side-space")
|
|
196
|
+
let entries-date-and-location-width = config.at("entries-date-and-location-width")
|
|
197
|
+
let entries-space-between-columns = config.at("entries-space-between-columns")
|
|
198
|
+
let entries-allow-page-break = config.at("entries-allow-page-break")
|
|
199
|
+
let sections-space-between-text-based-entries = config.at("sections-space-between-text-based-entries")
|
|
200
|
+
let section-titles-type = config.at("section-titles-type")
|
|
201
|
+
let typography-line-spacing = config.at("typography-line-spacing")
|
|
202
|
+
let justify = config.at("justify")
|
|
203
|
+
let entries-highlights-bullet = config.at("entries-highlights-bullet")
|
|
204
|
+
let entries-highlights-nested-bullet = config.at("entries-highlights-nested-bullet")
|
|
205
|
+
let entries-highlights-space-between-bullet-and-text = config.at(
|
|
206
|
+
"entries-highlights-space-between-bullet-and-text",
|
|
207
|
+
)
|
|
208
|
+
let start-align = config.at("start-align")
|
|
209
|
+
|
|
210
|
+
let start-space = entries-side-space
|
|
211
|
+
if section-titles-type == "moderncv" {
|
|
212
|
+
start-space = (
|
|
213
|
+
start-space + entries-date-and-location-width + entries-space-between-columns
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
set par(
|
|
218
|
+
spacing: sections-space-between-text-based-entries + typography-line-spacing,
|
|
219
|
+
leading: typography-line-spacing,
|
|
220
|
+
justify: justify,
|
|
221
|
+
)
|
|
222
|
+
set align(start-align)
|
|
223
|
+
set enum(
|
|
224
|
+
spacing: sections-space-between-text-based-entries + typography-line-spacing,
|
|
225
|
+
)
|
|
226
|
+
set list(
|
|
227
|
+
marker: (entries-highlights-bullet, entries-highlights-nested-bullet),
|
|
228
|
+
indent: 0cm,
|
|
229
|
+
spacing: sections-space-between-text-based-entries + typography-line-spacing,
|
|
230
|
+
body-indent: entries-highlights-space-between-bullet-and-text,
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
block(
|
|
234
|
+
content,
|
|
235
|
+
breakable: entries-allow-page-break,
|
|
236
|
+
below: sections-space-between-text-based-entries + typography-line-spacing,
|
|
237
|
+
inset: directional-inset(start: start-space, end: entries-side-space),
|
|
238
|
+
width: 100%,
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
#let summary(summary) = {
|
|
243
|
+
context {
|
|
244
|
+
let config = rendercv-config.get()
|
|
245
|
+
let entries-summary-space-left = config.at("entries-summary-space-left")
|
|
246
|
+
let entries-summary-space-above = config.at("entries-summary-space-above")
|
|
247
|
+
let typography-line-spacing = config.at("typography-line-spacing")
|
|
248
|
+
block(
|
|
249
|
+
summary,
|
|
250
|
+
inset: directional-inset(start: entries-summary-space-left),
|
|
251
|
+
above: entries-summary-space-above + typography-line-spacing,
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
#let regular-entry(main-column, date-and-location-column, main-column-second-row: none) = {
|
|
257
|
+
metadata("skip-content-area")
|
|
258
|
+
|
|
259
|
+
context {
|
|
260
|
+
let config = rendercv-config.get()
|
|
261
|
+
let section-titles-type = config.at("section-titles-type")
|
|
262
|
+
let entries-date-and-location-width = config.at("entries-date-and-location-width")
|
|
263
|
+
let entries-space-between-columns = config.at("entries-space-between-columns")
|
|
264
|
+
let entries-highlights-bullet = config.at("entries-highlights-bullet")
|
|
265
|
+
let entries-highlights-nested-bullet = config.at("entries-highlights-nested-bullet")
|
|
266
|
+
let entries-highlights-space-between-items = config.at(
|
|
267
|
+
"entries-highlights-space-between-items",
|
|
268
|
+
)
|
|
269
|
+
let entries-highlights-space-between-bullet-and-text = config.at(
|
|
270
|
+
"entries-highlights-space-between-bullet-and-text",
|
|
271
|
+
)
|
|
272
|
+
let entries-highlights-space-above = config.at("entries-highlights-space-above")
|
|
273
|
+
let typography-line-spacing = config.at("typography-line-spacing")
|
|
274
|
+
let entries-allow-page-break = config.at("entries-allow-page-break")
|
|
275
|
+
let sections-space-between-regular-entries = config.at("sections-space-between-regular-entries")
|
|
276
|
+
let entries-side-space = config.at("entries-side-space")
|
|
277
|
+
let justify = config.at("justify")
|
|
278
|
+
let typography-date-and-location-column-alignment = config.at("typography-date-and-location-column-alignment")
|
|
279
|
+
let entries-highlights-space-left = config.at("entries-highlights-space-left")
|
|
280
|
+
let start-align = config.at("start-align")
|
|
281
|
+
|
|
282
|
+
set list(
|
|
283
|
+
marker: (entries-highlights-bullet, entries-highlights-nested-bullet),
|
|
284
|
+
indent: entries-highlights-space-left,
|
|
285
|
+
spacing: entries-highlights-space-between-items + typography-line-spacing,
|
|
286
|
+
body-indent: entries-highlights-space-between-bullet-and-text,
|
|
287
|
+
)
|
|
288
|
+
let list-depth = state("list-depth", 0)
|
|
289
|
+
show list.item: i => {
|
|
290
|
+
list-depth.update(d => d + 1)
|
|
291
|
+
i
|
|
292
|
+
list-depth.update(d => d - 1)
|
|
293
|
+
}
|
|
294
|
+
show list: l => {
|
|
295
|
+
context if list-depth.get() == 1 {
|
|
296
|
+
v(entries-highlights-space-above)
|
|
297
|
+
}
|
|
298
|
+
context if list-depth.get() == 2 {
|
|
299
|
+
v(entries-highlights-space-between-items)
|
|
300
|
+
}
|
|
301
|
+
l
|
|
302
|
+
}
|
|
303
|
+
set par(
|
|
304
|
+
spacing: typography-line-spacing,
|
|
305
|
+
leading: typography-line-spacing,
|
|
306
|
+
justify: justify,
|
|
307
|
+
)
|
|
308
|
+
block(
|
|
309
|
+
{
|
|
310
|
+
if section-titles-type == "moderncv" {
|
|
311
|
+
grid(
|
|
312
|
+
columns: (entries-date-and-location-width, 1fr),
|
|
313
|
+
column-gutter: entries-space-between-columns,
|
|
314
|
+
align: (typography-date-and-location-column-alignment, start-align),
|
|
315
|
+
[
|
|
316
|
+
#date-and-location-column
|
|
317
|
+
],
|
|
318
|
+
[
|
|
319
|
+
#main-column
|
|
320
|
+
|
|
321
|
+
#main-column-second-row
|
|
322
|
+
],
|
|
323
|
+
)
|
|
324
|
+
} else {
|
|
325
|
+
if repr(main-column) != "[ ]" or repr(date-and-location-column) != "[ ]" {
|
|
326
|
+
grid(
|
|
327
|
+
columns: (1fr, entries-date-and-location-width),
|
|
328
|
+
column-gutter: entries-space-between-columns,
|
|
329
|
+
align: (start-align, typography-date-and-location-column-alignment),
|
|
330
|
+
main-column, date-and-location-column,
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
set align(start-align)
|
|
334
|
+
main-column-second-row
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
breakable: entries-allow-page-break,
|
|
338
|
+
below: sections-space-between-regular-entries + typography-line-spacing,
|
|
339
|
+
inset: (
|
|
340
|
+
left: entries-side-space,
|
|
341
|
+
right: entries-side-space,
|
|
342
|
+
),
|
|
343
|
+
width: 100%,
|
|
344
|
+
)
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
#let education-entry(main-column, date-and-location-column, degree-column: none, main-column-second-row: none) = {
|
|
349
|
+
metadata("skip-content-area")
|
|
350
|
+
|
|
351
|
+
context {
|
|
352
|
+
let config = rendercv-config.get()
|
|
353
|
+
let entries-space-between-columns = config.at("entries-space-between-columns")
|
|
354
|
+
let entries-degree-width = config.at("entries-degree-width")
|
|
355
|
+
let start-align = config.at("start-align")
|
|
356
|
+
|
|
357
|
+
regular-entry(
|
|
358
|
+
if degree-column != none {
|
|
359
|
+
grid(
|
|
360
|
+
columns: (entries-degree-width, 1fr),
|
|
361
|
+
column-gutter: entries-space-between-columns,
|
|
362
|
+
align: (start-align, auto),
|
|
363
|
+
[
|
|
364
|
+
#degree-column
|
|
365
|
+
],
|
|
366
|
+
[
|
|
367
|
+
#main-column
|
|
368
|
+
],
|
|
369
|
+
)
|
|
370
|
+
} else {
|
|
371
|
+
main-column
|
|
372
|
+
},
|
|
373
|
+
date-and-location-column,
|
|
374
|
+
main-column-second-row: if main-column-second-row != none and repr(main-column-second-row) != "[ ]" {
|
|
375
|
+
[
|
|
376
|
+
#block(
|
|
377
|
+
main-column-second-row,
|
|
378
|
+
inset: directional-inset(
|
|
379
|
+
start: if degree-column != none { entries-degree-width + entries-space-between-columns } else { 0cm },
|
|
380
|
+
),
|
|
381
|
+
)
|
|
382
|
+
]
|
|
383
|
+
} else { none },
|
|
384
|
+
)
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
#let reversed-numbered-entries(entries) = {
|
|
389
|
+
set enum(reversed: true)
|
|
390
|
+
entries
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
#let rendercv(
|
|
394
|
+
doc,
|
|
395
|
+
name: "John Doe",
|
|
396
|
+
title: "John Doe's CV",
|
|
397
|
+
footer: context { "Page " + str(here().page()) + " of " + str(counter(page).final().first()) + "" },
|
|
398
|
+
top-note: "Last updated in " + datetime.today().display(),
|
|
399
|
+
locale-catalog-language: "en",
|
|
400
|
+
text-direction: ltr,
|
|
401
|
+
page-size: "us-letter",
|
|
402
|
+
page-top-margin: 0.7in,
|
|
403
|
+
page-bottom-margin: 0.7in,
|
|
404
|
+
page-left-margin: 0.7in,
|
|
405
|
+
page-right-margin: 0.7in,
|
|
406
|
+
page-show-footer: true,
|
|
407
|
+
page-show-top-note: true,
|
|
408
|
+
colors-body: rgb(0, 0, 0),
|
|
409
|
+
colors-name: rgb(0, 79, 144),
|
|
410
|
+
colors-headline: rgb(0, 79, 144),
|
|
411
|
+
colors-connections: rgb(0, 79, 144),
|
|
412
|
+
colors-section-titles: rgb(0, 79, 144),
|
|
413
|
+
colors-links: rgb(0, 79, 144),
|
|
414
|
+
colors-footer: rgb(128, 128, 128),
|
|
415
|
+
colors-top-note: rgb(128, 128, 128),
|
|
416
|
+
typography-line-spacing: 0.6em,
|
|
417
|
+
typography-alignment: "justified",
|
|
418
|
+
typography-date-and-location-column-alignment: right,
|
|
419
|
+
typography-font-family-body: "Raleway",
|
|
420
|
+
typography-font-family-name: "Raleway",
|
|
421
|
+
typography-font-family-headline: "Raleway",
|
|
422
|
+
typography-font-family-connections: "Raleway",
|
|
423
|
+
typography-font-family-section-titles: "Raleway",
|
|
424
|
+
typography-font-size-body: 10pt,
|
|
425
|
+
typography-font-size-name: 30pt,
|
|
426
|
+
typography-font-size-headline: 10pt,
|
|
427
|
+
typography-font-size-connections: 10pt,
|
|
428
|
+
typography-font-size-section-titles: 1.4em,
|
|
429
|
+
typography-small-caps-name: false,
|
|
430
|
+
typography-small-caps-headline: false,
|
|
431
|
+
typography-small-caps-connections: false,
|
|
432
|
+
typography-small-caps-section-titles: false,
|
|
433
|
+
typography-bold-name: false,
|
|
434
|
+
typography-bold-headline: false,
|
|
435
|
+
typography-bold-connections: false,
|
|
436
|
+
typography-bold-section-titles: false,
|
|
437
|
+
links-underline: false,
|
|
438
|
+
links-show-external-link-icon: false,
|
|
439
|
+
header-alignment: left,
|
|
440
|
+
header-photo-width: 3.5cm,
|
|
441
|
+
header-space-below-name: 0.7cm,
|
|
442
|
+
header-space-below-headline: 0.7cm,
|
|
443
|
+
header-space-below-connections: 0.7cm,
|
|
444
|
+
header-connections-hyperlink: true,
|
|
445
|
+
header-connections-show-icons: true,
|
|
446
|
+
header-connections-display-urls-instead-of-usernames: false,
|
|
447
|
+
header-connections-separator: "",
|
|
448
|
+
header-connections-space-between-connections: 0.5cm,
|
|
449
|
+
section-titles-type: "with_full_line",
|
|
450
|
+
section-titles-line-thickness: 0.5pt,
|
|
451
|
+
section-titles-space-above: 0.5cm,
|
|
452
|
+
section-titles-space-below: 0.3cm,
|
|
453
|
+
sections-allow-page-break: true,
|
|
454
|
+
sections-space-between-text-based-entries: 0.3em,
|
|
455
|
+
sections-space-between-regular-entries: 1.2em,
|
|
456
|
+
entries-date-and-location-width: 4.15cm,
|
|
457
|
+
entries-side-space: 0.2cm,
|
|
458
|
+
entries-space-between-columns: 0.1cm,
|
|
459
|
+
entries-allow-page-break: false,
|
|
460
|
+
entries-short-second-row: false,
|
|
461
|
+
entries-degree-width: 1cm,
|
|
462
|
+
entries-summary-space-left: 0cm,
|
|
463
|
+
entries-summary-space-above: 0.12cm,
|
|
464
|
+
entries-highlights-bullet: "\u2022",
|
|
465
|
+
entries-highlights-nested-bullet: "\u2022",
|
|
466
|
+
entries-highlights-space-left: 0cm,
|
|
467
|
+
entries-highlights-space-above: 0.12cm,
|
|
468
|
+
entries-highlights-space-between-items: 0.12cm,
|
|
469
|
+
entries-highlights-space-between-bullet-and-text: 0.5em,
|
|
470
|
+
date: datetime(
|
|
471
|
+
year: 2025,
|
|
472
|
+
month: 12,
|
|
473
|
+
day: 5,
|
|
474
|
+
),
|
|
475
|
+
) = [
|
|
476
|
+
#let (justify, hyphenate) = (
|
|
477
|
+
"justified": (true, true),
|
|
478
|
+
"left": (false, false),
|
|
479
|
+
"justified-with-no-hyphenation": (true, false),
|
|
480
|
+
).at(typography-alignment)
|
|
481
|
+
|
|
482
|
+
#let is-rtl = text-direction == rtl
|
|
483
|
+
#let start-align = if is-rtl { right } else { left }
|
|
484
|
+
#let end-align = if is-rtl { left } else { right }
|
|
485
|
+
|
|
486
|
+
// Initialize state with all configuration parameters
|
|
487
|
+
#rendercv-config.update((
|
|
488
|
+
// Direction
|
|
489
|
+
text-direction: text-direction,
|
|
490
|
+
is-rtl: is-rtl,
|
|
491
|
+
start-align: start-align,
|
|
492
|
+
// Page
|
|
493
|
+
page-left-margin: page-left-margin,
|
|
494
|
+
page-right-margin: page-right-margin,
|
|
495
|
+
// Colors
|
|
496
|
+
colors-body: colors-body,
|
|
497
|
+
colors-name: colors-name,
|
|
498
|
+
colors-headline: colors-headline,
|
|
499
|
+
colors-connections: colors-connections,
|
|
500
|
+
colors-section-titles: colors-section-titles,
|
|
501
|
+
colors-links: colors-links,
|
|
502
|
+
colors-footer: colors-footer,
|
|
503
|
+
colors-top-note: colors-top-note,
|
|
504
|
+
// Typography
|
|
505
|
+
typography-line-spacing: typography-line-spacing,
|
|
506
|
+
typography-alignment: typography-alignment,
|
|
507
|
+
typography-date-and-location-column-alignment: typography-date-and-location-column-alignment,
|
|
508
|
+
typography-font-family-body: typography-font-family-body,
|
|
509
|
+
typography-font-family-name: typography-font-family-name,
|
|
510
|
+
typography-font-family-headline: typography-font-family-headline,
|
|
511
|
+
typography-font-family-connections: typography-font-family-connections,
|
|
512
|
+
typography-font-family-section-titles: typography-font-family-section-titles,
|
|
513
|
+
typography-font-size-body: typography-font-size-body,
|
|
514
|
+
typography-font-size-name: typography-font-size-name,
|
|
515
|
+
typography-font-size-headline: typography-font-size-headline,
|
|
516
|
+
typography-font-size-connections: typography-font-size-connections,
|
|
517
|
+
typography-font-size-section-titles: typography-font-size-section-titles,
|
|
518
|
+
typography-small-caps-name: typography-small-caps-name,
|
|
519
|
+
typography-small-caps-headline: typography-small-caps-headline,
|
|
520
|
+
typography-small-caps-connections: typography-small-caps-connections,
|
|
521
|
+
typography-small-caps-section-titles: typography-small-caps-section-titles,
|
|
522
|
+
typography-bold-name: typography-bold-name,
|
|
523
|
+
typography-bold-headline: typography-bold-headline,
|
|
524
|
+
typography-bold-connections: typography-bold-connections,
|
|
525
|
+
typography-bold-section-titles: typography-bold-section-titles,
|
|
526
|
+
// Links
|
|
527
|
+
links-underline: links-underline,
|
|
528
|
+
links-show-external-link-icon: links-show-external-link-icon,
|
|
529
|
+
// Header
|
|
530
|
+
header-alignment: header-alignment,
|
|
531
|
+
header-photo-width: header-photo-width,
|
|
532
|
+
header-space-below-name: header-space-below-name,
|
|
533
|
+
header-space-below-headline: header-space-below-headline,
|
|
534
|
+
header-space-below-connections: header-space-below-connections,
|
|
535
|
+
header-connections-hyperlink: header-connections-hyperlink,
|
|
536
|
+
header-connections-show-icons: header-connections-show-icons,
|
|
537
|
+
header-connections-display-urls-instead-of-usernames: header-connections-display-urls-instead-of-usernames,
|
|
538
|
+
header-connections-separator: header-connections-separator,
|
|
539
|
+
header-connections-space-between-connections: header-connections-space-between-connections,
|
|
540
|
+
// Section titles
|
|
541
|
+
section-titles-type: section-titles-type,
|
|
542
|
+
section-titles-line-thickness: section-titles-line-thickness,
|
|
543
|
+
section-titles-space-above: section-titles-space-above,
|
|
544
|
+
section-titles-space-below: section-titles-space-below,
|
|
545
|
+
// Sections
|
|
546
|
+
sections-allow-page-break: sections-allow-page-break,
|
|
547
|
+
sections-space-between-regular-entries: sections-space-between-regular-entries,
|
|
548
|
+
sections-space-between-text-based-entries: sections-space-between-text-based-entries,
|
|
549
|
+
// Entries
|
|
550
|
+
entries-date-and-location-width: entries-date-and-location-width,
|
|
551
|
+
entries-side-space: entries-side-space,
|
|
552
|
+
entries-space-between-columns: entries-space-between-columns,
|
|
553
|
+
entries-allow-page-break: entries-allow-page-break,
|
|
554
|
+
entries-summary-space-left: entries-summary-space-left,
|
|
555
|
+
entries-summary-space-above: entries-summary-space-above,
|
|
556
|
+
entries-highlights-bullet: entries-highlights-bullet,
|
|
557
|
+
entries-highlights-nested-bullet: entries-highlights-nested-bullet,
|
|
558
|
+
entries-highlights-space-left: entries-highlights-space-left,
|
|
559
|
+
entries-highlights-space-above: entries-highlights-space-above,
|
|
560
|
+
entries-highlights-space-between-items: entries-highlights-space-between-items,
|
|
561
|
+
entries-highlights-space-between-bullet-and-text: entries-highlights-space-between-bullet-and-text,
|
|
562
|
+
entries-degree-width: entries-degree-width,
|
|
563
|
+
// Internal computed values
|
|
564
|
+
justify: justify,
|
|
565
|
+
))
|
|
566
|
+
|
|
567
|
+
// Metadata:
|
|
568
|
+
#set document(author: name, title: title, date: date)
|
|
569
|
+
|
|
570
|
+
// Page:
|
|
571
|
+
#set page(
|
|
572
|
+
margin: (
|
|
573
|
+
top: page-top-margin,
|
|
574
|
+
bottom: page-bottom-margin,
|
|
575
|
+
left: page-left-margin,
|
|
576
|
+
right: page-right-margin,
|
|
577
|
+
),
|
|
578
|
+
paper: page-size,
|
|
579
|
+
footer: if page-show-footer and footer != none and footer != "" {
|
|
580
|
+
text(
|
|
581
|
+
fill: colors-footer,
|
|
582
|
+
align(center, [#footer]),
|
|
583
|
+
size: 0.9em,
|
|
584
|
+
)
|
|
585
|
+
} else {
|
|
586
|
+
none
|
|
587
|
+
},
|
|
588
|
+
footer-descent: 0% - 0.6em + page-bottom-margin / 2,
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
// Text:
|
|
592
|
+
#set text(
|
|
593
|
+
font: typography-font-family-body,
|
|
594
|
+
size: typography-font-size-body,
|
|
595
|
+
lang: locale-catalog-language,
|
|
596
|
+
dir: text-direction,
|
|
597
|
+
hyphenate: hyphenate,
|
|
598
|
+
fill: colors-body,
|
|
599
|
+
// Disable ligatures for better ATS compatibility:
|
|
600
|
+
ligatures: true,
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
// Main heading (name):
|
|
604
|
+
#show heading.where(level: 1): it => [
|
|
605
|
+
#set par(spacing: 0pt)
|
|
606
|
+
#set align(header-alignment)
|
|
607
|
+
#set text(
|
|
608
|
+
font: typography-font-family-name,
|
|
609
|
+
size: typography-font-size-name,
|
|
610
|
+
fill: colors-name,
|
|
611
|
+
weight: if typography-bold-name { 700 } else { 400 },
|
|
612
|
+
)
|
|
613
|
+
#let body
|
|
614
|
+
#if typography-small-caps-name {
|
|
615
|
+
body = [#smallcaps(it.body)]
|
|
616
|
+
} else {
|
|
617
|
+
body = [#it.body]
|
|
618
|
+
}
|
|
619
|
+
#body
|
|
620
|
+
// Vertical space after the name
|
|
621
|
+
#v(header-space-below-name, weak: true)
|
|
622
|
+
]
|
|
623
|
+
|
|
624
|
+
// Section titles:
|
|
625
|
+
#show heading.where(level: 2): it => [
|
|
626
|
+
#let is-centered = section-titles-type in ("centered_without_line", "centered_with_partial_line", "centered_with_centered_partial_line", "centered_with_full_line")
|
|
627
|
+
#set align(if is-centered { center } else { start-align })
|
|
628
|
+
#set text(size: (1em / 1.2)) // reset
|
|
629
|
+
#set text(
|
|
630
|
+
font: typography-font-family-section-titles,
|
|
631
|
+
size: (typography-font-size-section-titles),
|
|
632
|
+
weight: if typography-bold-section-titles { 700 } else { 400 },
|
|
633
|
+
fill: colors-section-titles,
|
|
634
|
+
)
|
|
635
|
+
#let section-title = (
|
|
636
|
+
if typography-small-caps-section-titles [
|
|
637
|
+
#smallcaps(it.body)
|
|
638
|
+
] else [
|
|
639
|
+
#it.body
|
|
640
|
+
]
|
|
641
|
+
)
|
|
642
|
+
// Vertical space above the section title
|
|
643
|
+
#v(section-titles-space-above, weak: true)
|
|
644
|
+
|
|
645
|
+
#block(
|
|
646
|
+
breakable: false,
|
|
647
|
+
width: 100%,
|
|
648
|
+
[
|
|
649
|
+
#if section-titles-type == "moderncv" [
|
|
650
|
+
#grid(
|
|
651
|
+
columns: (entries-date-and-location-width + entries-side-space, 1fr),
|
|
652
|
+
column-gutter: entries-space-between-columns,
|
|
653
|
+
align: (end-align, start-align),
|
|
654
|
+
[
|
|
655
|
+
#align(horizon, box(
|
|
656
|
+
width: 1fr,
|
|
657
|
+
height: section-titles-line-thickness,
|
|
658
|
+
fill: colors-section-titles,
|
|
659
|
+
))
|
|
660
|
+
],
|
|
661
|
+
[
|
|
662
|
+
#section-title
|
|
663
|
+
],
|
|
664
|
+
)
|
|
665
|
+
] else if section-titles-type == "centered_without_line" [
|
|
666
|
+
#section-title
|
|
667
|
+
] else if section-titles-type == "centered_with_partial_line" [
|
|
668
|
+
#grid(
|
|
669
|
+
columns: (1fr, auto, 1fr),
|
|
670
|
+
align: (bottom, center + bottom, bottom),
|
|
671
|
+
column-gutter: 0.3em,
|
|
672
|
+
[#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)],
|
|
673
|
+
[#section-title],
|
|
674
|
+
[#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)],
|
|
675
|
+
)
|
|
676
|
+
] else if section-titles-type == "centered_with_centered_partial_line" [
|
|
677
|
+
#grid(
|
|
678
|
+
columns: (1fr, auto, 1fr),
|
|
679
|
+
align: (horizon, center, horizon),
|
|
680
|
+
column-gutter: 0.3em,
|
|
681
|
+
[#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)],
|
|
682
|
+
[#section-title],
|
|
683
|
+
[#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)],
|
|
684
|
+
)
|
|
685
|
+
] else if section-titles-type == "centered_with_full_line" [
|
|
686
|
+
#section-title
|
|
687
|
+
#v(typography-font-size-body * 0.3)
|
|
688
|
+
#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)
|
|
689
|
+
] else [
|
|
690
|
+
#section-title
|
|
691
|
+
#if section-titles-type == "with_partial_line" [
|
|
692
|
+
#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)
|
|
693
|
+
] else if section-titles-type == "with_full_line" [
|
|
694
|
+
|
|
695
|
+
#v(typography-font-size-body * 0.3)
|
|
696
|
+
#box(width: 1fr, height: section-titles-line-thickness, fill: colors-section-titles)
|
|
697
|
+
]
|
|
698
|
+
]
|
|
699
|
+
],
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
// Vertical space after the section title
|
|
703
|
+
#v(section-titles-space-below - 0.5em)
|
|
704
|
+
]
|
|
705
|
+
|
|
706
|
+
// Top note:
|
|
707
|
+
#if page-show-top-note and top-note != none and top-note != "" {
|
|
708
|
+
let dx = if is-rtl { entries-side-space } else { -entries-side-space }
|
|
709
|
+
place(
|
|
710
|
+
top + end-align,
|
|
711
|
+
dy: -page-top-margin / 2,
|
|
712
|
+
dx: dx,
|
|
713
|
+
text(
|
|
714
|
+
[#top-note],
|
|
715
|
+
fill: colors-top-note,
|
|
716
|
+
size: 0.9em,
|
|
717
|
+
),
|
|
718
|
+
)
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// From: https://github.com/typst/typst/issues/2666
|
|
722
|
+
#let group-sections(content) = {
|
|
723
|
+
let sections = ()
|
|
724
|
+
let preamble = () // Content before any heading
|
|
725
|
+
|
|
726
|
+
for element in content.children {
|
|
727
|
+
if element.func() == heading {
|
|
728
|
+
// Push a new section
|
|
729
|
+
sections.push((element, ()))
|
|
730
|
+
} else if sections.len() > 0 {
|
|
731
|
+
// Add to current section
|
|
732
|
+
sections.last().at(1).push(element)
|
|
733
|
+
} else {
|
|
734
|
+
// No heading yet - this is preamble content
|
|
735
|
+
preamble.push(element)
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// Join the content in each section
|
|
740
|
+
let result = sections.map(it => {
|
|
741
|
+
let (title, content) = it
|
|
742
|
+
(title, content.join())
|
|
743
|
+
})
|
|
744
|
+
|
|
745
|
+
// Return both preamble and sections
|
|
746
|
+
(preamble: preamble.join(), sections: result)
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
#set par(spacing: 0cm)
|
|
750
|
+
|
|
751
|
+
#let grouped = group-sections(doc)
|
|
752
|
+
|
|
753
|
+
// Render preamble content (before any heading)
|
|
754
|
+
#if grouped.preamble != none and grouped.preamble.func() != parbreak [
|
|
755
|
+
#block(breakable: sections-allow-page-break)[
|
|
756
|
+
#grouped.preamble
|
|
757
|
+
]
|
|
758
|
+
]
|
|
759
|
+
|
|
760
|
+
// Render sections as before
|
|
761
|
+
#for (section-title, section-content) in grouped.sections [
|
|
762
|
+
#section-title
|
|
763
|
+
#let should-skip = {
|
|
764
|
+
let skip = false
|
|
765
|
+
if section-content != none and section-content.has("children") {
|
|
766
|
+
for child in section-content.children {
|
|
767
|
+
if child.func() == metadata and child.value == "skip-content-area" {
|
|
768
|
+
skip = true
|
|
769
|
+
break
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
skip
|
|
774
|
+
}
|
|
775
|
+
#if section-content != none and section-content.func() != parbreak [
|
|
776
|
+
#block(breakable: sections-allow-page-break)[
|
|
777
|
+
#if should-skip [
|
|
778
|
+
#section-content
|
|
779
|
+
] else [
|
|
780
|
+
#content-area(section-content)
|
|
781
|
+
]
|
|
782
|
+
]
|
|
783
|
+
]
|
|
784
|
+
]
|
|
785
|
+
]
|
|
786
|
+
`;
|
|
787
|
+
|
|
788
|
+
// src/renderer/assets/rendercv_typst/typst.toml?raw
|
|
789
|
+
var typst_default = '[package]\nname = "rendercv"\nversion = "0.3.0"\nentrypoint = "lib.typ"\nauthors = ["Sina Atalay <dev@atalay.biz>"]\nlicense = "MIT"\ndescription = "Resume builder for academics and engineers"\nrepository = "https://github.com/rendercv/rendercv"\nkeywords = ["rendercv", "cv", "resume", "curriculum-vitae"]\ncategories = ["cv"]\ndisciplines = []\ncompiler = "0.14.0"\nexclude = ["examples/*.pdf"]\n\n[template]\npath = "template"\nentrypoint = "main.typ"\nthumbnail = "thumbnail.png"\n';
|
|
790
|
+
|
|
791
|
+
// src/renderer/typst_setup.ts
|
|
792
|
+
var RENDERCV_PACKAGE_VERSION = readPackageVersion(typst_default);
|
|
793
|
+
var MAIN_TYP_PATH = "/main.typ";
|
|
794
|
+
var TYPST_ROOT = "/";
|
|
795
|
+
var runtimePromise = null;
|
|
796
|
+
var cachedFontBytes = null;
|
|
797
|
+
var cachedFontModelKey = null;
|
|
798
|
+
var browserWasmBaseUrl = "/wasm";
|
|
799
|
+
var browserWasmBytes = null;
|
|
800
|
+
var browserWasmPromise = null;
|
|
801
|
+
var wasmUrlConfigured = false;
|
|
802
|
+
function configureBrowserWasm(baseUrl = "/wasm") {
|
|
803
|
+
wasmUrlConfigured = true;
|
|
804
|
+
browserWasmBaseUrl = baseUrl.replace(/\/$/, "");
|
|
805
|
+
browserWasmBytes = null;
|
|
806
|
+
browserWasmPromise = null;
|
|
807
|
+
}
|
|
808
|
+
function isWasmUrlConfigured() {
|
|
809
|
+
return wasmUrlConfigured;
|
|
810
|
+
}
|
|
811
|
+
function setBrowserWasmBytes(compiler, renderer) {
|
|
812
|
+
browserWasmBytes = { compiler, renderer };
|
|
813
|
+
browserWasmPromise = Promise.resolve();
|
|
814
|
+
}
|
|
815
|
+
async function ensureBrowserWasm() {
|
|
816
|
+
if (typeof window === "undefined") {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
if (browserWasmBytes) {
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
if (!browserWasmPromise) {
|
|
823
|
+
browserWasmPromise = (async () => {
|
|
824
|
+
const fetchWasm = async (name) => {
|
|
825
|
+
const response = await fetch(`${browserWasmBaseUrl}/${name}`);
|
|
826
|
+
if (!response.ok) {
|
|
827
|
+
throw new Error(`Failed to load Typst WASM: ${name} (${response.status})`);
|
|
828
|
+
}
|
|
829
|
+
return response.arrayBuffer();
|
|
830
|
+
};
|
|
831
|
+
const [compiler, renderer] = await Promise.all([
|
|
832
|
+
fetchWasm("typst_ts_web_compiler_bg.wasm"),
|
|
833
|
+
fetchWasm("typst_ts_renderer_bg.wasm")
|
|
834
|
+
]);
|
|
835
|
+
browserWasmBytes = { compiler, renderer };
|
|
836
|
+
})();
|
|
837
|
+
}
|
|
838
|
+
await browserWasmPromise;
|
|
839
|
+
}
|
|
840
|
+
function browserCompilerInitOptions() {
|
|
841
|
+
if (!browserWasmBytes) {
|
|
842
|
+
return {};
|
|
843
|
+
}
|
|
844
|
+
return { getModule: () => browserWasmBytes.compiler };
|
|
845
|
+
}
|
|
846
|
+
function browserRendererInitOptions() {
|
|
847
|
+
if (!browserWasmBytes) {
|
|
848
|
+
return {};
|
|
849
|
+
}
|
|
850
|
+
return { getModule: () => browserWasmBytes.renderer };
|
|
851
|
+
}
|
|
852
|
+
var BundledPackageRegistry = class {
|
|
853
|
+
packages = /* @__PURE__ */ new Set();
|
|
854
|
+
register(name, version) {
|
|
855
|
+
this.packages.add(`${name}/${version}`);
|
|
856
|
+
}
|
|
857
|
+
resolve(spec, _context) {
|
|
858
|
+
if (spec.namespace !== "preview") {
|
|
859
|
+
return void 0;
|
|
860
|
+
}
|
|
861
|
+
const key = `${spec.name}/${spec.version}`;
|
|
862
|
+
if (!this.packages.has(key)) {
|
|
863
|
+
return void 0;
|
|
864
|
+
}
|
|
865
|
+
return `/preview/${spec.name}/${spec.version}`;
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
function createBundledPackageRegistry() {
|
|
869
|
+
const registry = new BundledPackageRegistry();
|
|
870
|
+
registry.register("rendercv", RENDERCV_PACKAGE_VERSION);
|
|
871
|
+
return registry;
|
|
872
|
+
}
|
|
873
|
+
function readPackageVersion(typstToml) {
|
|
874
|
+
const match = typstToml.match(/^\s*version\s*=\s*"([^"]+)"/m);
|
|
875
|
+
if (!match) {
|
|
876
|
+
throw new Error("Could not find version in bundled typst.toml");
|
|
877
|
+
}
|
|
878
|
+
return match[1];
|
|
879
|
+
}
|
|
880
|
+
function encodeText(text) {
|
|
881
|
+
return new TextEncoder().encode(text);
|
|
882
|
+
}
|
|
883
|
+
function packageFilePath(name, version, file) {
|
|
884
|
+
return `/preview/${name}/${version}/${file}`;
|
|
885
|
+
}
|
|
886
|
+
function registerPackage(compiler, name, version, files) {
|
|
887
|
+
for (const [file, content] of Object.entries(files)) {
|
|
888
|
+
compiler.mapShadow(packageFilePath(name, version, file), encodeText(content));
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
var RENDERCV_PACKAGE_FILES = {
|
|
892
|
+
"typst.toml": typst_default,
|
|
893
|
+
"lib.typ": lib_default,
|
|
894
|
+
"icons.typ": icons_default
|
|
895
|
+
};
|
|
896
|
+
function registerRendercvPackage(compiler) {
|
|
897
|
+
registerPackage(compiler, "rendercv", RENDERCV_PACKAGE_VERSION, RENDERCV_PACKAGE_FILES);
|
|
898
|
+
}
|
|
899
|
+
async function createRuntime() {
|
|
900
|
+
await ensureBrowserWasm();
|
|
901
|
+
const compilerWasmOptions = browserCompilerInitOptions();
|
|
902
|
+
const rendererWasmOptions = browserRendererInitOptions();
|
|
903
|
+
const compiler = createTypstCompiler();
|
|
904
|
+
await compiler.init({
|
|
905
|
+
...compilerWasmOptions,
|
|
906
|
+
beforeBuild: [
|
|
907
|
+
initOptions.disableDefaultFontAssets(),
|
|
908
|
+
initOptions.withPackageRegistry(createBundledPackageRegistry())
|
|
909
|
+
]
|
|
910
|
+
});
|
|
911
|
+
registerRendercvPackage(compiler);
|
|
912
|
+
const renderer = createTypstRenderer();
|
|
913
|
+
await renderer.init(rendererWasmOptions);
|
|
914
|
+
return { compiler, renderer };
|
|
915
|
+
}
|
|
916
|
+
async function applyFontBytesToCompiler(compiler, fontBytes) {
|
|
917
|
+
await ensureBrowserWasm();
|
|
918
|
+
const fontBuilder = createTypstFontBuilder();
|
|
919
|
+
await fontBuilder.init(browserCompilerInitOptions());
|
|
920
|
+
for (const bytes of fontBytes) {
|
|
921
|
+
if (bytes.length > 0) {
|
|
922
|
+
await fontBuilder.addFontData(bytes);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
await fontBuilder.build(async (resolver) => {
|
|
926
|
+
compiler.setFonts(resolver);
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
async function getTypstRuntime() {
|
|
930
|
+
if (!runtimePromise) {
|
|
931
|
+
runtimePromise = (async () => {
|
|
932
|
+
const { configureDefaultAssets } = await import("./asset_paths-Q3SHUESH.js");
|
|
933
|
+
await configureDefaultAssets();
|
|
934
|
+
return createRuntime();
|
|
935
|
+
})();
|
|
936
|
+
}
|
|
937
|
+
return runtimePromise;
|
|
938
|
+
}
|
|
939
|
+
async function preloadTypst() {
|
|
940
|
+
const { configureDefaultAssets } = await import("./asset_paths-Q3SHUESH.js");
|
|
941
|
+
await configureDefaultAssets();
|
|
942
|
+
await getTypstRuntime();
|
|
943
|
+
}
|
|
944
|
+
function decodeAssetBytes(value) {
|
|
945
|
+
if (value.startsWith("data:")) {
|
|
946
|
+
const base64 = value.split(",")[1] ?? "";
|
|
947
|
+
const binary = atob(base64);
|
|
948
|
+
const bytes = new Uint8Array(binary.length);
|
|
949
|
+
for (let i = 0; i < binary.length; i++) {
|
|
950
|
+
bytes[i] = binary.charCodeAt(i);
|
|
951
|
+
}
|
|
952
|
+
return bytes;
|
|
953
|
+
}
|
|
954
|
+
return encodeText(value);
|
|
955
|
+
}
|
|
956
|
+
async function resolveFontBytesForModel(model) {
|
|
957
|
+
const { loadFontsForTypst, modelFontCacheKey } = await import("./font_registry-TJ7PJJTJ.js");
|
|
958
|
+
const key = modelFontCacheKey(model);
|
|
959
|
+
if (cachedFontModelKey === key && cachedFontBytes) {
|
|
960
|
+
return cachedFontBytes;
|
|
961
|
+
}
|
|
962
|
+
cachedFontBytes = await loadFontsForTypst(model);
|
|
963
|
+
cachedFontModelKey = key;
|
|
964
|
+
return cachedFontBytes;
|
|
965
|
+
}
|
|
966
|
+
async function ensureFontsForModel(model) {
|
|
967
|
+
const runtime = await getTypstRuntime();
|
|
968
|
+
const fontBytes = await resolveFontBytesForModel(model);
|
|
969
|
+
await applyFontBytesToCompiler(runtime.compiler, fontBytes);
|
|
970
|
+
}
|
|
971
|
+
async function prepareTypstCompilation(typstSource, options) {
|
|
972
|
+
const runtime = await getTypstRuntime();
|
|
973
|
+
await runtime.compiler.resetShadow();
|
|
974
|
+
registerRendercvPackage(runtime.compiler);
|
|
975
|
+
if (options?.model) {
|
|
976
|
+
await ensureFontsForModel(options.model);
|
|
977
|
+
} else if (cachedFontBytes === null) {
|
|
978
|
+
const { loadBaseFontsForTypst } = await import("./font_registry-TJ7PJJTJ.js");
|
|
979
|
+
cachedFontBytes = await loadBaseFontsForTypst();
|
|
980
|
+
cachedFontModelKey = "bundled-only";
|
|
981
|
+
await applyFontBytesToCompiler(runtime.compiler, cachedFontBytes);
|
|
982
|
+
} else {
|
|
983
|
+
await applyFontBytesToCompiler(runtime.compiler, cachedFontBytes);
|
|
984
|
+
}
|
|
985
|
+
runtime.compiler.addSource(MAIN_TYP_PATH, typstSource);
|
|
986
|
+
if (options?.photoName && options.photoBytes) {
|
|
987
|
+
runtime.compiler.mapShadow(`/${options.photoName}`, options.photoBytes);
|
|
988
|
+
}
|
|
989
|
+
return { compiler: runtime.compiler, mainFilePath: MAIN_TYP_PATH };
|
|
990
|
+
}
|
|
991
|
+
async function clearFontCache() {
|
|
992
|
+
const { clearFontCache: clearCache } = await import("./font_cache-BZENGUJA.js");
|
|
993
|
+
await clearCache();
|
|
994
|
+
cachedFontBytes = null;
|
|
995
|
+
cachedFontModelKey = null;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
export {
|
|
999
|
+
RENDERCV_PACKAGE_VERSION,
|
|
1000
|
+
MAIN_TYP_PATH,
|
|
1001
|
+
TYPST_ROOT,
|
|
1002
|
+
configureBrowserWasm,
|
|
1003
|
+
isWasmUrlConfigured,
|
|
1004
|
+
setBrowserWasmBytes,
|
|
1005
|
+
getTypstRuntime,
|
|
1006
|
+
preloadTypst,
|
|
1007
|
+
decodeAssetBytes,
|
|
1008
|
+
ensureFontsForModel,
|
|
1009
|
+
prepareTypstCompilation,
|
|
1010
|
+
clearFontCache
|
|
1011
|
+
};
|
|
1012
|
+
//# sourceMappingURL=chunk-VZSMPOAA.js.map
|