mammoth-style
Version:
Convert Word documents (.docx files) to HTML (with style)
20 lines (16 loc) • 587 B
JavaScript
var _ = require("underscore");
var promises = require("./promises");
var Html = require("./html");
exports.imgElement = function(func) {
return function(element, messages) {
return promises.when(func(element)).then(function(result) {
var attributes = _.clone(result);
if (element.altText) {
attributes.alt = element.altText;
}
return [Html.selfClosingElement("img", attributes)];
});
};
};
// Undocumented, but retained for backwards-compatibility with 0.3.x
exports.inline = exports.imgElement;