From 11d490b1014d01dee3ac288d39ae7a05564b36b5 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Tue, 24 Feb 2026 16:43:36 +0200 Subject: [PATCH] feat!: change thesis-type to accept short keys (bachelor/course/qualification) BREAKING CHANGE: thesis-type now requires "bachelor", "course", or "qualification" instead of full labels like "Bakalaura darbs". Update existing documents to use the new format. --- README.md | 6 +- examples/qualification-thesis/main.typ | 4 +- src/documentary-page.typ | 164 ++++++++++++++++--------- src/utils.typ | 12 +- template/main.typ | 2 +- 5 files changed, 112 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index 25f0f2a..27fad74 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`: e.g., `"Bakalaura darbs"`, `"Kvalifikācijas Darbs"`. +- `thesis-type`: Type of thesis - `"bachelor"`, `"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 @@ -48,7 +48,7 @@ function in a show rule. If you want to change an existing project to use this template, you can add a show rule like this at the top of your file: ```typst -#import "@preview/solo-lu-df:1.0.0": * +#import "@preview/solo-lu-df:1.1.0": * #show: ludf.with( title: "Darba Nosaukums", @@ -58,7 +58,7 @@ template, you can add a show rule like this at the top of your file: advisors: ( (title: "Mg. dat.", name: "Ivars Ozoliņš"), ), - reviewer: (name: "Prof. Anna Liepa"), + reviewer: (title: "", name: "Prof. Anna Liepa"), date: datetime(year: 2025, month: 1, day: 1), place: "Rīga", bibliography: bibliography("bibliography.yml"), diff --git a/examples/qualification-thesis/main.typ b/examples/qualification-thesis/main.typ index 0ec5e76..4ff5387 100644 --- a/examples/qualification-thesis/main.typ +++ b/examples/qualification-thesis/main.typ @@ -1,5 +1,5 @@ #import "@preview/fletcher:0.5.8" as fletcher: diagram, edge, node -#import "@preview/solo-lu-df:1.0.0": * +#import "@preview/solo-lu-df:1.1.0": * #import "utils/diagrams.typ": data-store, dpd-database, dpd-edge, process #import "utils/tables.typ": function-table @@ -8,7 +8,7 @@ #show: ludf.with( title: "Darba Nosaukums", - thesis-type: "Kvalifikācijas Darbs", + thesis-type: "qualification", authors: ( ( name: "Jānis Bērziņš", diff --git a/src/documentary-page.typ b/src/documentary-page.typ index 6ed2e32..c17bbf0 100644 --- a/src/documentary-page.typ +++ b/src/documentary-page.typ @@ -4,72 +4,119 @@ height: 0.65em, ) -#let bachelor-dokumentary( +#let fmt-date(date) = strong(date.display("[day].[month].[year].")) + +#let thesis-config = ( + bachelor: ( + label: "Bakalaura darbs", + intro-suffix: "", + ), + course: ( + label: "Kursa darbs", + intro-suffix: " un/vai recenzentam uzrādītajai darba versijai", + ), + qualification: ( + label: "Kvalifikācijas darbs", + intro-suffix: " un/vai recenzentam uzrādītajai darba versijai", + ), +) + +#let get-thesis-label(thesis-type) = { + thesis-config.at(thesis-type, default: (label: str(thesis-type))).label +} + +#let make-dokumentary( title, authors, advisors, reviewer, + thesis-type, date, presentation-date, -) = [ - Bakalaura darbs "*#title*" izstrādāts Latvijas Universitātes Eksakto zinātņu un - tehnoloģiju fakultātē. +) = { + let (intro-suffix, footer) = if thesis-type == "bachelor" { + ( + "", + [ + Darbs iesniegts Datorikas nodaļā #date \ + Pilnvarotā persona: vecākā metodiķe: Ārija Sproģe ~#signature-line() - 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. - #set par(hanging-indent: 1cm) + #v(1fr) - #v(0.2fr) - - #if authors.len() > 1 { [Autori:\ ] } else { "Autors: " } - #( - authors - .map(author => [*#author.name, #author.code* ~#signature-line()~ #date]) - .join(", ") - ) - - #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( - advisor => [*#advisor.title #advisor.name* ~#signature-line()~ #date], - ) - .join("\n") + 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) + ], ) - ] - - #v(1fr) - - #if reviewer != none { - [Recenzents: *#reviewer.title #reviewer.name*] - v(1fr) } + let work-label = if thesis-type == "bachelor" { + "Bakalaura darbs" + } else if thesis-type == "course" { + "Kursa darbs" + } else { + "Kvalifikācijas darbs" + } - Darbs iesniegts Datorikas nodaļā #date \ - Pilnvarotā persona: vecākā metodiķe: Ārija Sproģe ~#signature-line() + [ + #work-label "*#title*" #if thesis-type == "bachelor" [izstrādāts] else [ir izstrādāts] + Latvijas Universitātes Eksakto zinātņu un tehnoloģiju fakultātē. - #v(1fr) + 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. + #set par(hanging-indent: 1cm) - 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) + #v(0.2fr) - #v(1fr) -] + #if authors.len() > 1 [Autori:\ ] else [Autors: ] + #( + authors + .map(it => [*#it.name, #it.code* ~#signature-line()~ #date]) + .join(", ") + ) -#let fmt-date(date) = { - strong(date.display("[day].[month].[year].")) + #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") + ) + ] + + #v(1fr) + + #if reviewer != none [ + Recenzents: *#reviewer.title #reviewer.name* + #v(1fr) + ] + + #footer + + #v(1fr) + ] } -#let course-work-dokumentary = [] - -#let qualification-work-dokumentary = [] - #let make-documentary-page( title, authors, @@ -82,17 +129,14 @@ set page(numbering: none) heading(level: 1, outlined: false, numbering: none, "Dokumentārā lapa") set par(spacing: 2em) - let formatted-date = fmt-date(date) - let formatted-presentation-date = fmt-date(presentation-date) - if thesis-type == "bachelor" { - bachelor-dokumentary( - title, - authors, - advisors, - reviewer, - formatted-date, - formatted-presentation-date, - ) - } + make-dokumentary( + title, + authors, + advisors, + reviewer, + thesis-type, + fmt-date(date), + fmt-date(presentation-date), + ) } diff --git a/src/utils.typ b/src/utils.typ index 10cf0e7..28c34d7 100644 --- a/src/utils.typ +++ b/src/utils.typ @@ -1,13 +1,5 @@ -#import "documentary-page.typ": make-documentary-page +#import "documentary-page.typ": get-thesis-label, make-documentary-page -#let get-thesis-type-name(thesis-type) = { - let thesis-types = ( - qualification: "Kvalifikācijas darbs", - course: "Kursa darbs", - bachelor: "Bakalaura darbs", - ) - thesis-types.at(thesis-type, default: str(thesis-type)) -} #let merge(a, b) = { let result = a @@ -99,7 +91,7 @@ v(0.2fr) - align(center, upper(text(size: 14pt, get-thesis-type-name(thesis-type)))) + align(center, upper(text(size: 14pt, get-thesis-label(thesis-type)))) v(1fr) diff --git a/template/main.typ b/template/main.typ index 8551646..0e6cec1 100644 --- a/template/main.typ +++ b/template/main.typ @@ -1,4 +1,4 @@ -#import "@preview/solo-lu-df:1.0.0": * +#import "@preview/solo-lu-df:1.1.0": * #show: ludf.with( title: "Darba Nosaukums",