diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-07-03 19:43:00 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-07-03 19:43:00 +0100 |
| commit | ba731d3c8a9408b9d33deb63e0492b54298169c5 (patch) | |
| tree | aa7ab6403bdfd8d923c6b9e86eeccf006dcb09ca /lib/docx/comments-reader.js | |
| parent | d98f3862193c6bb9b88735c131531ac6b1f7b5c0 (diff) | |
Read author name and initials for each comment
Diffstat (limited to 'lib/docx/comments-reader.js')
| -rw-r--r-- | lib/docx/comments-reader.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/docx/comments-reader.js b/lib/docx/comments-reader.js index be98bac..41bf8f6 100644 --- a/lib/docx/comments-reader.js +++ b/lib/docx/comments-reader.js @@ -9,9 +9,19 @@ function createCommentsReader(bodyReader) { 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}); + return documents.comment({ + commentId: id, + body: body, + authorName: readOptionalAttribute("w:author"), + authorInitials: readOptionalAttribute("w:initials") + }); }); } |
