diff --git a/src/main.rs b/src/main.rs index 7c990d1..50d60d7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -115,13 +115,13 @@ fn parse_file(file: impl io::Read) -> Result { use KeywordType::*; @@ -129,14 +129,11 @@ fn parse_file(file: impl io::Read) -> Result { - ctx.cur_question_pre["id"] = line_s.replace(":", "").as_str().into(); - } - _ => (), + if let Some(QuestionStart) = ctx.cur_keyword_type { + ctx.cur_question_pre["id"] = line_s.replace(':', "").as_str().into(); }; // apply accumulated content when new keyword found @@ -222,9 +219,6 @@ fn main() -> Result<(), Box> { let mut outfile = fs::File::create(outfilename)?; data.write_pretty(&mut outfile, 1)?; - //data.write(&mut outfile)?; - //debug - break; } Ok(()) }