Capture body-level chardef definitions
This commit is contained in:
1 parent
2408736c5e
commit
dc49b92a47
3 files changed
+20
-2
No files matched your search
@@ -4207,6 +4207,11 @@ fn capture_body_definitions(body: &mut String, macros: &mut Vec<MacroDefinition>
|
||||
changed = true;
|
||||
continue;
|
||||
}
|
||||
if let Some(definition) = char_definition(definition_line) {
|
||||
macros.push(definition);
|
||||
changed = true;
|
||||
continue;
|
||||
}
|
||||
if let Some((name, target)) = macro_alias(definition_line) {
|
||||
let source = macros
|
||||
.iter()
|
||||
@@ -12633,6 +12638,19 @@ See \ref{fig:a} and \ref{tab:b}.";
|
||||
assert_eq!(body.trim(), "loaded missing");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn body_chardef_defines_a_character() {
|
||||
let source = "\\chardef\\letter=65\n\n\\letter b.";
|
||||
let (body, geometry) = geometry_and_body(source);
|
||||
assert_eq!(body.trim(), "A b.");
|
||||
assert!(
|
||||
geometry
|
||||
.macros
|
||||
.iter()
|
||||
.any(|definition| definition.name == "\\letter")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn body_let_aliases_expand() {
|
||||
let source = "\\def\\x{A}\n\\let\\y=\\x\n\n\\y b.";
|
||||
|
||||
Reference in new issue
Block a user