Preserve the leading whitespace before an escape.

This commit is contained in:
Tom Alexander
2023-10-04 13:23:57 -04:00
parent 7ee48ff65c
commit 169bf69f5e
3 changed files with 35 additions and 28 deletions

View File

@@ -45,7 +45,7 @@ pub struct ExampleBlock<'s> {
pub retain_labels: bool,
pub use_labels: bool,
pub label_format: Option<&'s str>,
pub contents: Vec<&'s str>,
pub contents: String,
}
#[derive(Debug)]
@@ -237,16 +237,3 @@ impl<'s> Comment<'s> {
ret
}
}
impl<'s> ExampleBlock<'s> {
/// Get the inner contents of the ExampleBlock with the escaping commas removed.
pub fn get_contents(&self) -> String {
let final_size = self.contents.iter().map(|line| line.len()).sum();
let mut ret = String::with_capacity(final_size);
for line in &self.contents {
ret.push_str(line);
}
ret
}
}