diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-06-10 15:46:32 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-06-10 15:46:32 +0100 |
| commit | ee2fc5da880df5f9ea8cdaebc506d130c3009ce3 (patch) | |
| tree | a8e42446189b8504e09b2b02f51d31d970668e2f | |
| parent | 296ac78496e4d94dafd1a4f6f872a1283b796318 (diff) | |
Read footnote references
| -rw-r--r-- | lib/docx/document-xml-reader.js | 9 | ||||
| -rw-r--r-- | tests/mammoth.tests.js | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/docx/document-xml-reader.js b/lib/docx/document-xml-reader.js index 462cd61..348bccf 100644 --- a/lib/docx/document-xml-reader.js +++ b/lib/docx/document-xml-reader.js @@ -14,6 +14,7 @@ function DocumentXmlReader(options) { var docxFile = options.docxFile; var numbering = options.numbering; var styles = options.styles; + var footnotes = options.footnotes; function convertXmlToDocument(documentXml) { @@ -21,7 +22,7 @@ function DocumentXmlReader(options) { var result = readXmlElements(body.children) .map(function(children) { - return new documents.Document(children); + return new documents.Document(children, footnotes); }); result.document = result.value; return result; @@ -137,6 +138,12 @@ function DocumentXmlReader(options) { } }); }, + "w:footnoteReference": function(element) { + var footnoteId = element.attributes["w:id"]; + return new Result(new documents.FootnoteReference({ + footnoteId: footnoteId + })); + }, "w:ins": readChildElements, "w:smartTag": readChildElements, diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index dd0f5b7..0762bcc 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -100,6 +100,7 @@ describe('mammoth', function() { '<ol><li id="footnote-1"><p> A tachyon walks into a bar.</p></li>' + '<li id="footnote-2"><p> Fin.</p></li></ol>' assert.equal(result.value, expectedOutput); + assert.deepEqual(result.messages, []); }); }); |
