Fixed insufficient indentation.

This commit is contained in:
Michael Bayne
2014-01-08 11:01:56 -08:00
parent 12a4b77107
commit e80aab2a67
+11 -11
View File
@@ -246,17 +246,17 @@ User-defined object formatting
By default, JMustache uses `String.valueOf` to convert objects to strings when rendering a By default, JMustache uses `String.valueOf` to convert objects to strings when rendering a
template. You can customize this formatting by implementing the `Mustache.Formatter` interface: template. You can customize this formatting by implementing the `Mustache.Formatter` interface:
Mustache.compiler().withFormatter(new Mustache.Formatter() { Mustache.compiler().withFormatter(new Mustache.Formatter() {
public String format (Object value) { public String format (Object value) {
if (value instanceof Date) return _fmt.format((Date)value); if (value instanceof Date) return _fmt.format((Date)value);
else return String.valueOf(value); else return String.valueOf(value);
} }
protected DateFormat _fmt = new SimpleDateFormat("yyyy/MM/dd"); protected DateFormat _fmt = new SimpleDateFormat("yyyy/MM/dd");
}).compile("{{msg}}: {{today}}").execute(new Object() { }).compile("{{msg}}: {{today}}").execute(new Object() {
String msg = Date: "; String msg = Date: ";
Date today = new Date(); Date today = new Date();
}) })
// result: Date: 2013/01/08 // result: Date: 2013/01/08
User-defined escaping rules User-defined escaping rules
--------------------------- ---------------------------