mirror of
https://github.com/YGGverse/ggemtext.git
synced 2026-03-31 17:15:33 +00:00
prepend new line before next lines only
This commit is contained in:
parent
dbe080a4f1
commit
7d6c049870
1 changed files with 7 additions and 4 deletions
|
|
@ -38,16 +38,19 @@ 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(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue