Modified compound variables to honor null/default configuration. Closes #10.

Kali/Bertrand convinced me that being consistent with other Mustache
implementations is more important than whatever wacky reasons I was harboring
for keeping compound variables different than singleton sections.
This commit is contained in:
Michael Bayne
2011-10-29 14:38:56 -07:00
parent 37884af44d
commit adf116992c
4 changed files with 40 additions and 44 deletions
@@ -85,9 +85,7 @@ public class Mustache
/** Returns a compiler that will use the given value for any variable that is missing, or
* otherwise resolves to null. This is like {@link #nullValue} except that it returns the
* supplied default for missing keys and existing keys that return null values. Note that
* regardless of whether a null or default value is configured, if the resolution of part
* of a compound key results in a missing or null value, an exception will be raised. */
* supplied default for missing keys and existing keys that return null values. */
public Compiler defaultValue (String defaultValue) {
return new Compiler(this.escapeHTML, this.standardsMode, defaultValue, true,
this.loader, this.collector);
@@ -103,10 +101,7 @@ public class Mustache
* <li>In the case of a {@link Map} being used as a context, all possible accessors are
* assumed to exist (but potentially return null), and no exception will ever be
* raised.</li>
* </ul>
* Note that regardless of whether a null or default value is configured, if the resolution
* of part of a compound key results in a missing or null value, an exception will be
* raised. */
* </ul> */
public Compiler nullValue (String nullValue) {
return new Compiler(this.escapeHTML, this.standardsMode, nullValue, false,
this.loader, this.collector);