fix: tl2br (#258)

* fix: tl2br

* update

* fix: type

* add mock

* update
main
bokuweb 2021-03-22 23:30:58 +09:00 committed by GitHub
parent 6f6a399597
commit 147bebfa7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1010 additions and 2 deletions

View File

@ -246,6 +246,8 @@ impl FromStr for XMLElement {
"bottom" => Ok(XMLElement::Bottom), "bottom" => Ok(XMLElement::Bottom),
"insideH" => Ok(XMLElement::InsideH), "insideH" => Ok(XMLElement::InsideH),
"insideV" => Ok(XMLElement::InsideV), "insideV" => Ok(XMLElement::InsideV),
"tl2br" => Ok(XMLElement::Tl2br),
"tr2bl" => Ok(XMLElement::Tr2bl),
"tblCellMar" => Ok(XMLElement::TableCellMargin), "tblCellMar" => Ok(XMLElement::TableCellMargin),
"tblGrid" => Ok(XMLElement::TableGrid), "tblGrid" => Ok(XMLElement::TableGrid),
"tblPrChange" => Ok(XMLElement::TablePropertyChange), "tblPrChange" => Ok(XMLElement::TablePropertyChange),

View File

@ -20,7 +20,7 @@ export type RunPropertyJSON = {
italicCs: boolean | null; italicCs: boolean | null;
vanish: boolean | null; vanish: boolean | null;
spacing: number | null; spacing: number | null;
TextBorder: TextBorderJSON | null; textBorder: TextBorderJSON | null;
}; };
export type RunChildJSON = export type RunChildJSON =

View File

@ -1,6 +1,6 @@
{ {
"name": "docx-wasm", "name": "docx-wasm",
"version": "0.0.171", "version": "0.0.173",
"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>",

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,13 @@ describe("reader", () => {
expect(json).toMatchSnapshot(); expect(json).toMatchSnapshot();
}); });
test("should read tr2bl docx", () => {
const buffer = readFileSync("../fixtures/tr2bl/tr2bl.docx");
const json = w.readDocx(buffer);
writeFileSync("../output/tr2bl.json", JSON.stringify(json, null, 2));
expect(json).toMatchSnapshot();
});
test("should read table style docx", () => { test("should read table style docx", () => {
const buffer = readFileSync("../fixtures/table_style/table_style.docx"); const buffer = readFileSync("../fixtures/table_style/table_style.docx");
const json = w.readDocx(buffer); const json = w.readDocx(buffer);

Binary file not shown.