mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
update variable name
This commit is contained in:
parent
54e370215b
commit
ab0d87a3e2
@ -14,7 +14,7 @@ pub struct Header {
|
|||||||
impl Header {
|
impl Header {
|
||||||
pub fn from(line: &str) -> Option<Self> {
|
pub fn from(line: &str) -> Option<Self> {
|
||||||
// Parse line
|
// Parse line
|
||||||
let parsed = Regex::split_simple(
|
let regex = Regex::split_simple(
|
||||||
r"^(#{1,3})\s*(.+)$",
|
r"^(#{1,3})\s*(.+)$",
|
||||||
line,
|
line,
|
||||||
RegexCompileFlags::DEFAULT,
|
RegexCompileFlags::DEFAULT,
|
||||||
@ -22,7 +22,7 @@ impl Header {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Detect header level
|
// Detect header level
|
||||||
let level = parsed.get(1)?;
|
let level = regex.get(1)?;
|
||||||
|
|
||||||
let level = match level.len() {
|
let level = match level.len() {
|
||||||
1 => Level::H1,
|
1 => Level::H1,
|
||||||
@ -32,7 +32,7 @@ impl Header {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Detect header value
|
// Detect header value
|
||||||
let value = parsed.get(2)?;
|
let value = regex.get(2)?;
|
||||||
|
|
||||||
if value.trim().is_empty() {
|
if value.trim().is_empty() {
|
||||||
return None;
|
return None;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user