Skip to content

Commit

Permalink
remove hardcoded line ending in frontmatter parser (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
backwardspy authored Apr 1, 2024
1 parent 034c4d9 commit ac38530
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions whiskers/src/frontmatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ fn split(template: &str) -> Option<(&str, &str)> {
// we consider a template to possibly have frontmatter iff:
// * line 0 is "---"
// * there is another "---" on another line
let sep = "---\n";
let template = template.trim();
let sep = "---";
if !template.starts_with(sep) {
return None;
}

template[sep.len()..].split_once(sep)
template[sep.len()..]
.split_once(sep)
.map(|(a, b)| (a.trim(), b.trim()))
}

0 comments on commit ac38530

Please sign in to comment.