summaryrefslogtreecommitdiff
path: root/lib/docx/footnotes-reader.js
blob: aea623a21d7cfeee39ba8cc607da98b21f1e9b32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
exports.readFootnotesXml = readFootnotesXml;

function readFootnotesXml(xml) {
    return xml.root.getElementsByTagName("w:footnote")
        .filter(isFootnoteElement)
        .map(readFootnoteElement);
}

function isFootnoteElement(element) {
    var type = element.attributes["w:type"];
    return type !== "continuationSeparator" && type !== "separator";
}

function readFootnoteElement(footnoteElement) {
    var id = footnoteElement.attributes["w:id"];
    var body = footnoteElement.children;
    return {id: id, body: body};
}