Support strike at Run level: add strike() to Run (#732)

main
git-noise 2024-06-29 06:24:01 -04:00 committed by GitHub
parent 87de45e198
commit 0284e7aa4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -268,6 +268,11 @@ impl Run {
self self
} }
pub fn strike(mut self) -> Run {
self.run_property = self.run_property.strike();
self
}
pub fn text_border(mut self, b: TextBorder) -> Run { pub fn text_border(mut self, b: TextBorder) -> Run {
self.run_property = self.run_property.text_border(b); self.run_property = self.run_property.text_border(b);
self self
@ -366,6 +371,15 @@ mod tests {
); );
} }
#[test]
fn test_strike() {
let b = Run::new().add_text("Hello").strike().build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:r><w:rPr><w:strike /></w:rPr><w:t xml:space="preserve">Hello</w:t></w:r>"#
);
}
#[test] #[test]
fn test_child_json() { fn test_child_json() {
let c = RunChild::Text(Text::new("Hello")); let c = RunChild::Text(Text::new("Hello"));