Fixed bug where spaces where not trimmed and only the first level was parsed correctly

This commit is contained in:
Mathieu David 2015-07-18 16:21:04 +02:00
parent 60e47d2e08
commit 35be20da8b

View file

@ -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 path;
// 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) {
match c {