remove extra condition by regex change

This commit is contained in:
yggverse 2024-12-03 19:38:39 +02:00
parent facb90dfa9
commit f08ae77b7c

View file

@ -12,22 +12,15 @@ impl Inline {
pub fn from(line: &str) -> Option<Self> {
// Parse line
let regex = Regex::split_simple(
r"^`{3}([^`]*)`{3}$",
r"^`{3}([^`]+)`{3}$",
line,
RegexCompileFlags::DEFAULT,
RegexMatchFlags::DEFAULT,
);
// Extract formatted value
let value = regex.get(1)?.trim();
if value.is_empty() {
return None;
}
// Result
Some(Self {
value: value.to_string(),
value: regex.get(1)?.trim().to_string(),
})
}
}