Ignore strut commands in running text

This commit is contained in:
gloamxun committed 2026-10-26 04:52:34 +08:00
1 parent 22f95c1536
commit 20813a6607
3 files changed
+11 -3

No files matched your search

+9 -1
View File
@@ -6983,7 +6983,7 @@ fn expand_character_commands(text: &str) -> String {
}
fn strip_noop_commands(text: &str) -> String {
const COMMANDS: [&str; 14] = [
const COMMANDS: [&str; 16] = [
"\\protect",
"\\relax",
"\\ignorespaces",
@@ -6994,6 +6994,8 @@ fn strip_noop_commands(text: &str) -> String {
"\\fussy",
"\\phantomsection",
"\\leavevmode",
"\\strut",
"\\mathstrut",
"\\linebreak",
"\\nolinebreak",
"\\pagebreak",
@@ -13449,6 +13451,12 @@ A definition.
assert_eq!(blocks[0].text, "See In body.");
}
#[test]
fn struts_leave_no_text_behind() {
let text = strip_noop_commands(r"A\strut B \mathstrut C");
assert_eq!(text, "A B C");
}
#[test]
fn character_commands_print_their_codepoints() {
let blocks = paragraphs("A\\char66 C and \\symbol{68}.").expect("paragraphs");