Allow documents to replace the title block

This commit is contained in:
gloamxun committed 2026-10-19 14:32:35 +08:00
1 parent 23cf1f13de
commit 5e9552d785
8 files changed
+89 -18

No files matched your search

+22
View File
@@ -1000,3 +1000,25 @@ fn chapter_headings_number_sections_and_enter_contents() {
"section was numbered under chapter zero: {svg}"
);
}
#[test]
fn custom_maketitle_replaces_the_engine_title_block() {
let source = r#"\documentclass{article}
\title{Custom title}
\author{Engine author}
\renewcommand{\maketitle}{\begin{center}\@title\end{center}}
\begin{document}
\maketitle
Body text.
\end{document}
"#;
let value = fresh_preview(source, "custom-title.tex");
assert_eq!(value["status"], "ok", "{}", value["message"]);
let svg = page_svg(&value, 0);
assert!(svg.contains("Custom"), "custom title missing: {svg}");
assert!(
!svg.contains("Engine title"),
"engine title block was not replaced: {svg}"
);
assert!(svg.contains("Body"), "body text missing: {svg}");
}