fix: bold and italic (#47)
parent
0697404b40
commit
aa549bd5cf
|
@ -31,8 +31,26 @@ impl ElementReader for Run {
|
||||||
}) => {
|
}) => {
|
||||||
let e = XMLElement::from_str(&name.local_name).unwrap();
|
let e = XMLElement::from_str(&name.local_name).unwrap();
|
||||||
match e {
|
match e {
|
||||||
XMLElement::Tab => run = run.add_tab(),
|
XMLElement::Tab => {
|
||||||
XMLElement::Bold => run = run.bold(),
|
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::Highlight => run = run.highlight(attributes[0].value.clone()),
|
||||||
XMLElement::Color => run = run.color(attributes[0].value.clone()),
|
XMLElement::Color => run = run.color(attributes[0].value.clone()),
|
||||||
XMLElement::Size => run = run.size(usize::from_str(&attributes[0].value)?),
|
XMLElement::Size => run = run.size(usize::from_str(&attributes[0].value)?),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docx-wasm",
|
"name": "docx-wasm",
|
||||||
"version": "0.0.40",
|
"version": "0.0.41",
|
||||||
"main": "dist/node/index.js",
|
"main": "dist/node/index.js",
|
||||||
"browser": "dist/web/index.js",
|
"browser": "dist/web/index.js",
|
||||||
"author": "bokuweb <bokuweb12@gmail.com>",
|
"author": "bokuweb <bokuweb12@gmail.com>",
|
||||||
|
|
Loading…
Reference in New Issue