All new
alle new
This commit is contained in:
1 parent
da64472251
commit
5b20adee48
1605 files changed
+396517
-1674
No files matched your search
+28
@@ -0,0 +1,28 @@
|
||||
var documents = require("../documents");
|
||||
var Result = require("../results").Result;
|
||||
|
||||
exports.createFootnotesReader = createReader.bind(this, "footnote");
|
||||
exports.createEndnotesReader = createReader.bind(this, "endnote");
|
||||
|
||||
function createReader(noteType, bodyReader) {
|
||||
function readNotesXml(element) {
|
||||
return Result.combine(element.getElementsByTagName("w:" + noteType)
|
||||
.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"];
|
||||
return bodyReader.readXmlElements(footnoteElement.children)
|
||||
.map(function(body) {
|
||||
return documents.Note({noteType: noteType, noteId: id, body: body});
|
||||
});
|
||||
}
|
||||
|
||||
return readNotesXml;
|
||||
}
|
||||
Reference in new issue
Block a user