Now asking whether to omit the Makefile
This commit is contained in:
33
data.js
33
data.js
@@ -107,13 +107,23 @@ let steps = {
|
|||||||
result.include_pdf = result.format === "external";
|
result.include_pdf = result.format === "external";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
finishing_touches: {
|
other_details: {
|
||||||
title: "Závěrečné detaily",
|
title: "Ostatní detaily",
|
||||||
layout: finishing_touches_layout,
|
layout: other_details_layout,
|
||||||
result: {
|
result: {
|
||||||
has_keywords: true,
|
has_keywords: true,
|
||||||
has_acknowledgement: true
|
has_acknowledgement: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
toolchain: {
|
||||||
|
title: "Jak budete používat Typst?",
|
||||||
|
layout: toolchain_layout,
|
||||||
|
result: {
|
||||||
|
toolchain: "online"
|
||||||
|
},
|
||||||
|
finalize: (result) => {
|
||||||
|
result.include_makefile = result.toolchain === "local";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,6 +220,15 @@ const assignment_formats = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toolchains = {
|
||||||
|
"online": {
|
||||||
|
name: "Pomocí webového editoru Typstu"
|
||||||
|
},
|
||||||
|
"local": {
|
||||||
|
name: "Pomocí příkazové řádky"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const typst_header = `#import "template/template.typ": *
|
const typst_header = `#import "template/template.typ": *
|
||||||
|
|
||||||
#show: tultemplate2.with(
|
#show: tultemplate2.with(
|
||||||
@@ -218,11 +237,11 @@ const typst_header = `#import "template/template.typ": *
|
|||||||
lang: "{language.lang}",
|
lang: "{language.lang}",
|
||||||
title: (cs: "{thesis_title.cs}", en: "{thesis_title.en}"),
|
title: (cs: "{thesis_title.cs}", en: "{thesis_title.en}"),
|
||||||
branch: ({language.lang}: "SEM DOPLŇTE SPECIALIZACI"),
|
branch: ({language.lang}: "SEM DOPLŇTE SPECIALIZACI"),
|
||||||
<finishing_touches.has_keywords: keywords: (
|
<other_details.has_keywords: keywords: (
|
||||||
cs: ("DOPLŇTE", "SEM", "KLÍČOVÁ", "SLOVA"),
|
cs: ("DOPLŇTE", "SEM", "KLÍČOVÁ", "SLOVA"),
|
||||||
en: ("INSERT", "KEYWORDS", "HERE")
|
en: ("INSERT", "KEYWORDS", "HERE")
|
||||||
),
|
),
|
||||||
><finishing_touches.has_acknowledgement: acknowledgement: (
|
><other_details.has_acknowledgement: acknowledgement: (
|
||||||
<language.is_cs:cs: "
|
<language.is_cs:cs: "
|
||||||
Rád bych poděkoval všem, kteří přispěli ke vzniku tohoto dílka.
|
Rád bych poděkoval všem, kteří přispěli ke vzniku tohoto dílka.
|
||||||
"><language.is_en:en: "
|
"><language.is_en:en: "
|
||||||
@@ -315,6 +334,10 @@ async function generate_zip() {
|
|||||||
out_zip.remove("assignment.pdf");
|
out_zip.remove("assignment.pdf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!steps.toolchain.result.include_makefile) {
|
||||||
|
out_zip.remove("Makefile");
|
||||||
|
}
|
||||||
|
|
||||||
return await out_zip.generateAsync({ type: "blob" });
|
return await out_zip.generateAsync({ type: "blob" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
ui.js
26
ui.js
@@ -178,7 +178,7 @@ async function assignment_layout(content, result) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function finishing_touches_layout(content, result) {
|
async function other_details_layout(content, result) {
|
||||||
content.appendChild(new BinaryInputBuilder(result, "has_keywords")
|
content.appendChild(new BinaryInputBuilder(result, "has_keywords")
|
||||||
.label("Vložit klíčová slova")
|
.label("Vložit klíčová slova")
|
||||||
.finish());
|
.finish());
|
||||||
@@ -191,6 +191,30 @@ async function finishing_touches_layout(content, result) {
|
|||||||
.finish());
|
.finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toolchain_layout(content, result) {
|
||||||
|
if(!Object.keys(toolchains).includes(result.toolchain)) {
|
||||||
|
document.querySelector("#next-button").disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let buttons = new ButtonListBuilder(Object.keys(toolchains))
|
||||||
|
.should_be_pressed((key) => result.toolchain == key)
|
||||||
|
.modify((b, key) => b.class("wide").text(toolchains[key].name))
|
||||||
|
.on_click((key) => {
|
||||||
|
result.toolchain = key;
|
||||||
|
document.querySelector("#next-button").disabled = false;
|
||||||
|
})
|
||||||
|
.finish();
|
||||||
|
|
||||||
|
for(const button of buttons) {
|
||||||
|
content.appendChild(button);
|
||||||
|
}
|
||||||
|
|
||||||
|
content.appendChild(new ElementBuilder("div.vertical-spacer").finish());
|
||||||
|
content.appendChild(new ElementBuilder("div.hint")
|
||||||
|
.text("Toto rozhodnutí pouze ovlivní, zda výsledná šablona bude obsahovat soubor Makefile pro jednodušší použití s příkazovou řádkou. Webový editor Typstu tento soubor nepotřebuje.")
|
||||||
|
.finish());
|
||||||
|
}
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
startbutton.style.cursor = "auto";
|
startbutton.style.cursor = "auto";
|
||||||
startbutton.disabled = true;
|
startbutton.disabled = true;
|
||||||
|
Reference in New Issue
Block a user