That's what collectors are for. This also avoids the needless expense of doing
Integer.parseInt on every single key (the vast majority of which will not
actually be numbers), every single time we do a context lookup.
Fixes#39.
This fixes a bug where falsey values were not properly triggering inverted
sections, and consolidates some logic.
Also did some renaming. Couldn't help myself.
In javascript implementation, zero is a falsy value and is treated as a false boolean.
An option is added (false by default) to treat zero as a falsy value as in javascript implementation.
It means that section like:
{{#zeroValue}}foo{{/zeroValue}}
will not be rendered.
The groups with failing tests are currently commented out (everything except
interpolation). The main reason for failures are due to the requirement that
standalone lines that contain nothing but whitespace be stripped from the
output.
- triple-stache mode reverted to only work with {{{ }}} rather than working
with whatever default delims you set; I think this is more in the spirit of
the Mustache spec
- Compiler.withDelims takes a delims string rather than the internal Delims
class which callers don't care about or have access to
- nixed Delims constructors, made updateDelims fluent
- nixed DelimsTest, it wasn't testing anything that wasn't also already tested
by the functional tests in MustacheTest
Solving need to distinguish context errors from environment errors.
The exception has fields for the offending key and line number. This
is a first step towards internationalization of messages.
If Compliler.nullValue contains a substring "{{name}}", then this substring
will be replaced with the name of variable.
For example, if nullValue="?{{name}}?" and variable is resolved to null,
then string "?foo?" will be used.
GWT doesn't provide Collections.synchronizedMap so we can't default to that.
Because we don't want someone to extend BasicCollector on a multi-threaded
platform and get an unsynchronized HashMap, which would cause things to fail,
we instead make creatFetcherCache abstract and document that if you extend
BasicCollector, you need to return a synchronized map (if the platform you're
targeting is multithreaded).
The ' entity is an XML entity, rather than an HTML entity, and is not
supported by Internet Explorer. The numeric form is supported in both XML
and HTML.