Expand more text symbol commands

This commit is contained in:
gloamxun committed 2026-10-26 04:21:51 +08:00
1 parent 55d34dc259
commit 313ea366d6
3 files changed
+21 -3

No files matched your search

+18
View File
@@ -7251,6 +7251,12 @@ fn text_symbol(rest: &str) -> Option<(&'static str, usize)> {
("\\textyen", "\u{a5}"),
("\\textcent", "\u{a2}"),
("\\textmu", "\u{b5}"),
("\\textquotedbl", "\\\""),
("\\textquotesingle", "'"),
("\\textunderscore", "_"),
("\\textbraceleft", "{"),
("\\textbraceright", "}"),
("\\textasciigrave", "`"),
("\\textbackslash", "\\"),
("\\textasciitilde", "~"),
("\\textasciicircum", "^"),
@@ -13106,6 +13112,18 @@ A definition.
assert_eq!(runs[0].3, "Boxed");
}
#[test]
fn more_text_symbols_expand() {
let preview = preview_json(
"A \\textquotesingle{} \\textunderscore{} \\textbraceleft{} \\textbraceright{} B",
)
.expect("preview");
assert!(preview.contains(">'</text>"));
assert!(preview.contains(">_</text>"));
assert!(!preview.contains("textquotesingle"));
assert!(!preview.contains("textbraceleft"));
}
#[test]
fn noop_commands_are_dropped() {
let preview = preview_json("A \\protect B \\relax C \\ignorespaces D \\phantomsection E.")