diff --git a/CHANGELOG.md b/CHANGELOG.md index d08e1dd..bc406f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## docx-wasm@0.0.278-rc23 (21. Aug, 2023) + +- escape author in del/ins. + ## docx-wasm@0.0.278-rc19 (9. Aug, 2023) - use i32 for line instead of u32. diff --git a/docx-core/src/documents/elements/paragraph_property_change.rs b/docx-core/src/documents/elements/paragraph_property_change.rs index 4763c75..a3221b3 100644 --- a/docx-core/src/documents/elements/paragraph_property_change.rs +++ b/docx-core/src/documents/elements/paragraph_property_change.rs @@ -1,6 +1,7 @@ use serde::Serialize; use crate::documents::*; +use crate::escape; use crate::xml_builder::*; #[derive(Serialize, Debug, Clone, PartialEq)] @@ -34,7 +35,7 @@ impl ParagraphPropertyChange { } pub fn author(mut self, author: impl Into) -> ParagraphPropertyChange { - self.author = author.into(); + self.author = escape::escape(&author.into()); self } diff --git a/docx-core/src/documents/elements/table_of_contents.rs b/docx-core/src/documents/elements/table_of_contents.rs index 49b66de..fcbb184 100644 --- a/docx-core/src/documents/elements/table_of_contents.rs +++ b/docx-core/src/documents/elements/table_of_contents.rs @@ -1,9 +1,9 @@ use serde::ser::{SerializeStruct, Serializer}; use serde::Serialize; -use crate::documents::*; use crate::types::*; use crate::xml_builder::*; +use crate::{documents::*, escape}; #[derive(Debug, Clone, PartialEq)] pub enum TocContent { @@ -97,7 +97,7 @@ impl TableOfContents { pub fn delete(mut self, author: impl Into, date: impl Into) -> Self { self.delete = Some(TableOfContentsReviewData { - author: author.into(), + author: escape::escape(&author.into()), date: date.into(), }); self diff --git a/docx-wasm/package.json b/docx-wasm/package.json index c17266e..76ab43a 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,6 +1,6 @@ { "name": "docx-wasm", - "version": "0.0.278-rc20", + "version": "0.0.278-rc23", "main": "dist/node/index.js", "browser": "dist/web/index.js", "author": "bokuweb ", diff --git a/docx-wasm/src/delete.rs b/docx-wasm/src/delete.rs index d22338a..ff0e09a 100644 --- a/docx-wasm/src/delete.rs +++ b/docx-wasm/src/delete.rs @@ -19,12 +19,12 @@ impl Delete { #[wasm_bindgen] impl Delete { pub fn author(mut self, author: String) -> Delete { - self.0.author = author; + self.0 = self.0.author(author); self } pub fn date(mut self, date: String) -> Delete { - self.0.date = date; + self.0 = self.0.date(date); self } } diff --git a/docx-wasm/src/insert.rs b/docx-wasm/src/insert.rs index ec91823..8718fd3 100644 --- a/docx-wasm/src/insert.rs +++ b/docx-wasm/src/insert.rs @@ -19,12 +19,12 @@ impl Insert { #[wasm_bindgen] impl Insert { pub fn author(mut self, author: String) -> Insert { - self.0.author = author; + self.0 = self.0.author(author); self } pub fn date(mut self, date: String) -> Insert { - self.0.date = date; + self.0 = self.0.date(date); self } }