add content-only option

This commit is contained in:
2025-12-08 23:18:42 +01:00
parent 57e97bf64d
commit 73e0c700ad
4 changed files with 57 additions and 32 deletions

View File

@@ -77,7 +77,16 @@
(cs: "Typ dokumentu", en: "The type of the document"),
)
keyval(literal("document"), struct(visual_style, faculty, language, type))
let content_only = doc(
keyval(literal("content_only"), bool),
"content_only",
(
cs: "Zda u dokumentu typu `other` generovat pouze obsah",
en: "Whether to generate only content for document of type `other`",
),
)
keyval(literal("document"), struct(visual_style, faculty, language, type, content_only))
}
// == TITLE PAGES ==
@@ -481,12 +490,14 @@
faculty_abbreviation,
language_abbreviation,
document_type,
content_only,
) = {
(
visual_style: visual_style,
faculty: faculty_abbreviation,
language: language_abbreviation,
type: document_type,
content_only: content_only,
)
}

View File

@@ -466,8 +466,17 @@
// ABBREVIATION LIST
#let abbrlist(language) = {
#let abbrlist(language, hidden: false) = {
import "../abbreviations.typ": abbrlist
if hidden {
context {
let abbrs = abbrlist()
for abbr in abbrs.pairs() {
[#metadata("empty")#label("abbr_" + abbr.at(0))]
}
}
return
}
context {
let abbrs = abbrlist();
let max_abbr_width = if abbrs.len() > 0 {

View File

@@ -1,39 +1,43 @@
#import "../lang.typ": get_lang_item
#import "common.typ": (
mainpage,
default_styling,
assignment,
disclaimer,
abstract,
toc,
abbrlist,
imagelist,
tablelist,
bibliogr,
abbrlist, abstract, assignment, bibliogr, default_styling, disclaimer, imagelist, mainpage,
tablelist, toc,
)
#import "../attachments.typ": attachment_list
#import "../utils.typ": is_none, assert_not_none, assert_dict_has, assert_in_arr
#import "../arguments.typ": req_arg, get_arg, map_arg
#import "../utils.typ": assert_dict_has, assert_in_arr, assert_not_none, is_none
#import "../arguments.typ": get_arg, map_arg, req_arg
#import "../theme.typ": faculty_color
#let other_title_page(args) = {
let language = req_arg(args, "document.language");
let title = get_arg(args, "title");
map_arg(args, "title", (v) => { assert_dict_has((language,), v, "title") })
mainpage(args);
if req_arg(args, "document.content_only") {
return
}
let language = req_arg(args, "document.language")
let title = get_arg(args, "title")
map_arg(args, "title", v => { assert_dict_has((language,), v, "title") })
mainpage(args)
}
#let other_base(args, content) = {
let language = req_arg(args, "document.language");
let language = req_arg(args, "document.language")
default_styling(true, faculty_color(req_arg(args, "document.faculty")), {
toc(language);
tablelist(language);
imagelist(language);
abbrlist(language);
pagebreak(to: "even", weak: true);
content;
bibliogr(args);
attachment_list(language);
}, language);
default_styling(
true,
faculty_color(req_arg(args, "document.faculty")),
{
if not req_arg(args, "document.content_only") {
toc(language)
tablelist(language)
imagelist(language)
abbrlist(language)
pagebreak(to: "even", weak: true)
} else {
abbrlist(language, hidden: true)
}
content
bibliogr(args)
attachment_list(language)
},
language,
)
}

View File

@@ -40,6 +40,7 @@
// - assignment (str): Filepath of the assignment document/page.
// - citations (str): The location of the citation file.
// - presentation (dictionary): Arguments for the presentation
// - content_only (bool): Whether to output content only (this works for documents of type `other`)
// - content (content): The content of the document
//
//-> none
@@ -51,7 +52,7 @@
title_pages: none,
title: none, keywords: none, abstract: none, acknowledgement: none, author: none,
author_pronouns: none, supervisor: none, consultant: none, programme: none,
specialization: none, year_of_study: none,
specialization: none, year_of_study: none, content_only: false,
// nested
assignment: none, presentation: none,
@@ -72,7 +73,7 @@
)
let args = arguments(
document_info(style, faculty, lang, document),
document_info(style, faculty, lang, document, content_only),
title_pages,
title,
author_info(author, author_pronouns, programme, specialization, year_of_study),
@@ -125,7 +126,7 @@
req_arg,
)
let args = arguments(
document_info(style, faculty, lang, document),
document_info(style, faculty, lang, document, false),
none,
title,
author_info(author, author_pronouns, programme, specialization, year_of_study),