Skip to content
Permalink
Browse files

feature: Mustache supports Key/Value pairs

  • Loading branch information...
MikeMitterer committed Jul 11, 2018
1 parent dac5ecd commit 7e8b1ddb3438ad3a8ed5b6c2b7ba28c1fd29e06d
@@ -13,7 +13,7 @@ main() {

var template = new Template(source, name: 'template-filename.html');

var output = template.renderString({'names': [
final String output = template.renderString({'names': [
{'firstname': 'Greg', 'lastname': 'Lowe'},
{'firstname': 'Bob', 'lastname': 'Johnson'}
]});
@@ -3,7 +3,8 @@ import 'package:reflected_mustache/mustache.dart';
main() {
var t = new Template('{{ foo }}');
var lambda = (LambdaContext ctx) => 'bar';
var output = t.renderString({'foo': lambda}); // bar

String output = t.renderString({'foo': lambda}); // bar
print(output);

t = new Template('{{# foo }}hidden{{/ foo }}');
@@ -2,6 +2,6 @@ import 'package:reflected_mustache/mustache.dart';

main() {
var template = new Template('{{ author.name }}');
var output = template.renderString({'author': {'name': 'Greg Lowe'}});
final String output = template.renderString({'author': {'name': 'Greg Lowe'}});
print(output);
}
@@ -11,6 +11,6 @@ main() {

var t = new Template('{{> partial-name }}', partialResolver: resolver);

var output = t.renderString({'foo': 'bar'}); // bar
final String output = t.renderString({'foo': 'bar'}); // bar
print(output);
}
Oops, something went wrong.

0 comments on commit 7e8b1dd

Please sign in to comment.
You can’t perform that action at this time.