From 8aec6e713d08a532194b50591fa338ecb9a251f9 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 10 Jun 2014 16:23:15 +0100 Subject: Basic support for footnotes --- lib/docx/footnotes-reader.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'lib/docx/footnotes-reader.js') diff --git a/lib/docx/footnotes-reader.js b/lib/docx/footnotes-reader.js index c7ec98c..a653b8a 100644 --- a/lib/docx/footnotes-reader.js +++ b/lib/docx/footnotes-reader.js @@ -3,17 +3,11 @@ exports.readFootnotesXml = readFootnotesXml; var Footnotes = require("../documents").Footnotes; function readFootnotesXml(xml) { - var footnotes = {}; - - xml.root.getElementsByTagName("w:footnote").forEach(function(footnoteElement) { - var id = footnoteElement.attributes["w:id"]; - footnotes[id] = readFootnoteElement(footnoteElement); - }); - - return new Footnotes(footnotes); + return xml.root.getElementsByTagName("w:footnote").map(readFootnoteElement); } function readFootnoteElement(footnoteElement) { + var id = footnoteElement.attributes["w:id"]; var body = footnoteElement.children; - return {body: body}; + return {id: id, body: body}; } -- cgit v1.2.3