mirror of
https://github.com/YGGverse/ggemtext.git
synced 2026-03-31 17:15:33 +00:00
remove extra condition by regex change
This commit is contained in:
parent
facb90dfa9
commit
f08ae77b7c
1 changed files with 2 additions and 9 deletions
|
|
@ -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(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue