handle citation path mapping for arrays
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
// tools & utils
|
// tools & utils
|
||||||
#import "../theme.typ": faculty_logotype, tul_logomark, faculty_color
|
#import "../theme.typ": faculty_color, faculty_logotype, tul_logomark
|
||||||
#import "../lang.typ": lang_id, get_lang_item
|
#import "../lang.typ": get_lang_item, lang_id
|
||||||
#import "../utils.typ": assert_in_dict, assert_in_arr, map_none, assert_dict_has, is_none
|
#import "../utils.typ": assert_dict_has, assert_in_arr, assert_in_dict, is_none, map_none
|
||||||
#import "../arguments.typ": req_arg, map_arg, get_arg
|
#import "../arguments.typ": get_arg, map_arg, req_arg
|
||||||
#import "common.typ": default_styling, external_title_pages
|
#import "common.typ": default_styling, external_title_pages
|
||||||
|
|
||||||
// thesis types
|
// thesis types
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#import "dp.typ": dp
|
#import "dp.typ": dp
|
||||||
#import "prj.typ": prj
|
#import "prj.typ": prj
|
||||||
#import "sp.typ": sp
|
#import "sp.typ": sp
|
||||||
#import "other.typ": other_title_page, other_base
|
#import "other.typ": other_base, other_title_page
|
||||||
#import "thesis_base.typ": thesis_base, thesis_base_title_pages
|
#import "thesis_base.typ": thesis_base, thesis_base_title_pages
|
||||||
#import "presentation.typ": presentation
|
#import "presentation.typ": presentation
|
||||||
|
|
||||||
@@ -18,69 +18,85 @@
|
|||||||
"bp": (root: bp, base: thesis_base, title_pages: thesis_base_title_pages),
|
"bp": (root: bp, base: thesis_base, title_pages: thesis_base_title_pages),
|
||||||
"dp": (root: dp, base: thesis_base, title_pages: thesis_base_title_pages),
|
"dp": (root: dp, base: thesis_base, title_pages: thesis_base_title_pages),
|
||||||
"prj": (root: prj, base: thesis_base, title_pages: thesis_base_title_pages),
|
"prj": (root: prj, base: thesis_base, title_pages: thesis_base_title_pages),
|
||||||
"sp": (root: sp, base: thesis_base.with(
|
"sp": (
|
||||||
|
root: sp,
|
||||||
|
base: thesis_base.with(
|
||||||
show_disclaimer: false,
|
show_disclaimer: false,
|
||||||
require_abstract: false,
|
require_abstract: false,
|
||||||
), title_pages: thesis_base_title_pages),
|
),
|
||||||
|
title_pages: thesis_base_title_pages,
|
||||||
|
),
|
||||||
"other": (root: other_title_page, base: other_base),
|
"other": (root: other_title_page, base: other_base),
|
||||||
"presentation": (base: presentation,),
|
"presentation": (base: presentation),
|
||||||
)
|
)
|
||||||
|
|
||||||
#let prep_args(args) = {
|
#let prep_args(args) = {
|
||||||
let language = req_arg(args, "document.language");
|
let language = req_arg(args, "document.language")
|
||||||
|
|
||||||
// argument pre-checking
|
// argument pre-checking
|
||||||
assert_in_dict(req_arg(args, "document.type"), document_types, "document type");
|
assert_in_dict(req_arg(args, "document.type"), document_types, "document type")
|
||||||
map_arg(args, "title", (v) => assert_dict_has((language,), v, "title"));
|
map_arg(args, "title", v => assert_dict_has((language,), v, "title"))
|
||||||
map_arg(args, "author.programme", (v) => assert_dict_has((language,), v, "study programme"));
|
map_arg(args, "author.programme", v => assert_dict_has((language,), v, "study programme"))
|
||||||
map_arg(
|
map_arg(
|
||||||
args, "author.specialization", (v) => assert_dict_has((language,), v, "study specialization")
|
args,
|
||||||
);
|
"author.specialization",
|
||||||
|
v => assert_dict_has((language,), v, "study specialization"),
|
||||||
|
)
|
||||||
map_arg(
|
map_arg(
|
||||||
args, "acknowledgement", (v) => assert_dict_has((language,), v, "acknowledgement content")
|
args,
|
||||||
);
|
"acknowledgement",
|
||||||
|
v => assert_dict_has((language,), v, "acknowledgement content"),
|
||||||
|
)
|
||||||
|
|
||||||
args.assignment = map_arg(args, "assignment", (v) => {
|
args.assignment = map_arg(args, "assignment", v => {
|
||||||
if type(v) == str {
|
if type(v) == str {
|
||||||
"../../" + v
|
"../../" + v
|
||||||
} else {
|
} else {
|
||||||
v
|
v
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
args.citations = map_arg(args, "citations", (v) => "../../" + v);
|
args.citations = map_arg(args, "citations", v => {
|
||||||
args.title_pages = map_arg(args, "title_pages", (v) => "../../" + v);
|
if type(v) == array {
|
||||||
|
v.map(v => { "../../" + v })
|
||||||
|
} else if type(v) == str {
|
||||||
|
"../../" + v
|
||||||
|
} else {
|
||||||
|
panic()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
args.title_pages = map_arg(args, "title_pages", v => "../../" + v)
|
||||||
|
|
||||||
args
|
args
|
||||||
}
|
}
|
||||||
|
|
||||||
#let template_classic(args, content) = {
|
#let template_classic(args, content) = {
|
||||||
let args = prep_args(args);
|
let args = prep_args(args)
|
||||||
|
|
||||||
let doctype = req_arg(args, "document.type");
|
let doctype = req_arg(args, "document.type")
|
||||||
let doc = document_types.at(doctype);
|
let doc = document_types.at(doctype)
|
||||||
if "root" in doc {
|
if "root" in doc {
|
||||||
if not is_none(get_arg(args, "title_pages")) {
|
if not is_none(get_arg(args, "title_pages")) {
|
||||||
external_title_pages(req_arg(args, "title_pages"));
|
external_title_pages(req_arg(args, "title_pages"))
|
||||||
doc.at("base")(args, content);
|
doc.at("base")(args, content)
|
||||||
} else {
|
} else {
|
||||||
doc.at("root")(args);
|
doc.at("root")(args)
|
||||||
doc.at("base")(args, content);
|
doc.at("base")(args, content)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
doc.at("base")(args, content);
|
doc.at("base")(args, content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#let title_pages_classic(args) = {
|
#let title_pages_classic(args) = {
|
||||||
let args = prep_args(args);
|
let args = prep_args(args)
|
||||||
|
|
||||||
let doctype = req_arg(args, "document.type");
|
let doctype = req_arg(args, "document.type")
|
||||||
let doc = document_types.at(doctype);
|
let doc = document_types.at(doctype)
|
||||||
if "title_pages" in doc {
|
if "title_pages" in doc {
|
||||||
doc.at("root")(args);
|
doc.at("root")(args)
|
||||||
doc.at("title_pages")(args);
|
doc.at("title_pages")(args)
|
||||||
} else {
|
} else {
|
||||||
let panic_message = "document of type '" + doctype + "' can't generate title pages";
|
let panic_message = "document of type '" + doctype + "' can't generate title pages"
|
||||||
panic(panic_message);
|
panic(panic_message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user