From 965bd9513da033b9804af8ec29c7fa609a84512c Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 19 Jan 2015 23:05:45 +0000 Subject: Add support for endnotes --- lib/docx/document-xml-reader.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'lib/docx/document-xml-reader.js') diff --git a/lib/docx/document-xml-reader.js b/lib/docx/document-xml-reader.js index c41a29f..2be726a 100644 --- a/lib/docx/document-xml-reader.js +++ b/lib/docx/document-xml-reader.js @@ -94,6 +94,16 @@ function DocumentXmlReader(options) { } } + function noteReferenceReader(noteType) { + return function(element) { + var noteId = element.attributes["w:id"]; + return new Result(new documents.NoteReference({ + noteType: noteType, + noteId: noteId + })); + }; + } + function readChildElements(element) { return readXmlElements(element.children); } @@ -175,12 +185,8 @@ function DocumentXmlReader(options) { "w:tc": function(element) { return readXmlElements(element.children).map(documents.TableCell); }, - "w:footnoteReference": function(element) { - var footnoteId = element.attributes["w:id"]; - return new Result(new documents.FootnoteReference({ - footnoteId: footnoteId - })); - }, + "w:footnoteReference": noteReferenceReader("footnote"), + "w:endnoteReference": noteReferenceReader("endnote"), "w:br": function(element) { var breakType = element.attributes["w:type"]; if (breakType) { -- cgit v1.2.3