You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
976 B

var documents = require("../documents");
var Result = require("../results").Result;
function createCommentsReader(bodyReader) {
function readCommentsXml(element) {
return Result.combine(element.getElementsByTagName("w:comment")
.map(readCommentElement));
}
function readCommentElement(element) {
var id = element.attributes["w:id"];
function readOptionalAttribute(name) {
return (element.attributes[name] || "").trim() || null;
}
return bodyReader.readXmlElements(element.children)
.map(function(body) {
return documents.comment({
commentId: id,
body: body,
authorName: readOptionalAttribute("w:author"),
authorInitials: readOptionalAttribute("w:initials")
});
});
}
return readCommentsXml;
}
exports.createCommentsReader = createCommentsReader;