mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
42 lines
927 B
JavaScript
42 lines
927 B
JavaScript
module.exports = function create(__helpers) {
|
|
var empty = __helpers.e,
|
|
notEmpty = __helpers.ne,
|
|
hello_renderer = require("../hello-renderer"),
|
|
escapeXmlAttr = __helpers.xa,
|
|
escapeXml = __helpers.x,
|
|
forEach = __helpers.f;
|
|
|
|
return function render(data, context) {
|
|
var rootClass = data.rootClass,
|
|
colors = data.colors,
|
|
message = data.message;
|
|
|
|
__helpers.t(context,
|
|
hello_renderer,
|
|
{
|
|
"name": "World"
|
|
});
|
|
|
|
context.w('<div class="hello-world ' +
|
|
escapeXmlAttr(rootClass) +
|
|
'">' +
|
|
escapeXml(message) +
|
|
'</div>');
|
|
|
|
if (notEmpty(colors)) {
|
|
context.w('<ul>');
|
|
|
|
forEach(colors, function(color) {
|
|
context.w('<li class="color">' +
|
|
escapeXml(color) +
|
|
'</li>');
|
|
});
|
|
|
|
context.w('</ul>');
|
|
}
|
|
|
|
if (empty(colors)) {
|
|
context.w('<div>No colors!</div>');
|
|
}
|
|
};
|
|
} |