Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: pkg/mustache/README.md

Issue 804973002: Add appengine/gcloud/mustache dependencies. (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Added AUTHORS/LICENSE/PATENTS files Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/mustache/LICENSE ('k') | pkg/mustache/check.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/mustache/README.md
diff --git a/pkg/mustache/README.md b/pkg/mustache/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..d47c066a1dee12e54cac554ccf7e4ef4f48b9db5
--- /dev/null
+++ b/pkg/mustache/README.md
@@ -0,0 +1,63 @@
+# Mustache templates
+
+A Dart library to parse and render [mustache templates](http://mustache.github.com/mustache.5.html).
+
+[![Build Status](https://drone.io/github.com/xxgreg/mustache/status.png)](https://drone.io/github.com/xxgreg/mustache/latest)
+
+## Example
+```dart
+ import 'package:mustache/mustache.dart' as mustache;
+
+ main() {
+ var source = '{{#names}}<div>{{lastname}}, {{firstname}}</div>{{/names}}';
+ var template = mustache.parse(source);
+ var output = template.renderString({'names': [
+ {'firstname': 'Greg', 'lastname': 'Lowe'},
+ {'firstname': 'Bob', 'lastname': 'Johnson'}
+ ]});
+ print(output);
+ }
+```
+
+## API
+
+```dart
+
+Template parse(String source, {bool lenient : false});
+
+abstract class Template {
+ String renderString(values, {bool lenient : false, bool htmlEscapeValues : true});
+ void render(values, StringSink sink, {bool lenient : false, bool htmlEscapeValues : true});
+}
+
+```
+
+Once a template has been created it can be rendered any number of times.
+
+Both parse and render throw a FormatException if there is a problem with the template or rendering the values.
+
+When lenient mode is enabled tag names may use any characters, otherwise only a-z, A-Z, 0-9, underscore and minus. Lenient mode will also silently ignore nulls passed as values.
+
+By default all variables are html escaped, this behaviour can be changed by passing htmlEscapeValues : false.
+
+
+## Supported
+```
+ Variables {{var-name}}
+ Sections {{#section}}Blah{{/section}}
+ Inverse sections {{^section}}Blah{{/section}}
+ Comments {{! Not output. }}
+ Unescaped variables {{{var-name}}} and {{&var-name}}
+```
+See the [mustache templates tutorial](http://mustache.github.com/mustache.5.html) for more information.
+
+Passing all [mustache specification](https://github.com/mustache/spec/tree/master/specs) tests for interpolation, sections, inverted, comments. The following sections are not implemented: partials, lambdas and delimeters.
+
+## To do
+```
+Lenient nulls in inverse sections - see commented out test.
+Partial tags {{>partial}}
+Allow functions as values (Lambdas)
+Set Delimiter tags
+```
+
« no previous file with comments | « pkg/mustache/LICENSE ('k') | pkg/mustache/check.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698