Fix reader (#478)

* fix: numbering reader

* fix: test
main
bokuweb 2022-05-20 11:27:31 +09:00 committed by GitHub
parent cd214fdaf5
commit 79841fca0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14048 additions and 2 deletions

View File

@ -36,8 +36,9 @@ impl ElementReader for NumberingProperty {
let e = XMLElement::from_str(&name.local_name).unwrap();
if e == XMLElement::NumberingProperty {
if level.is_none() {
return Ok(NumberingProperty::new()
.id(NumberingId::new(id.expect("should id exists"))));
if let Some(id) = id {
return Ok(NumberingProperty::new().id(NumberingId::new(id)));
}
}
if let Some(id) = id {
let np = NumberingProperty::new()

File diff suppressed because it is too large Load Diff

View File

@ -136,6 +136,12 @@ describe("reader", () => {
const json = w.readDocx(buffer);
expect(json).toMatchSnapshot();
});
test("should read without num id", () => {
const buffer = readFileSync("../fixtures/without_numid/without_numid.docx");
const json = w.readDocx(buffer);
expect(json).toMatchSnapshot();
});
});
describe("writer", () => {

Binary file not shown.