diff --git a/src/main.rs b/src/main.rs index de0f42c..54db8f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -204,7 +204,7 @@ impl QuestionsParser { self.last_keyword_type = self.cur_keyword_type; self.last_tag = self.cur_tag.clone(); self.cur_keyword_type = Some(keyword.parse().unwrap()); - self.cur_tag = keyword.replace(' ', "").replace(':', ""); + self.cur_tag = keyword.trim_end().trim_end_matches(':').to_string(); } /// if line matched keyword fn on_keyword_match(&mut self, line: &str, keyword: &str) { @@ -212,7 +212,7 @@ impl QuestionsParser { // remember question id if let Some(KeywordType::QuestionStart) = self.cur_keyword_type { - self.cur_question_pre["id"] = line.replace(':', "").into(); + self.cur_question_pre["id"] = line.trim_end().trim_end_matches(':').into(); }; self.apply_content_for_last_keyword();