mirror of
https://github.com/kristoferssolo/LU-DF-Typst-Template.git
synced 2026-02-04 06:22:05 +00:00
feat: add qualification thesis example
This commit is contained in:
48
examples/qualification-thesis/utils/diagrams.typ
Normal file
48
examples/qualification-thesis/utils/diagrams.typ
Normal file
@@ -0,0 +1,48 @@
|
||||
#import "@preview/fletcher:0.5.8" as fletcher: diagram, edge, node
|
||||
#import fletcher.shapes: cylinder, diamond, ellipse
|
||||
|
||||
#let default-node-stroke = 1pt
|
||||
#let default-edge-stroke = 1pt
|
||||
|
||||
/// Read https://github.com/typst/packages/raw/main/packages/preview/fletcher/0.5.8/docs/manual.pdf for more information
|
||||
|
||||
#let data-store(pos, text) = {
|
||||
node(
|
||||
pos,
|
||||
text,
|
||||
inset: 20pt,
|
||||
stroke: default-node-stroke,
|
||||
)
|
||||
}
|
||||
|
||||
#let process(..args) = {
|
||||
node(
|
||||
inset: 10pt,
|
||||
shape: ellipse,
|
||||
stroke: default-node-stroke,
|
||||
..args,
|
||||
)
|
||||
}
|
||||
|
||||
#let dpd-edge(..args) = {
|
||||
edge(
|
||||
label-pos: 0.5,
|
||||
stroke: default-edge-stroke,
|
||||
label-anchor: "center",
|
||||
label-fill: white,
|
||||
corner-radius: 4pt,
|
||||
label-size: 10pt,
|
||||
..args,
|
||||
"-|>",
|
||||
)
|
||||
}
|
||||
|
||||
#let dpd-database(..args) = {
|
||||
node(
|
||||
shape: cylinder,
|
||||
height: 6em,
|
||||
width: 10em,
|
||||
stroke: default-node-stroke,
|
||||
..args,
|
||||
)
|
||||
}
|
||||
56
examples/qualification-thesis/utils/tables.typ
Normal file
56
examples/qualification-thesis/utils/tables.typ
Normal file
@@ -0,0 +1,56 @@
|
||||
/// Creates a two-column "function" table with a caption.
|
||||
///
|
||||
/// Intended for "Funkciju sadalījums moduļos" section
|
||||
///
|
||||
/// Parameters:
|
||||
/// - caption: optional caption; defaults to the first positional item.
|
||||
/// - title: tuple of column/section titles (defaults provided).
|
||||
/// - items: positional cells; first two items populate the top row,
|
||||
/// remaining items are paired with the titles ["Apraksts", "Ievade", ...]
|
||||
///
|
||||
/// Behavior:
|
||||
/// - Renders the first two titles as table headers and the first two
|
||||
/// positional items beneath them.
|
||||
/// - For titles from index 2 onward, each title is rendered as a full-width
|
||||
/// (colspan 2) bold row followed by a full-width row containing the
|
||||
/// corresponding positional item. Missing items become empty strings.
|
||||
/// - Safe for fewer/more items: missing values are coerced to "", extra
|
||||
/// items beyond the paired section are ignored.
|
||||
///
|
||||
/// Default caption to the first positional item if none provided.
|
||||
#let function-table(
|
||||
caption: "",
|
||||
titles: (
|
||||
"Funkcijas nosaukums",
|
||||
"Funkcijas identifikators",
|
||||
"Apraksts",
|
||||
"Ievade",
|
||||
"Apstrāde",
|
||||
"Izvade",
|
||||
"Paziņojumi",
|
||||
),
|
||||
..items,
|
||||
) = {
|
||||
if caption == "" {
|
||||
caption = items.pos().first()
|
||||
}
|
||||
|
||||
let cells = titles
|
||||
.slice(2) // start from "Apraksts"
|
||||
.zip(items.pos().slice(2))
|
||||
.map(pair => (
|
||||
table.cell(colspan: 2, strong(pair.at(0))),
|
||||
table.cell(colspan: 2, pair.at(1)),
|
||||
))
|
||||
.flatten()
|
||||
|
||||
figure(
|
||||
caption: caption,
|
||||
table(
|
||||
columns: (1fr, 1fr),
|
||||
strong(titles.at(0)), strong(titles.at(1)),
|
||||
items.pos().at(0), items.pos().at(1),
|
||||
..cells,
|
||||
),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user