mirror of
https://github.com/YGGverse/ggemtext.git
synced 2026-03-31 17:15:33 +00:00
remove extra conditions
This commit is contained in:
parent
f08ae77b7c
commit
b4d9686db5
3 changed files with 13 additions and 27 deletions
|
|
@ -26,27 +26,15 @@ impl Header {
|
|||
RegexMatchFlags::DEFAULT,
|
||||
);
|
||||
|
||||
// Detect header level
|
||||
let level = regex.get(1)?;
|
||||
|
||||
let level = match level.len() {
|
||||
// Result
|
||||
Some(Self {
|
||||
level: match regex.get(1)?.len() {
|
||||
1 => Level::H1,
|
||||
2 => Level::H2,
|
||||
3 => Level::H3,
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
// Detect header value
|
||||
let value = regex.get(2)?.trim();
|
||||
|
||||
if value.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Result
|
||||
Some(Self {
|
||||
level,
|
||||
value: value.to_string(),
|
||||
},
|
||||
value: regex.get(2)?.trim().to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,9 +19,8 @@ impl List {
|
|||
);
|
||||
|
||||
// Extract formatted value
|
||||
let value = regex.get(1)?.trim().to_string();
|
||||
|
||||
// Result
|
||||
Some(Self { value })
|
||||
Some(Self {
|
||||
value: regex.get(1)?.trim().to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,9 +19,8 @@ impl Quote {
|
|||
);
|
||||
|
||||
// Extract formatted value
|
||||
let value = regex.get(1)?.trim().to_string();
|
||||
|
||||
// Result
|
||||
Some(Self { value })
|
||||
Some(Self {
|
||||
value: regex.get(1)?.trim().to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue