aboutsummaryrefslogtreecommitdiff
path: root/lib/docx/footnotes-reader.js
blob: c7ec98cfd6779598fe3256c69466f7a0c8f6a910 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);
}

function readFootnoteElement(footnoteElement) {
    var body = footnoteElement.children;
    return {body: body};
}