diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-06-10 16:23:15 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-06-10 16:23:15 +0100 |
| commit | 8aec6e713d08a532194b50591fa338ecb9a251f9 (patch) | |
| tree | 00004b0324527dac50add38cdf6ac39cec604227 /lib/docx/footnotes-reader.js | |
| parent | ee2fc5da880df5f9ea8cdaebc506d130c3009ce3 (diff) | |
Basic support for footnotes
Diffstat (limited to 'lib/docx/footnotes-reader.js')
| -rw-r--r-- | lib/docx/footnotes-reader.js | 12 |
1 files changed, 3 insertions, 9 deletions
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}; } |
