fix: bold and italic (#47)

main
bokuweb 2020-02-28 13:50:12 +09:00 committed by GitHub
parent 0697404b40
commit aa549bd5cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

@ -31,8 +31,26 @@ impl ElementReader for Run {
}) => {
let e = XMLElement::from_str(&name.local_name).unwrap();
match e {
XMLElement::Tab => run = run.add_tab(),
XMLElement::Bold => run = run.bold(),
XMLElement::Tab => {
run = {
if let Some(v) = &attributes.get(0) {
if &v.value == "0" {
continue;
}
}
run.add_tab()
}
}
XMLElement::Bold => {
run = {
if let Some(v) = &attributes.get(0) {
if &v.value == "0" {
continue;
}
}
run.bold()
}
}
XMLElement::Highlight => run = run.highlight(attributes[0].value.clone()),
XMLElement::Color => run = run.color(attributes[0].value.clone()),
XMLElement::Size => run = run.size(usize::from_str(&attributes[0].value)?),

View File

@ -1,6 +1,6 @@
{
"name": "docx-wasm",
"version": "0.0.40",
"version": "0.0.41",
"main": "dist/node/index.js",
"browser": "dist/web/index.js",
"author": "bokuweb <bokuweb12@gmail.com>",