From 65393fa20424c632748314286248d72b721d67bf Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Wed, 25 Feb 2026 12:44:26 +0200 Subject: [PATCH] feat: add master thesis type support --- README.md | 7 +- examples/bachelor-thesis/bibliography.yml | 4 +- examples/course-work/bibliography.yml | 4 +- examples/master-thesis/README.md | 28 ++++ examples/master-thesis/bibliography.yml | 28 ++++ examples/master-thesis/main.typ | 113 ++++++++++++++++ .../qualification-thesis/bibliography.yml | 4 +- src/documentary-page.typ | 128 ++++++++++-------- 8 files changed, 251 insertions(+), 65 deletions(-) create mode 100644 examples/master-thesis/README.md create mode 100644 examples/master-thesis/bibliography.yml create mode 100644 examples/master-thesis/main.typ diff --git a/README.md b/README.md index b9d0ba4..e704b58 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ configure the whole document and `attachment` helper function. Important argumen `code` and may include `location` and `email`. - `advisors`: Array of advisor dictionaries with `title` and `name`. - `reviewer`: Reviewer dictionary with `name`. -- `thesis-type`: Type of thesis - `"bachelor"`, `"course"`, or `"qualification"`. The documentary page adapts its content based on this value. +- `thesis-type`: Type of thesis - `"bachelor"`, `"master"`, `"course"`, or `"qualification"`. The documentary page adapts its content based on this value. - `date`: `datetime(...)` value for the thesis date. Defaults to `today`. - `place`: Place string (e.g., `"Rīga"`). - `abstract`: A record with `primary` and `secondary` abstracts. Each has @@ -85,9 +85,10 @@ template, you can add a show rule like this at the top of your file: Ready-to-edit examples for different thesis types are included: -- **Bachelor thesis**: [`examples/bachelor-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/bachelor-thesis) -- **Course work**: [`examples/course-work/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/course-work) - **Qualification thesis**: [`examples/qualification-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/qualification-thesis) +- **Course work**: [`examples/course-work/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/course-work) +- **Bachelor thesis**: [`examples/bachelor-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/bachelor-thesis) +- **Master thesis**: [`examples/master-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/master-thesis) View the examples on GitHub: diff --git a/examples/bachelor-thesis/bibliography.yml b/examples/bachelor-thesis/bibliography.yml index ea19de3..aa377c8 100644 --- a/examples/bachelor-thesis/bibliography.yml +++ b/examples/bachelor-thesis/bibliography.yml @@ -7,7 +7,9 @@ typst: - Haug - Martin - Typst Projekta Izstrādātāji - url: {value: "https://typst.app/", date: 2025-01-01} + url: + value: "https://typst.app/" + date: 2025-01-01 lvs_68: type: Book title: Programmatūras prasību specifikācijas ceļvedis diff --git a/examples/course-work/bibliography.yml b/examples/course-work/bibliography.yml index ea19de3..aa377c8 100644 --- a/examples/course-work/bibliography.yml +++ b/examples/course-work/bibliography.yml @@ -7,7 +7,9 @@ typst: - Haug - Martin - Typst Projekta Izstrādātāji - url: {value: "https://typst.app/", date: 2025-01-01} + url: + value: "https://typst.app/" + date: 2025-01-01 lvs_68: type: Book title: Programmatūras prasību specifikācijas ceļvedis diff --git a/examples/master-thesis/README.md b/examples/master-thesis/README.md new file mode 100644 index 0000000..65f9db6 --- /dev/null +++ b/examples/master-thesis/README.md @@ -0,0 +1,28 @@ +Master thesis example (solo-lu-df) + +This folder contains a ready-to-edit master thesis example built with +the `solo-lu-df` Typst template: + +- `main.typ` — Typst source (the example document). +- `bibliography.yml` — example bibliography entries (create as needed). + +## How to edit + +Open `examples/master-thesis/main.typ` and modify the `ludf.with(...)` +call to change title, authors, advisors, reviewer, date, place, abstract, +and bibliography. The example demonstrates: + +- Title/author/advisor metadata +- Multiple advisors for master thesis +- Reviewer for master thesis +- Primary and secondary abstracts with keywords + +## Thesis type + +This example uses `thesis-type: "master"` which generates the appropriate +documentary page for master theses (similar to bachelor, but with "maģistra" +instead of "bakalaura" in the footer). + +## License + +This project is licensed under the MIT-0 License - see the [LICENSE](./../../LICENSE) file for details. diff --git a/examples/master-thesis/bibliography.yml b/examples/master-thesis/bibliography.yml new file mode 100644 index 0000000..aa377c8 --- /dev/null +++ b/examples/master-thesis/bibliography.yml @@ -0,0 +1,28 @@ +typst: + type: Web + title: Typst + author: + - Mädje + - Laurenz + - Haug + - Martin + - Typst Projekta Izstrādātāji + url: + value: "https://typst.app/" + date: 2025-01-01 +lvs_68: + type: Book + title: Programmatūras prasību specifikācijas ceļvedis + author: Institūcija SIA "Latvijas standarts" + issue: 68 + date: 1996-03-27 + organization: Latvijas Nacionālais standartizācijas un metroloģijas centrs + page-total: 22 +lvs_72: + type: Book + title: Ieteicamā prakse programmatūras projektējuma aprakstīšanai + author: Institūcija SIA "Latvijas standarts" + issue: 72 + date: 1996-03-27 + organization: Latvijas Nacionālais standartizācijas un metroloģijas centrs + page-total: 13 diff --git a/examples/master-thesis/main.typ b/examples/master-thesis/main.typ new file mode 100644 index 0000000..309009a --- /dev/null +++ b/examples/master-thesis/main.typ @@ -0,0 +1,113 @@ +#import "@preview/solo-lu-df:1.1.0": * + +#show: ludf.with( + title: "Maģistra Darba Nosaukums", + thesis-type: "master", + authors: ( + ( + name: "Jānis Bērziņš", + code: "jb12345", + location: [Riga, Latvia], + email: "jb12345@edu.lu.lv", + ), + ), + advisors: ( + ( + title: "Dr. phys.", + name: "Ivars Ozoliņš", + ), + ( + title: "Mg. dat.", + name: "Anna Zariņa", + ), + ), + reviewer: ( + title: "Prof. Dr. Phys.", + name: "Anna Liepa", + ), + date: datetime( + year: 2025, + month: 6, + day: 15, + ), + place: "Rīga", + bibliography: bibliography("bibliography.yml"), + abstract: ( + primary: ( + text: [ + #lorem(50) + + #lorem(30) + + #lorem(20) + ], + keywords: ( + "Foo", + "Bar", + "Baz", + ), + ), + secondary: ( + text: [ + #lorem(20) + + #lorem(30) + + #lorem(50) + ], + keywords: ( + "foo", + "bar", + "baz", + ), + ), + ), + attachments: ( + attachment( + caption: "Attachment table", + label: , + table( + columns: (1fr, 1fr), + [foo], [bar], + ), + ), + attachment( + caption: "Another table", + table( + columns: (1fr, 1fr), + [Column 1], [Column 2], + ), + ), + ), +) + + += Ievads +#lorem(120) + += Teorētiskais pamatojums +#lorem(100) + +== Pamatjēdzieni +#lorem(80) + +== Līdzīgie risinājumi +#lorem(60) + += Izstrāde +#lorem(100) + +== Arhitektūra +#lorem(80) + +== Implementācija +#lorem(60) + += Testēšana +#lorem(80) + += Rezultāti un analīze +#lorem(100) + += Secinājumi +#lorem(40) diff --git a/examples/qualification-thesis/bibliography.yml b/examples/qualification-thesis/bibliography.yml index ea19de3..aa377c8 100644 --- a/examples/qualification-thesis/bibliography.yml +++ b/examples/qualification-thesis/bibliography.yml @@ -7,7 +7,9 @@ typst: - Haug - Martin - Typst Projekta Izstrādātāji - url: {value: "https://typst.app/", date: 2025-01-01} + url: + value: "https://typst.app/" + date: 2025-01-01 lvs_68: type: Book title: Programmatūras prasību specifikācijas ceļvedis diff --git a/src/documentary-page.typ b/src/documentary-page.typ index c17bbf0..13b1f68 100644 --- a/src/documentary-page.typ +++ b/src/documentary-page.typ @@ -10,19 +10,79 @@ bachelor: ( label: "Bakalaura darbs", intro-suffix: "", + make-footer: (date, presentation-date) => [ + Darbs iesniegts Datorikas nodaļā #date \ + Pilnvarotā persona: vecākā metodiķe: Ārija Sproģe ~#signature-line() + + #v(1fr) + + Darbs aizstāvēts bakalaura gala pārbaudījuma komisijas sēdē ~#signature-line() \ + #presentation-date prot. Nr. #signature-line(length: 4em) \ + Komisijas sekretārs(-e): #signature-line(length: 15em) + ], + ), + master: ( + label: "Maģistra darbs", + intro-suffix: "", + make-footer: (date, presentation-date) => [ + Darbs iesniegts Datorikas nodaļā #date \ + Pilnvarotā persona: vecākā metodiķe: Ārija Sproģe ~#signature-line() + + #v(1fr) + + Darbs aizstāvēts maģistra gala pārbaudījuma komisijas sēdē ~#signature-line() \ + #presentation-date prot. Nr. #signature-line(length: 4em) \ + Komisijas sekretārs(-e): #signature-line(length: 15em) + ], ), course: ( label: "Kursa darbs", - intro-suffix: " un/vai recenzentam uzrādītajai darba versijai", + intro-suffix: "", + make-footer: (date, _) => [ + Darbs iesniegts Datorikas nodaļā #date \ + Kursa darbu pārbaudīja komisijas sekretārs (elektronisks paraksts) + ], ), qualification: ( label: "Kvalifikācijas darbs", intro-suffix: " un/vai recenzentam uzrādītajai darba versijai", + make-footer: (date, _) => [ + Darbs iesniegts Datorikas nodaļā #date \ + Kvalifikācijas darbu pārbaudījumu komisijas sekretārs (elektronisks paraksts) + ], ), ) -#let get-thesis-label(thesis-type) = { - thesis-config.at(thesis-type, default: (label: str(thesis-type))).label +#let get-thesis-label(thesis-type) = ( + thesis-config + .at(thesis-type, default: ( + label: str(thesis-type), + )) + .label +) + +#let get-thesis-config(thesis-type) = { + thesis-config.at(thesis-type, default: ( + label: str(thesis-type), + intro-suffix: "", + make-footer: (date, _) => [], + )) +} + +#let make-author-lines(authors, date) = { + if authors.len() > 1 [Autori:\ ] else [Autors: ] + authors.map(it => [*#it.name, #it.code* ~#signature-line()~ #date]).join(", ") +} + +#let make-advisor-lines(advisors, date) = { + if advisors.len() > 0 [ + #if advisors.len() > 1 [Vadītāji:\ ] else [Vadītājs:] + #( + advisors + .map(it => [*#it.title #it.name* ~#signature-line()~ #date]) + .join("\n") + ) + ] } #let make-dokumentary( @@ -34,75 +94,25 @@ date, presentation-date, ) = { - let (intro-suffix, footer) = if thesis-type == "bachelor" { - ( - "", - [ - Darbs iesniegts Datorikas nodaļā #date \ - Pilnvarotā persona: vecākā metodiķe: Ārija Sproģe ~#signature-line() - - #v(1fr) - - Darbs aizstāvēts bakalaura gala pārbaudījuma komisijas sēdē ~#signature-line() \ - #presentation-date prot. Nr. #signature-line(length: 4em) \ - Komisijas sekretārs(-e): #signature-line(length: 15em) - ], - ) - } else if thesis-type == "course" { - ( - " un/vai recenzentam uzrādītajai darba versijai", - [ - Darbs iesniegts Datorikas nodaļā #date \ - Kursa darbu pārbaudīja komisijas sekretārs (elektronisks paraksts) - ], - ) - } else { - ( - " un/vai recenzentam uzrādītajai darba versijai", - [ - Darbs iesniegts Datorikas nodaļā #date \ - Kvalifikācijas darbu pārbaudījumu komisijas sekretārs (elektronisks paraksts) - ], - ) - } - - let work-label = if thesis-type == "bachelor" { - "Bakalaura darbs" - } else if thesis-type == "course" { - "Kursa darbs" - } else { - "Kvalifikācijas darbs" - } + let cfg = get-thesis-config(thesis-type) [ - #work-label "*#title*" #if thesis-type == "bachelor" [izstrādāts] else [ir izstrādāts] + #cfg.label "*#title*" izstrādāts Latvijas Universitātes Eksakto zinātņu un tehnoloģiju fakultātē. Ar savu parakstu apliecinu, ka darbs izstrādāts patstāvīgi, izmantoti tikai tajā norādītie informācijas avoti un iesniegtā darba elektroniskā kopija - atbilst izdrukai#intro-suffix. + atbilst izdrukai#cfg.intro-suffix. #set par(hanging-indent: 1cm) #v(0.2fr) - #if authors.len() > 1 [Autori:\ ] else [Autors: ] - #( - authors - .map(it => [*#it.name, #it.code* ~#signature-line()~ #date]) - .join(", ") - ) + #make-author-lines(authors, date) #v(1fr) Rekomendēju/nerekomendēju darbu aizstāvēšanai _(nederīgo svītro vadītājs)_\ - #if advisors.len() > 0 [ - #if advisors.len() > 1 [Vadītāji:\ ] else [Vadītājs:] - #( - advisors - .map(it => [*#it.title #it.name* ~#signature-line()~ #date]) - .join("\n") - ) - ] + #make-advisor-lines(advisors, date) #v(1fr) @@ -111,7 +121,7 @@ #v(1fr) ] - #footer + #(cfg.make-footer)(date, presentation-date) #v(1fr) ]