fix new lines skip condition

This commit is contained in:
yggverse 2025-02-15 21:07:01 +02:00
parent e1cb4f9b99
commit f3dc550c2e

View file

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