diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-07-03 22:31:29 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-07-03 22:31:29 +0100 |
| commit | 27f3d32cabc5fae5b163ddf5a5449d93ebd959d5 (patch) | |
| tree | 373e830e2c15ad5252000c06aba70e4b144127d4 /lib/docx/document-xml-reader.js | |
| parent | cd3b84e15ea1a47ff8ebcca18d68ef0cdccf20b8 (diff) | |
Read note bodies immediately using relationships
Diffstat (limited to 'lib/docx/document-xml-reader.js')
| -rw-r--r-- | lib/docx/document-xml-reader.js | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/lib/docx/document-xml-reader.js b/lib/docx/document-xml-reader.js index fdf451f..c241c70 100644 --- a/lib/docx/document-xml-reader.js +++ b/lib/docx/document-xml-reader.js @@ -6,35 +6,17 @@ var Result = require("../results").Result; function DocumentXmlReader(options) { var bodyReader = options.bodyReader; - var rawNotes = (options.footnotes || []).concat(options.endnotes || []); - function convertXmlToDocument(documentXml) { var body = documentXml.root.first("w:body"); var result = bodyReader.readXmlElements(body.children) - .flatMap(function(children) { - return readNotes().map(function(notes) { - return new documents.Document(children, {notes: notes}); - }); + .map(function(children) { + return new documents.Document(children, {notes: options.notes}); }); return new Result(result.value, result.messages); } - function readNotes() { - return Result.combine(rawNotes.map(function(rawNote) { - return bodyReader.readXmlElements(rawNote.body).map(function(body) { - return new documents.Note({ - noteType: rawNote.noteType, - noteId: rawNote.id, - body: body - }); - }); - })).map(function(notes) { - return new documents.Notes(notes); - }); - } - return { convertXmlToDocument: convertXmlToDocument }; |
