From 80b0eb9448d9419b4c540dda429c9ab1d164942b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Proch=C3=A1zka?= Date: Wed, 8 Oct 2025 09:00:13 +0200 Subject: [PATCH] Actually generating valid templates now --- data.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/data.js b/data.js index 98bcb89..fd4f271 100644 --- a/data.js +++ b/data.js @@ -236,7 +236,7 @@ const typst_header = `#import "template/template.typ": * document: "{thesis_type.type}", lang: "{language.lang}", title: (cs: "{thesis_title.cs}", en: "{thesis_title.en}"), - branch: ({language.lang}: "SEM DOPLŇTE SPECIALIZACI"), + specialization: ({language.lang}: "SEM DOPLŇTE SPECIALIZACI"), citations: "citations.bib" ) -= Nadpis - -skibidi `; -function generate_template() { +function generate_template_header() { let out = typst_header; for(const step_key in steps) { @@ -328,7 +325,16 @@ async function generate_zip() { let assets_zip = await fetch("template.zip"); let out_zip = await new JSZip().loadAsync(await assets_zip.blob()); - out_zip.file("thesis.typ", generate_template()); + let template = await out_zip.file(steps.thesis_type.result.type + ".typ").async("string"); + template = generate_template_header() + template; + + out_zip.forEach((path, _) => { + if(path.match(/^[a-z_]*\.typ$/)) { + out_zip.remove(path) + } + }); + + out_zip.file("thesis.typ", template); if(!steps.assignment.result.include_pdf) { out_zip.remove("assignment.pdf");