diff options
| author | Klimperfix | 2025-10-04 12:37:40 +0200 |
|---|---|---|
| committer | Klimperfix | 2025-10-04 12:37:40 +0200 |
| commit | f5adcd0fad71828646b5047c661a0d8524a3fc9c (patch) | |
| tree | 5348c9a437fa1083ca04811f5a8ad47eb9f8539e | |
| parent | d80ce65ad5efb64fcce313a4c44b7f46fc5e7798 (diff) | |
| download | bibiman-f5adcd0fad71828646b5047c661a0d8524a3fc9c.tar.gz bibiman-f5adcd0fad71828646b5047c661a0d8524a3fc9c.zip | |
macro-sani: Fixed whitespace handling after latex macro.
| -rw-r--r-- | src/bibiman/sanitize/optimized_sanitize.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bibiman/sanitize/optimized_sanitize.rs b/src/bibiman/sanitize/optimized_sanitize.rs index 3a9dc67..8ee0115 100644 --- a/src/bibiman/sanitize/optimized_sanitize.rs +++ b/src/bibiman/sanitize/optimized_sanitize.rs @@ -35,7 +35,7 @@ enum Token { OpenCurlyBracket, #[token("}")] ClosedCurlyBracket, - #[regex(r"\\[\*\w]+")] + #[regex(r"\\[\*\w]+ ?")] LaTeXMacro, #[token(r"\ ")] ForcedSpace, @@ -85,7 +85,7 @@ pub fn optimized_sanitize(input_text: &str) -> String { } Token::LaTeXMacro => { let texmacro = lex.slice(); - if let Some(x) = LOOKUP.get(&texmacro) { + if let Some(x) = LOOKUP.get(&texmacro.trim_end()) { if let Some(end) = x.1 { bc_up = true; counter_actions.insert(bracket_counter + 1, end); @@ -113,10 +113,10 @@ mod tests { #[test] fn check_sanitization() { let result = optimized_sanitize( - r"\mkbibquote{Intention} und \mkbibquote{Intentionen \mkbibquote{sind} \hyphen\ bibquote.}", + r"\mkbibquote {Intention} und \mkbibquote{Intentionen \mkbibquote{sind} \hyphen\ bibquote\hyphen .}", ); assert_eq!( - "\"Intention\" und \"Intentionen \"sind\" - bibquote.\"", + "\"Intention\" und \"Intentionen \"sind\" - bibquote-.\"", result ) } |
