diff --git a/docx-core/src/documents/webextension.rs b/docx-core/src/documents/webextension.rs index 14f384c..19a3e28 100644 --- a/docx-core/src/documents/webextension.rs +++ b/docx-core/src/documents/webextension.rs @@ -45,8 +45,10 @@ impl WebExtension { } pub fn property(mut self, name: impl Into, value: impl Into) -> Self { + let v = value.into(); + let v = format!(""{}"", escape(&v).replace(""", "\\"")); self.properties - .push(WebExtensionProperty::new(name, escape(&value.into()))); + .push(WebExtensionProperty::new(name, &v)); self } } @@ -103,7 +105,7 @@ mod tests { - + diff --git a/docx-wasm/package.json b/docx-wasm/package.json index 25520a0..449feef 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,6 +1,6 @@ { "name": "docx-wasm", - "version": "0.0.200", + "version": "0.0.201", "main": "dist/node/index.js", "browser": "dist/web/index.js", "author": "bokuweb ", diff --git a/docx-wasm/test/__snapshots__/index.test.js.snap b/docx-wasm/test/__snapshots__/index.test.js.snap index ae2902a..a7cd457 100644 --- a/docx-wasm/test/__snapshots__/index.test.js.snap +++ b/docx-wasm/test/__snapshots__/index.test.js.snap @@ -17212,7 +17212,7 @@ exports[`writer should write webextension 7`] = ` - + diff --git a/docx-wasm/test/index.test.js b/docx-wasm/test/index.test.js index f2696b5..6e28d04 100644 --- a/docx-wasm/test/index.test.js +++ b/docx-wasm/test/index.test.js @@ -306,7 +306,7 @@ describe("writer", () => { "1.0.0.0", "developer", "Registry" - ).property("hello", '"world"') + ).property("hello", JSON.stringify({ hello: "world" })) ) .build(); writeFileSync("../output/webextension.docx", buffer);