parent
0740dac833
commit
6c9b7a1c38
|
@ -45,8 +45,10 @@ impl WebExtension {
|
|||
}
|
||||
|
||||
pub fn property(mut self, name: impl Into<String>, value: impl Into<String>) -> 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 {
|
|||
<we:reference id="7f33b723-fb58-4524-8733-dbedc4b7c095" version="1.0.0.0" store="developer" storeType="Registry" />
|
||||
<we:alternateReferences />
|
||||
<we:properties>
|
||||
<we:property name="hello" value="world" />
|
||||
<we:property name="hello" value=""world"" />
|
||||
</we:properties>
|
||||
<we:bindings />
|
||||
<we:snapshot xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" />
|
||||
|
|
|
@ -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 <bokuweb12@gmail.com>",
|
||||
|
|
|
@ -17212,7 +17212,7 @@ exports[`writer should write webextension 7`] = `
|
|||
<we:reference id=\\"7f33b723-fb58-4524-8733-dbedc4b7c095\\" version=\\"1.0.0.0\\" store=\\"developer\\" storeType=\\"Registry\\" />
|
||||
<we:alternateReferences />
|
||||
<we:properties>
|
||||
<we:property name=\\"hello\\" value=\\""world"\\" />
|
||||
<we:property name=\\"hello\\" value=\\""{\\\\"hello\\\\":\\\\"world\\\\"}"\\" />
|
||||
</we:properties>
|
||||
<we:bindings />
|
||||
<we:snapshot xmlns:r=\\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\\" />
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue