Files
mdemory/docs/utils.typst
2024-11-09 12:37:57 +02:00

213 lines
3.4 KiB
Plaintext

#import "@preview/tablex:0.0.6": tablex
#import "@preview/big-todo:0.2.0": todo as TODO
#let custom-block(
item,
) = {
set align(start)
block(
inset: 8pt,
stroke: black,
width: 100%,
spacing: 0pt,
breakable: true,
item,
)
}
#let longtable(
title: "",
titles: (),
caption: "",
..items,
) = {
figure(
gap: 1.5em,
kind: table,
caption: if caption != "" {
caption
} else {
if titles.len() == 0 {
title
} else {
titles.first()
}
},
[
// set par(first-line-indent: 0pt)
#if titles.len() == 0 {
custom-block(
text(
weight: "bold",
title,
),
)
}
#for i in range(
items.pos().len(),
) {
if titles.len() > 0 {
custom-block(
text(
weight: "bold",
titles.at(i),
),
)
}
custom-block(
items.pos().at(i),
)
}
],
)
// linebreak()
}
#let procedure-table(
caption: "",
..items,
) = {
if caption == "" {
caption = items.pos().first()
}
longtable(
titles: (
"Procedūras nosaukums",
"Procedūras identifikators",
"Procedūras apraksts",
"Ievade",
"Apstrāde",
"Izvade",
),
caption: caption,
..items,
)
}
#let format-table(
caption: "",
..items,
) = {
if caption == "" {
caption = items.pos().first()
}
longtable(
titles: (
"Formāta nosaukums",
"Formāta identifikators",
"Apraksts",
"Piemērs",
),
caption: caption,
..items,
)
}
#let io-table(
caption: "",
..items,
) = {
if caption == "" {
caption = items.pos().first()
}
longtable(
titles: (
"Ievades/izvades vērtības nosaukums",
"Identifikators",
"Apraksts",
),
caption: caption,
..items,
)
}
#let function-table(
caption: "",
..items,
) = {
if caption == "" {
caption = items.pos().first()
}
longtable(
titles: (
"Funkcijas nosaukums",
"Funkcijas identifikators",
"Apraksts",
"Ievade",
"Apstrāde",
"Izvade",
"Paziņojumi",
),
caption: caption,
..items,
)
}
Manuālie integrācijas testi tiek veikti, izmantojot lietotāju saskarni. Testi
ir dokumentēti tabulās norādot testa gadījuma nosaukumu, pirmsnosacījumus,
aprakstu, ievadi, izpildi, sagaidāmo rezultātu.
#let testcase-table(
caption: "",
..items,
) = {
if caption == "" {
caption = items.pos().first()
}
longtable(
titles: (
"Testa gadījuma nosaukums",
"Testa gadījuma identifikators",
"Pirmsnosacījumi",
"Apraksts",
"Ievade",
"Izpilde",
"Sagaidāmais rezultāts",
"Rezultāts",
),
caption: caption,
..items,
)
}
#let todo(
..body,
) = {
TODO(
..body,
inline: true,
big_text: 14pt,
small_text: 12pt,
)
}
#let hyperlink-source(
author,
title,
link_str,
date,
) = {
let author_part = ""
if author != "" {
author_part = [#author. ]
}
let title_part = ""
if title != "" {
title_part = [#title. ]
}
let link_part = ""
if link_str != "" {
link_part = [Pieejams: #link(link_str). ]
}
let date_part = ""
if date != none {
date_part = [Aplūkots #date.display("[day].[month].[year]"). ]
}
[#author_part#title_part#link_part#date_part]
}