blob: 2a772bbee84a28a23b541c51789c2a07b636b42f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
var docxReader = require("./docx-reader");
var DocumentConverter = require("./document-to-html").DocumentConverter;
var htmlPaths = require("./html-paths");
exports.Converter = Converter;
exports.standardOptions = {
paragraphStyleMap: {
"Heading1": htmlPaths.topLevelElement("h1"),
"Heading2": htmlPaths.topLevelElement("h2"),
"Heading3": htmlPaths.topLevelElement("h3"),
"Heading4": htmlPaths.topLevelElement("h4")
}
};
function Converter(options) {
this._documentConverter = new DocumentConverter(options);
}
Converter.prototype.convertToHtml = function(inputOptions) {
var documentConverter = this._documentConverter;
return docxReader.read(inputOptions)
.then(function(documentResult) {
return documentResult.flatMapThen(function(document) {
return documentConverter.convertToHtml(document);
});
});
}
|