prepend new line before next lines only

This commit is contained in:
yggverse 2024-12-02 20:44:44 +02:00
parent dbe080a4f1
commit 7d6c049870

View file

@ -38,16 +38,19 @@ impl Multiline {
return Err(Error::Completed);
}
// Append to value, trim close tag on exists
self.value.push_str(line.trim_end_matches(TAG));
// Line contain close tag
if line.ends_with(TAG) {
self.completed = true;
} else {
}
// Prepend new line before next lines only
if !self.value.is_empty() {
self.value.push(NEW_LINE);
}
// Append to value, trim close tag on exists
self.value.push_str(line.trim_end_matches(TAG));
Ok(())
}
}