Skip to content

Commit

Permalink
prepend new line before next lines only
Browse files Browse the repository at this point in the history
  • Loading branch information
yggverse committed Dec 2, 2024
1 parent dbe080a commit 7d6c049
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/line/code/multiline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
}

0 comments on commit 7d6c049

Please sign in to comment.