Compare commits

3 Commits

13 changed files with 54 additions and 45 deletions

View File

@@ -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: template, you can add a show rule like this at the top of your file:
```typst ```typst
#import "@preview/solo-lu-df:1.1.1": * #import "@preview/solo-lu-df:1.1.2": *
#show: ludf.with( #show: ludf.with(
title: "Darba Nosaukums", title: "Darba Nosaukums",
@@ -85,12 +85,12 @@ 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: Ready-to-edit examples for different thesis types are included:
- **Qualification thesis**: [`examples/qualification-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/qualification-thesis) - **Qualification thesis**: [`examples/qualification-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/v1.1.2/examples/qualification-thesis)
- **Course work**: [`examples/course-work/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/course-work) - **Course work**: [`examples/course-work/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/v1.1.2/examples/course-work)
- **Bachelor thesis**: [`examples/bachelor-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/bachelor-thesis) - **Bachelor thesis**: [`examples/bachelor-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/v1.1.2/examples/bachelor-thesis)
- **Master thesis**: [`examples/master-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples/master-thesis) - **Master thesis**: [`examples/master-thesis/`](https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/v1.1.2/examples/master-thesis)
View the examples on GitHub: <https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/main/examples> Browse all examples on GitHub: <https://github.com/kristoferssolo/LU-DF-Typst-Template/tree/v1.1.2/examples>
The qualification thesis example contains `main.typ`, `bibliography.yml` and small helpers under The qualification thesis example contains `main.typ`, `bibliography.yml` and small helpers under
`utils/`. Use it as a starting point or copy it into a new project. `utils/`. Use it as a starting point or copy it into a new project.

View File

@@ -3,8 +3,8 @@ Bachelor thesis example (solo-lu-df)
This folder contains a ready-to-edit bachelor thesis example built with This folder contains a ready-to-edit bachelor thesis example built with
the `solo-lu-df` Typst template: the `solo-lu-df` Typst template:
- `main.typ` Typst source (the example document). - `main.typ` Typst source (the example document).
- `bibliography.yml` example bibliography entries (create as needed). - `bibliography.yml` example bibliography entries (create as needed).
## How to edit ## How to edit
@@ -23,4 +23,4 @@ documentary page for bachelor theses.
## License ## License
This project is licensed under the MIT-0 License - see the [LICENSE](./../../LICENSE) file for details. This project is licensed under the MIT-0 License see the [LICENSE](./../../LICENSE) file for details.

View File

@@ -1,4 +1,4 @@
#import "@preview/solo-lu-df:1.1.1": * #import "@preview/solo-lu-df:1.1.2": *
#show: ludf.with( #show: ludf.with(
title: "Bakalaura Darba Nosaukums", title: "Bakalaura Darba Nosaukums",

View File

@@ -3,8 +3,8 @@ Course work example (solo-lu-df)
This folder contains a ready-to-edit course work example built with This folder contains a ready-to-edit course work example built with
the `solo-lu-df` Typst template: the `solo-lu-df` Typst template:
- `main.typ` Typst source (the example document). - `main.typ` Typst source (the example document).
- `bibliography.yml` example bibliography entries (create as needed). - `bibliography.yml` example bibliography entries (create as needed).
## How to edit ## How to edit
@@ -22,4 +22,4 @@ documentary page for course works.
## License ## License
This project is licensed under the MIT-0 License - see the [LICENSE](./../../LICENSE) file for details. This project is licensed under the MIT-0 License see the [LICENSE](./../../LICENSE) file for details.

View File

@@ -1,4 +1,4 @@
#import "@preview/solo-lu-df:1.1.1": * #import "@preview/solo-lu-df:1.1.2": *
#show: ludf.with( #show: ludf.with(
title: "Kursa Darba Nosaukums", title: "Kursa Darba Nosaukums",

View File

@@ -3,8 +3,8 @@ Master thesis example (solo-lu-df)
This folder contains a ready-to-edit master thesis example built with This folder contains a ready-to-edit master thesis example built with
the `solo-lu-df` Typst template: the `solo-lu-df` Typst template:
- `main.typ` Typst source (the example document). - `main.typ` Typst source (the example document).
- `bibliography.yml` example bibliography entries (create as needed). - `bibliography.yml` example bibliography entries (create as needed).
## How to edit ## How to edit
@@ -25,4 +25,4 @@ instead of "bakalaura" in the footer).
## License ## License
This project is licensed under the MIT-0 License - see the [LICENSE](./../../LICENSE) file for details. This project is licensed under the MIT-0 License see the [LICENSE](./../../LICENSE) file for details.

View File

@@ -1,4 +1,4 @@
#import "@preview/solo-lu-df:1.1.1": * #import "@preview/solo-lu-df:1.1.2": *
#show: ludf.with( #show: ludf.with(
title: "Maģistra Darba Nosaukums", title: "Maģistra Darba Nosaukums",

View File

@@ -3,9 +3,9 @@ Qualification thesis example (solo-lu-df)
This folder contains a ready-to-edit qualification-thesis example built with This folder contains a ready-to-edit qualification-thesis example built with
the `solo-lu-df` Typst template: the `solo-lu-df` Typst template:
- `main.typ` Typst source (the example document). - `main.typ` Typst source (the example document).
- `bibliography.yml` example bibliography entries. - `bibliography.yml` example bibliography entries.
- `utils/` helper snippets for diagrams/tables used by the example. - `utils/` helper snippets for diagrams/tables used by the example.
## How to edit ## How to edit
@@ -25,4 +25,4 @@ documentary page for course works.
## License ## License
This project is licensed under the MIT-0 License - see the [LICENSE](./../../LICENSE) file for details. This project is licensed under the MIT-0 License see the [LICENSE](./../../LICENSE) file for details.

View File

@@ -127,6 +127,32 @@
] ]
} }
#let normalize-title(title) = {
if type(title) != content or "children" not in title.fields() {
return title
}
let children = title
.fields()
.children
.filter(it => it.func() != linebreak)
.fold((), (acc, it) => {
if it == [ ] and (acc.len() == 0 or acc.last() == [ ]) {
acc
} else {
acc + (it,)
}
})
let children = if children.len() > 0 and children.last() == [ ] {
children.slice(0, -1)
} else {
children
}
children.join("")
}
#let make-documentary-page( #let make-documentary-page(
title, title,
authors, authors,
@@ -137,11 +163,11 @@
presentation-date, presentation-date,
) = { ) = {
set page(numbering: none) set page(numbering: none)
heading(level: 1, outlined: false, numbering: none, "Dokumentārā lapa")
set par(spacing: 2em) set par(spacing: 2em)
heading(level: 1, outlined: false, numbering: none, "Dokumentārā lapa")
make-dokumentary( make-dokumentary(
title, normalize-title(title),
authors, authors,
advisors, advisors,
reviewer, reviewer,
@@ -150,3 +176,4 @@
fmt-date(presentation-date), fmt-date(presentation-date),
) )
} }

View File

@@ -293,26 +293,9 @@
make-attachments(attachment-title, attachments) make-attachments(attachment-title, attachments)
let title-text = if type(title) == content and "children" in title.fields() {
title
.fields()
.children
.filter(it => it.func() != linebreak)
.fold((), (acc, it) => {
if it == [ ] and acc.last() == [ ] {
acc
} else {
acc + (it,)
}
})
.join("")
} else {
title
}
if display-documentary { if display-documentary {
make-documentary-page( make-documentary-page(
title-text, title,
authors, authors,
advisors, advisors,
reviewer, reviewer,

View File

@@ -1,6 +1,5 @@
#import "documentary-page.typ": get-thesis-label, make-documentary-page #import "documentary-page.typ": get-thesis-label, make-documentary-page
#let merge(a, b) = { #let merge(a, b) = {
let result = a let result = a
for (k, v) in b { result.at(k) = v } for (k, v) in b { result.at(k) = v }

View File

@@ -1,4 +1,4 @@
#import "@preview/solo-lu-df:1.1.1": * #import "@preview/solo-lu-df:1.1.2": *
#show: ludf.with( #show: ludf.with(
title: "Darba Nosaukums", title: "Darba Nosaukums",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "solo-lu-df" name = "solo-lu-df"
version = "1.1.1" version = "1.1.2"
entrypoint = "src/lib.typ" entrypoint = "src/lib.typ"
authors = ["Kristofers Solo <dev@kristofers.xyz>"] authors = ["Kristofers Solo <dev@kristofers.xyz>"]
license = "MIT-0" license = "MIT-0"