Skip to content

Commit

Permalink
+ parser fit multibytes input
Browse files Browse the repository at this point in the history
  • Loading branch information
oluceps committed Nov 10, 2024
1 parent 28aa9fe commit b73eed4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/helper/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ pub fn extract_all_hashes<'a>(input: &'a str, res: &mut Vec<&'a str>) {
// less than expected `{{ hash }}` length
return;
} else {
let this = &input[1..];
let this = {
// handle multibytes
let res = input.char_indices().nth(1).map_or("", |(i, _)| &input[i..]);
// skip to next `{`
res.find('{').map_or("", |index| &res[index..])
};

extract_all_hashes(this, res)
}
}
Expand Down

0 comments on commit b73eed4

Please sign in to comment.