blob: 7529673642e6906ea48d3a8125e1f623144501c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
var _ = require("underscore");
var promises = require("./promises");
var Html = require("./html");
exports.imgElement = function(func) {
return function(element, messages, callback) {
return promises.when(func(element)).then(function(result) {
var attributes = _.clone(result);
if (element.altText) {
attributes.alt = element.altText;
}
return Html.selfClosingElement("img", attributes);
}).then(function(value) {
callback(null, value);
}, callback);
};
};
// Undocumented, but retained for backwards-compatibility with 0.3.x
exports.inline = exports.imgElement;
|