mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-13 14:22:35 +00:00
Fixed bug where spaces where not trimmed and only the first level was parsed correctly
This commit is contained in:
parent
60e47d2e08
commit
35be20da8b
1 changed files with 2 additions and 2 deletions
|
@ -78,11 +78,11 @@ fn level(line: &str, spaces_in_tab: i32) -> Result<i32> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn parse_line(line: &str) -> Option<BookItem> {
|
fn parse_line(l: &str) -> Option<BookItem> {
|
||||||
let mut name;
|
let mut name;
|
||||||
let mut path;
|
let mut path;
|
||||||
// Remove leading and trailing spaces or tabs
|
// Remove leading and trailing spaces or tabs
|
||||||
line.trim_matches(|c: char| { c == ' ' || c == '\t' });
|
let mut line = l.trim_matches(|c: char| { c == ' ' || c == '\t' });
|
||||||
|
|
||||||
if let Some(c) = line.chars().nth(0) {
|
if let Some(c) = line.chars().nth(0) {
|
||||||
match c {
|
match c {
|
||||||
|
|
Loading…
Reference in a new issue