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

Unified Diff: pkg/mustache/lib/mustache.dart

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/lib/char_reader.dart ('k') | pkg/mustache/lib/scanner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/mustache/lib/mustache.dart
diff --git a/pkg/mustache/lib/mustache.dart b/pkg/mustache/lib/mustache.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ff98e45356aacca78b793593a9f7e43e917604ae
--- /dev/null
+++ b/pkg/mustache/lib/mustache.dart
@@ -0,0 +1,45 @@
+library mustache;
+
+import 'dart:mirrors';
+
+part 'char_reader.dart';
+part 'scanner.dart';
+part 'template.dart';
+
+/// [Mustache template documentation](http://mustache.github.com/mustache.5.html)
+
+/// Returns a [Template] which can be used to render the mustache template
+/// with substituted values.
+/// Tag names may only contain characters a-z, A-Z, 0-9, underscore, and minus,
+/// unless lenient mode is specified.
+/// Throws [FormatException] if the syntax of the source is invalid.
+Template parse(String source,
+ {bool lenient : false}) => _parse(source, lenient: lenient);
+
+/// A Template can be rendered multiple times with different values.
+abstract class Template {
+ /// [values] can be a combination of Map, List, String. Any non-String object
+ /// will be converted using toString(). Null values will cause a
+ /// FormatException, unless lenient module is enabled.
+ String renderString(values, {bool lenient : false, bool htmlEscapeValues : true});
+
+ /// [values] can be a combination of Map, List, String. Any non-String object
+ /// will be converted using toString(). Null values will cause a
+ /// FormatException, unless lenient module is enabled.
+ void render(values, StringSink sink, {bool lenient : false, bool htmlEscapeValues : true});
+}
+
+/// MustacheFormatException is used to obtain the line and column numbers
+/// of the token which caused parse or render to fail.
+class MustacheFormatException implements FormatException {
+ final String message;
+
+ /// The 1-based line number of the token where formatting error was found.
+ final int line;
+
+ /// The 1-based column number of the token where formatting error was found.
+ final int column;
+
+ MustacheFormatException(this.message, this.line, this.column);
+ String toString() => message;
+}
« no previous file with comments | « pkg/mustache/lib/char_reader.dart ('k') | pkg/mustache/lib/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698