blob: fb734e65a3a6c44a096d1ec6a2e3e5eab3015d0d (
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
28
29
30
|
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.mapThen(function(document) {
return documentConverter.convertToHtml(document);
});
}).then(function(result) {
result.html = result.value.html;
return result;
});
}
|