diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-01-07 21:40:46 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-01-07 21:40:46 +0000 |
| commit | 705973a152a3b3c9a03e40100529fa9559c925ce (patch) | |
| tree | 8f1383749f7cc58b30e27d2d7a3e5463d7923a26 /lib | |
| parent | d9d55dece1861bbbf08f3688254447992cf1957f (diff) | |
Pass a plain document into transformDocument
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/index.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/index.js b/lib/index.js index 1928424..db77d99 100644 --- a/lib/index.js +++ b/lib/index.js @@ -23,7 +23,8 @@ var standardOptions = { style("p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh"), style("p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh"), style("p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh") - ] + ], + transformDocument: identity }; function convertToHtml(input, options) { @@ -38,11 +39,7 @@ function convertToHtml(input, options) { return docxReader.read(input) .then(function(documentResult) { - if (fullOptions.transformDocument) { - return fullOptions.transformDocument(documentResult); - } else { - return documentResult; - } + return documentResult.map(fullOptions.transformDocument); }) .then(function(documentResult) { return convertDocumentToHtml(documentResult, fullOptions); @@ -55,3 +52,7 @@ function convertDocumentToHtml(documentResult, options) { return documentConverter.convertToHtml(document); }); } + +function identity(value) { + return value; +} |
