mirror of
https://github.com/YGGverse/ggemtext.git
synced 2026-04-01 09:35:34 +00:00
skip regex operations on tag mismatch subject
This commit is contained in:
parent
7345400172
commit
83ec663929
4 changed files with 18 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
use super::TAG;
|
||||
use glib::{Regex, RegexCompileFlags, RegexMatchFlags};
|
||||
|
||||
/// Inline [preformatted](https://geminiprotocol.net/docs/gemtext-specification.gmi#in-pre-formatted-mode) entity holder
|
||||
|
|
@ -10,6 +11,12 @@ impl Inline {
|
|||
|
||||
/// Parse `Self` from line string
|
||||
pub fn from(line: &str) -> Option<Self> {
|
||||
// Skip next operations on prefix and postfix mismatch `TAG`
|
||||
// * replace regex implementation @TODO
|
||||
if !line.starts_with(TAG) && !line.ends_with(TAG) {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Parse line
|
||||
let regex = Regex::split_simple(
|
||||
r"^`{3}([^`]+)`{3}$",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue