diff options
Diffstat (limited to 'lib/docx/document-xml-reader.js')
| -rw-r--r-- | lib/docx/document-xml-reader.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/docx/document-xml-reader.js b/lib/docx/document-xml-reader.js index 97241a7..c41a29f 100644 --- a/lib/docx/document-xml-reader.js +++ b/lib/docx/document-xml-reader.js @@ -13,7 +13,7 @@ function DocumentXmlReader(options) { var docxFile = options.docxFile; var numbering = options.numbering; var styles = options.styles; - var rawFootnotes = options.footnotes || []; + var rawNotes = (options.footnotes || []).concat(options.endnotes || []); function convertXmlToDocument(documentXml) { @@ -21,24 +21,25 @@ function DocumentXmlReader(options) { var result = readXmlElements(body.children) .flatMap(function(children) { - return readFootnotes().map(function(footnotes) { - return new documents.Document(children, {footnotes: footnotes}); + return readNotes().map(function(notes) { + return new documents.Document(children, {notes: notes}); }); }); result.document = result.value; return result; } - function readFootnotes() { - return Result.combine(rawFootnotes.map(function(rawFootnote) { - return readXmlElements(rawFootnote.body).map(function(body) { - return new documents.Footnote({ - id: rawFootnote.id, + function readNotes() { + return Result.combine(rawNotes.map(function(rawNote) { + return readXmlElements(rawNote.body).map(function(body) { + return new documents.Note({ + noteType: rawNote.noteType, + id: rawNote.id, body: body }); }); - })).map(function(footnotes) { - return new documents.Footnotes(_.indexBy(footnotes, "id")); + })).map(function(notes) { + return new documents.Notes(notes, "key"); }); } |
