Skip to content

Commit

Permalink
fix(whiskerify): don't only search for hex codes with #
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter committed Jun 9, 2024
1 parent 5c6a544 commit 6104f93
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/whiskerify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,13 @@ pub fn convert(input: PathBuf, output: Option<PathBuf>) -> Result<()> {
);

for color in &flavor.colors {
let search = RegexBuilder::new(&("(?i)".to_string() + &color.hex.to_string()))
.build()
.expect("Invalid Regex");
let pat = "(?i)".to_string() + &color.hex.to_string()[1..];
let search = Regex::new(&pat).unwrap();

for result in search.find_iter(&contents.clone()).flatten() {
contents = contents.replace(
result.as_str(),
&format!(
"#{}",
as_tera_expr(&(color.identifier().to_string() + ".hex"))
),
&as_tera_expr(&(color.identifier().to_string() + ".hex")),
);
}

Expand Down

0 comments on commit 6104f93

Please sign in to comment.