fix!: remove unnecessary gender key in cw_template

fix: add more subjects
docs: unify comments with pz_lb_template
This commit is contained in:
2025-03-13 12:35:12 +02:00
parent b3214e2150
commit 429f632841

28
lib.typ
View File

@ -4,11 +4,14 @@
/// subject abbreviations to full names /// subject abbreviations to full names
#let subjects = ( #let subjects = (
"БД": "Бази даних", "БД": "Бази даних",
"ОТК": "Основи теорії кіл", "БЖД": "Безпека життєдіяльності",
"ОІМ": "Основи IP-мереж",
"ОПНJ": "Основи програмування на Java", "ОПНJ": "Основи програмування на Java",
"ОС": "Операційні системи", "ОС": "Операційні системи",
"ОТК": "Основи теорії кіл",
"ПП": "Проектний практикум", "ПП": "Проектний практикум",
"СПМ": "Скриптові мови програмування", "СПМ": "Скриптові мови програмування",
"УФМ": "Українське фахове мовлення",
"Ф": "Філософія", "Ф": "Філософія",
"ФІЗ": "Фізика", "ФІЗ": "Фізика",
) )
@ -268,8 +271,8 @@
/// - doc (content): Content to apply the template to. /// - doc (content): Content to apply the template to.
/// - title (str): Title of the document. /// - title (str): Title of the document.
/// - subject (str): Subject short name. /// - subject (str): Subject short name.
/// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of Authors dicts. /// - authors ((name: str, full_name_gen: str, variant: int, group: str, gender: str),): List of authors.
/// - mentors ((name: str, gender: str, degree: str),): List of mentors dicts. /// - mentors ((name: str, degree: str),): List of mentors.
/// - edu_program (str): Education program shorthand. /// - edu_program (str): Education program shorthand.
/// - task_list (done_date: datetime, initial_date: datetime, source: (content | str), content: (content | str), graphics: (content | str)): Task list object. /// - task_list (done_date: datetime, initial_date: datetime, source: (content | str), content: (content | str), graphics: (content | str)): Task list object.
/// - calendar_plan ( plan_table: (content | str), approval_date: datetime): Calendar plan object. /// - calendar_plan ( plan_table: (content | str), approval_date: datetime): Calendar plan object.
@ -400,7 +403,9 @@
grid( grid(
columns: (1fr, 1fr, 1fr), columns: (1fr, 1fr, 1fr),
gutter: 0.3fr, gutter: 0.3fr,
[#bold[Курс] #uline(2)], [#bold[Група] #uline(author.group)], [#bold[Семестр] #uline(3)], [#bold[Курс] #uline(2)],
[#bold[Група] #uline(author.group)],
[#bold[Семестр] #uline(3)],
) )
linebreak() linebreak()
@ -521,17 +526,21 @@
#{ #{
let keywords = abstract.keywords.map(upper) let keywords = abstract.keywords.map(upper)
let is_cyrillic = word => word.split("").any(char => ("А" <= char and char <= "я")) let is_cyrillic = word => word
.split("")
.any(char => ("А" <= char and char <= "я"))
let n = keywords.len() let n = keywords.len()
for i in range(n) { for i in range(n) {
for j in range(0, n - i - 1) { for j in range(0, n - i - 1) {
if ( if (
( (
not is_cyrillic(keywords.at(j)) and is_cyrillic(keywords.at(j + 1)) not is_cyrillic(keywords.at(j))
and is_cyrillic(keywords.at(j + 1))
) )
or ( or (
is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1)) and keywords.at(j) > keywords.at(j + 1) is_cyrillic(keywords.at(j)) == is_cyrillic(keywords.at(j + 1))
and keywords.at(j) > keywords.at(j + 1)
) )
) { ) {
(keywords.at(j), keywords.at(j + 1)) = ( (keywords.at(j), keywords.at(j + 1)) = (
@ -608,7 +617,10 @@
} }
context { context {
for (i, citation) in query(ref.where(element: none)).map(r => str(r.target)).dedup().enumerate() { for (i, citation) in query(ref.where(element: none))
.map(r => str(r.target))
.dedup()
.enumerate() {
enum.item( enum.item(
i + 1, i + 1,
format-entry(bib_data.at(citation)), format-entry(bib_data.at(citation)),