diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-07-05 19:54:15 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-07-05 19:54:15 +0100 |
| commit | 91a7928116c5157b451892e586b684744dbe4174 (patch) | |
| tree | e5018e9f5e3fd8933709f7deac606e8e3bb95d0c | |
| parent | db6bae062b7bc2e9bcda02a62dea2f438bd00d73 (diff) | |
Get table conversion working
| -rw-r--r-- | lib/docx/document-xml-reader.js | 7 | ||||
| -rw-r--r-- | tests/docx/document-xml-reader.tests.js | 2 | ||||
| -rw-r--r-- | tests/mammoth.tests.js | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/docx/document-xml-reader.js b/lib/docx/document-xml-reader.js index b2736f8..e38590b 100644 --- a/lib/docx/document-xml-reader.js +++ b/lib/docx/document-xml-reader.js @@ -153,7 +153,7 @@ function DocumentXmlReader(options) { } }); }, - "w:table": function(element) { + "w:tbl": function(element) { return readXmlElements(element.children).map(documents.Table); }, "w:tr": function(element) { @@ -216,7 +216,10 @@ var ignoreElements = { "w:commentRangeEnd": true, "w:commentReference": true, "w:del": true, - "w:footnoteRef": true + "w:footnoteRef": true, + "w:tblPr": true, + "w:tblGrid": true, + "w:tcPr": true }; function notNull(value) { diff --git a/tests/docx/document-xml-reader.tests.js b/tests/docx/document-xml-reader.tests.js index b3876da..0897336 100644 --- a/tests/docx/document-xml-reader.tests.js +++ b/tests/docx/document-xml-reader.tests.js @@ -156,7 +156,7 @@ describe("readXmlElement: ", function() { }); test("w:table is read as document table element", function() { - var tableXml = new XmlElement("w:table", {}, [ + var tableXml = new XmlElement("w:tbl", {}, [ new XmlElement("w:tr", {}, [ new XmlElement("w:tc", {}, [ new XmlElement("w:p", {}, []) diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index 35a19ff..cba59ea 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -89,8 +89,6 @@ describe('mammoth', function() { }); test('word tables are converted to html tables', function() { - // TODO: enable this test once tables are supported - return; var docxPath = path.join(__dirname, "test-data/tables.docx"); return mammoth.convertToHtml({path: docxPath}).then(function(result) { var expectedHtml = "<p>Above</p>" + |
