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"), (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 == // == TITLE PAGES ==
@@ -481,12 +490,14 @@
faculty_abbreviation, faculty_abbreviation,
language_abbreviation, language_abbreviation,
document_type, document_type,
content_only,
) = { ) = {
( (
visual_style: visual_style, visual_style: visual_style,
faculty: faculty_abbreviation, faculty: faculty_abbreviation,
language: language_abbreviation, language: language_abbreviation,
type: document_type, type: document_type,
content_only: content_only,
) )
} }

View File

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

View File

@@ -1,39 +1,43 @@
#import "../lang.typ": get_lang_item #import "../lang.typ": get_lang_item
#import "common.typ": ( #import "common.typ": (
mainpage, abbrlist, abstract, assignment, bibliogr, default_styling, disclaimer, imagelist, mainpage,
default_styling, tablelist, toc,
assignment,
disclaimer,
abstract,
toc,
abbrlist,
imagelist,
tablelist,
bibliogr,
) )
#import "../attachments.typ": attachment_list #import "../attachments.typ": attachment_list
#import "../utils.typ": is_none, assert_not_none, assert_dict_has, assert_in_arr #import "../utils.typ": assert_dict_has, assert_in_arr, assert_not_none, is_none
#import "../arguments.typ": req_arg, get_arg, map_arg #import "../arguments.typ": get_arg, map_arg, req_arg
#import "../theme.typ": faculty_color #import "../theme.typ": faculty_color
#let other_title_page(args) = { #let other_title_page(args) = {
let language = req_arg(args, "document.language"); if req_arg(args, "document.content_only") {
let title = get_arg(args, "title"); return
map_arg(args, "title", (v) => { assert_dict_has((language,), v, "title") }) }
mainpage(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)
} }
#let other_base(args, content) = { #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")), { default_styling(
toc(language); true,
tablelist(language); faculty_color(req_arg(args, "document.faculty")),
imagelist(language); {
abbrlist(language); if not req_arg(args, "document.content_only") {
pagebreak(to: "even", weak: true); toc(language)
content; tablelist(language)
bibliogr(args); imagelist(language)
attachment_list(language); abbrlist(language)
}, 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. // - assignment (str): Filepath of the assignment document/page.
// - citations (str): The location of the citation file. // - citations (str): The location of the citation file.
// - presentation (dictionary): Arguments for the presentation // - 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 // - content (content): The content of the document
// //
//-> none //-> none
@@ -51,7 +52,7 @@
title_pages: none, title_pages: none,
title: none, keywords: none, abstract: none, acknowledgement: none, author: none, title: none, keywords: none, abstract: none, acknowledgement: none, author: none,
author_pronouns: none, supervisor: none, consultant: none, programme: 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 // nested
assignment: none, presentation: none, assignment: none, presentation: none,
@@ -72,7 +73,7 @@
) )
let args = arguments( let args = arguments(
document_info(style, faculty, lang, document), document_info(style, faculty, lang, document, content_only),
title_pages, title_pages,
title, title,
author_info(author, author_pronouns, programme, specialization, year_of_study), author_info(author, author_pronouns, programme, specialization, year_of_study),
@@ -125,7 +126,7 @@
req_arg, req_arg,
) )
let args = arguments( let args = arguments(
document_info(style, faculty, lang, document), document_info(style, faculty, lang, document, false),
none, none,
title, title,
author_info(author, author_pronouns, programme, specialization, year_of_study), author_info(author, author_pronouns, programme, specialization, year_of_study),