diff --git a/src/changelog.rs b/src/changelog.rs index f1408c2..95fb322 100644 --- a/src/changelog.rs +++ b/src/changelog.rs @@ -11,6 +11,7 @@ pub struct Changelog { pub path: PathBuf, pub fixed: Vec, comments: Vec, + legacy_contents: Vec, pub releases: Vec, pub problems: Vec, } @@ -47,6 +48,10 @@ impl Changelog { } } + self.legacy_contents + .iter() + .for_each(|l| exported_string.push_str(format!("{}\n", l).as_str())); + exported_string } } @@ -76,6 +81,7 @@ pub fn parse_changelog(config: Config, file_path: &Path) -> Result = Vec::new(); let mut fixed: Vec = Vec::new(); + let mut legacy_contents: Vec = Vec::new(); let mut releases: Vec = Vec::new(); let mut problems: Vec = Vec::new(); @@ -92,9 +98,13 @@ pub fn parse_changelog(config: Config, file_path: &Path) -> Result")?; for line in contents.lines() { + if is_legacy { + legacy_contents.push(line.to_string()); + continue; + } + let trimmed_line = line.trim(); - // TODO: improve this? if enter_comment_regex.is_match(trimmed_line) && !exit_comment_regex.is_match(trimmed_line) { is_comment = true; @@ -133,7 +143,6 @@ pub fn parse_changelog(config: Config, file_path: &Path) -> Result Result