Skip to content

Commit 2db8037

Browse files
committed
#19: Add date and month argument
1 parent 66b1fe5 commit 2db8037

File tree

6 files changed

+52
-19
lines changed

6 files changed

+52
-19
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ Don't forget to intialize a Git repository and backup your work somewhere!
6969
| abstract | `dict` | `( sk: lorem(150), en: lorem(150) )` | abstract in two languages | keys are the language, with `str` as values |
7070
| id | `str` | `"FIIT-12345-123456"` | id from AIS | |
7171
| lang | enum(`str`) | `"en"` | language of your thesis | `"sk"`, `"en"` |
72+
| month | `int` | `5` | month of the hand-in | 1-12 |
73+
| current-date | `datetime` | `datetime.today()` | declaration date and year of the work | |
7274
| acknowledgment | `str` or `none` | `"Omitted"` | thanks at the start of the thesis | |
7375
| assignment | path | `none` | recommended to leave as default, see "How to insert the thesis assignment?" | |
7476
| tables-outline | `bool` | `false` | enable tables outline | |
@@ -124,6 +126,14 @@ in Typst.
124126
`acknowledgment` sets the acknowledgment text. You can write anything you want
125127
here.
126128

129+
`month` lets you select which month you hand in the thesis. For most people
130+
it's May (5), but if you selected the new format with an article, you may need
131+
to choose a different month. Just pick a number and it will automatically
132+
insert the correct month for you.
133+
134+
`current-date` is Typst's `datetime` that tells when the declaration will be
135+
signed, and which year the thesis is being written.
136+
127137
`assignment` sets the assignment PDF file path. This isn't the ideal way to
128138
insert your assignment from AIS, see "How to insert the thesis assignment?"
129139

build/template.pdf

-162 Bytes
Binary file not shown.

lib.typ

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
supervisor: "prof. Jozef Mrkva, PhD.",
2727
// supported values: "en", "sk"
2828
lang: "en",
29+
// month of the hand-in
30+
month: 5,
31+
// current date for declaration and year of handing-in
32+
current-date: datetime.today(),
2933
// acknowledgment text
3034
acknowledgment: none,
3135
// assignment from AIS file path. DO NOT USE THIS FOR FINAL HAND-IN
@@ -127,6 +131,12 @@
127131
_lang.update(lang)
128132
_style.update(style)
129133

134+
assert(
135+
type(month) == int and month >= 1 and month <= 12,
136+
message: "Month should be an integer between 1 and 12",
137+
)
138+
month = month - 1 // convert to array index
139+
130140
////////////////////////////////
131141
// pagecount handling
132142
show pagebreak: it => if style == "pagecount" { none } else { it }
@@ -259,7 +269,7 @@
259269
#locale.faculty
260270
],
261271
footer: supervisor-footer,
262-
date: [#values.month.may #datetime.today().display("[year]")],
272+
date: [#values.month.at(month) #current-date.display("[year]")],
263273
)
264274
pagebreak(to: if use-binding { "odd" } else { none }, weak: true)
265275
}
@@ -281,7 +291,7 @@
281291
(left: fields.department, right: values.department.upai),
282292
..supervisor-footer,
283293
),
284-
date: [#values.month.may #datetime.today().display("[year]")],
294+
date: [#values.month.at(month) #current-date.display("[year]")],
285295
)
286296
}
287297

@@ -344,7 +354,7 @@
344354
grid.cell(
345355
rowspan: 2,
346356
align: start,
347-
datetime.today().display("V Bratislave, [day].[month].[year]"),
357+
current-date.display("V Bratislave, [day].[month].[year]"),
348358
),
349359
repeat("."),
350360
author,
@@ -372,8 +382,8 @@
372382
author: (left: slovak.annotation.author, right: author),
373383
thesis: (left: slovak.title-page.values.thesis.at(thesis), right: title),
374384
supervisor: supervisors-sk,
375-
date: [#slovak.title-page.values.month.may #(
376-
datetime.today().display("[year]")
385+
date: [#slovak.title-page.values.month.at(month) #(
386+
current-date.display("[year]")
377387
)],
378388
abstract.sk,
379389
)
@@ -394,8 +404,8 @@
394404
author: (left: english.annotation.author, right: author),
395405
thesis: (left: english.title-page.values.thesis.at(thesis), right: title),
396406
supervisor: supervisors-en,
397-
date: [#english.title-page.values.month.may #(
398-
datetime.today().display("[year]")
407+
date: [#english.title-page.values.month.at(month) #(
408+
current-date.display("[year]")
399409
)],
400410
abstract.en,
401411
)

localization.typ

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@
1111
),
1212
values: (
1313
month: (
14-
may: "May",
14+
"January",
15+
"February",
16+
"March",
17+
"April",
18+
"May",
19+
"June",
20+
"July",
21+
"August",
22+
"September",
23+
"October",
24+
"November",
25+
"December",
1526
),
1627
thesis: (
1728
bp2: "Bachelor thesis",
@@ -67,7 +78,18 @@
6778
),
6879
values: (
6980
month: (
70-
may: "Máj",
81+
"Január",
82+
"Február",
83+
"Marec",
84+
"Apríl",
85+
"Máj",
86+
"Jún",
87+
"Júl",
88+
"August",
89+
"September",
90+
"Október",
91+
"November",
92+
"December",
7193
),
7294
thesis: (
7395
bp2: "Bakalárska práca",

template/main.typ

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@
44
title: "Moja záverečná práca",
55
thesis: "bp2",
66
author: "Jožko Mrkvička",
7-
supervisor: (
8-
sk: (
9-
("Vedúci práce", "Ing. John Doe"),
10-
("Fakultný vedúci", "prof. Jozef Mrkva, PhD."),
11-
),
12-
en: (
13-
("Supervisor", "Ing. John Doe"),
14-
("Faculty advisor", "prof. Jozef Mrkva, PhD."),
15-
),
16-
),
7+
supervisor: "prof. Jozef Mrkva, PhD.",
178
abstract: (
189
sk: lorem(150),
1910
en: lorem(150),

thumbnail.png

-22.4 KB
Loading

0 commit comments

Comments
 (0)