mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
22 lines
730 B
JavaScript
22 lines
730 B
JavaScript
$rtmpl("simple", function (templating) {
|
|
var empty = templating.e,
|
|
notEmpty = templating.ne,
|
|
forEach = templating.f;
|
|
return function (data, context) {
|
|
var write = context.w,
|
|
rootClass = data.rootClass,
|
|
colors = data.colors,
|
|
message = data.message;
|
|
write('<div class="hello-world ', rootClass, '">', message, '</div>');
|
|
if (notEmpty(colors)) {
|
|
write('<ul>');
|
|
forEach(colors, function (color) {
|
|
write('<li class="color">', color, '</li>');
|
|
});
|
|
write('</ul>');
|
|
}
|
|
if (empty(colors)) {
|
|
write('<div>No colors!</div>');
|
|
}
|
|
}
|
|
}); |