diff options
Diffstat (limited to 'lib/images.js')
| -rw-r--r-- | lib/images.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/images.js b/lib/images.js new file mode 100644 index 0000000..613a264 --- /dev/null +++ b/lib/images.js @@ -0,0 +1,14 @@ +var promises = require("./promises"); +var htmlPaths = require("./html-paths"); + +exports.inline = function(func) { + return function(element, html, messages, callback) { + return promises.when(func(element)).then(function(result) { + var attributes = {src: result.src}; + if (element.altText) { + attributes.alt = element.altText; + } + html.selfClosing(htmlPaths.element("img", attributes)); + }).then(callback, callback); + }; +}; |
