diff options
| author | Michael Williamson <mike@zwobble.org> | 2018-01-26 23:43:06 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2018-01-26 23:43:06 +0000 |
| commit | fd9bfbf28e045362c83620dd888c5edbb6f39a89 (patch) | |
| tree | afa51bb64e3b62888cb791f455cccb0a886ae850 /lib/docx/docx-reader.js | |
| parent | 8b9ca6ca68fec89926cfb02a96506bbee54a5b2c (diff) | |
Find parts related to main document using main document relationships
Diffstat (limited to 'lib/docx/docx-reader.js')
| -rw-r--r-- | lib/docx/docx-reader.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/docx/docx-reader.js b/lib/docx/docx-reader.js index e6dd798..e0d4a13 100644 --- a/lib/docx/docx-reader.js +++ b/lib/docx/docx-reader.js @@ -100,26 +100,23 @@ function findPartPaths(docxFile) { readElement: relationshipsReader.readRelationships, defaultValue: relationshipsReader.defaultValue })(docxFile).then(function(documentRelationships) { - function findPartRelatedToMainDocument(options) { + function findPartRelatedToMainDocument(name) { return findPartPath({ docxFile: docxFile, relationships: documentRelationships, - relationshipType: options.relationshipType, + relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" + name, basePath: zipfile.splitPath(mainDocumentPath).dirname, - fallbackPath: options.fallbackPath + fallbackPath: "word/" + name + ".xml" }); } return { mainDocument: mainDocumentPath, - comments: findPartRelatedToMainDocument({ - relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", - fallbackPath: "word/comments.xml" - }), - endnotes: "word/endnotes.xml", - footnotes: "word/footnotes.xml", - numbering: "word/numbering.xml", - styles: "word/styles.xml" + comments: findPartRelatedToMainDocument("comments"), + endnotes: findPartRelatedToMainDocument("endnotes"), + footnotes: findPartRelatedToMainDocument("footnotes"), + numbering: findPartRelatedToMainDocument("numbering"), + styles: findPartRelatedToMainDocument("styles") }; }); }); |
