Skip to content

Commit

Permalink
update comments, create new string on parsed only
Browse files Browse the repository at this point in the history
  • Loading branch information
yggverse committed Dec 3, 2024
1 parent 12091be commit 04120b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/line/code/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ impl Inline {
RegexMatchFlags::DEFAULT,
);

// Detect value
let value = regex.get(1)?;
// Extract formatted value
let value = regex.get(1)?.trim();

if value.trim().is_empty() {
if value.is_empty() {
return None;
}

Expand Down
9 changes: 6 additions & 3 deletions src/line/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ impl Header {
};

// Detect header value
let value = regex.get(2)?.to_string();
let value = regex.get(2)?.trim();

if value.trim().is_empty() {
if value.is_empty() {
return None;
}

// Result
Some(Self { level, value })
Some(Self {
level,
value: value.to_string(),
})
}
}
2 changes: 1 addition & 1 deletion src/line/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl Quote {
RegexMatchFlags::DEFAULT,
);

// Detect value
// Extract formatted value
let value = regex.get(1)?.trim().to_string();

// Result
Expand Down

0 comments on commit 04120b2

Please sign in to comment.