develop (inside joke)
This commit is contained in:
42
template/prototyping.typ
Normal file
42
template/prototyping.typ
Normal file
@@ -0,0 +1,42 @@
|
||||
#let todos = state("todos", "0");
|
||||
#let is_prod = state("is_prod", "false");
|
||||
|
||||
#let profile(profile) = {
|
||||
let profiles = ("debug", "release");
|
||||
if profile not in profiles {
|
||||
panic(
|
||||
"unknown profile '" + profile +
|
||||
"', expected one of: " + profiles.map((v) => { "'" + v + "'" }).join(", ")
|
||||
)
|
||||
}
|
||||
context {
|
||||
is_prod.update(is_prod => "true");
|
||||
}
|
||||
}
|
||||
|
||||
#let assert_release_ready() = {
|
||||
context {
|
||||
if not eval(is_prod.final()) {
|
||||
return;
|
||||
}
|
||||
let todos = eval(todos.final());
|
||||
if todos > 0 {
|
||||
let panic_message = ("refusing to build for release - " + str(todos) + " " +
|
||||
if todos == 1 { "todo" } else { "todos" } + " remaining");
|
||||
panic(panic_message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#let todo(content, do_highlight: true) = {
|
||||
context {
|
||||
todos.update(todos => {
|
||||
str(eval(todos) + 1)
|
||||
});
|
||||
}
|
||||
if do_highlight {
|
||||
highlight(text(content, fill: white), fill: red, radius: .25em, extent: .25em);
|
||||
} else {
|
||||
text(content);
|
||||
}
|
||||
}
|
@@ -1,3 +1,5 @@
|
||||
#import "prototyping.typ": todo, profile
|
||||
|
||||
#let tultemplate(
|
||||
template_id,
|
||||
faculty_abbreviation,
|
||||
@@ -13,11 +15,18 @@
|
||||
);
|
||||
assert_in_dict(template_id, templates, "template name");
|
||||
|
||||
// global set-up
|
||||
import "lang.typ": lang_ids
|
||||
assert_in_dict(language, lang_ids, "language abbreviation");
|
||||
set text(lang: language);
|
||||
templates.at(template_id)(
|
||||
faculty_abbreviation, language, document_type,
|
||||
title, author, supervisor, study_programme,
|
||||
content
|
||||
);
|
||||
|
||||
import "prototyping.typ": assert_release_ready
|
||||
assert_release_ready();
|
||||
}
|
||||
|
||||
#let abbr(abbreviation, ..text) = {
|
||||
|
@@ -45,7 +45,7 @@
|
||||
let info_fields = (
|
||||
(("Studijní program", "Study programme"), study_programme, false),
|
||||
(("Autor", "Author"), author, true),
|
||||
(("Vedoucí práce", "Vedoucí práce"), supervisor, false),
|
||||
(("Vedoucí práce", "Supervisor"), supervisor, false),
|
||||
);
|
||||
context {
|
||||
let max_field_name_width = calc.max(..info_fields.map((v) => {
|
||||
@@ -108,7 +108,6 @@
|
||||
// styling
|
||||
let faculty_color = faculty_color(faculty_id);
|
||||
set par(justify: true);
|
||||
set text(lang: "cs");
|
||||
set heading(numbering: "1.1.1 ");
|
||||
set page(margin: (outside: 4cm, top: 3cm, bottom: 3cm), numbering: "1", footer: {
|
||||
context {
|
||||
@@ -117,6 +116,7 @@
|
||||
}
|
||||
});
|
||||
show heading: it => {
|
||||
set par(justify: false);
|
||||
block(
|
||||
above: 2em,
|
||||
below: 2em,
|
||||
@@ -128,6 +128,9 @@
|
||||
v(2cm);
|
||||
it
|
||||
};
|
||||
show raw.where(block: true): it => {
|
||||
block(it, fill: rgb("#eee"), inset: 1em)
|
||||
}
|
||||
|
||||
let language = lang_id(language);
|
||||
|
||||
|
Reference in New Issue
Block a user