Fix lenient handling of partials resolution
diff --git a/lib/mustache.dart b/lib/mustache.dart
index 163f0bc..2475c68 100644
--- a/lib/mustache.dart
+++ b/lib/mustache.dart
@@ -76,7 +76,7 @@
factory TemplateRenderer(
PartialResolver partialResolver,
- {bool lenient,
+ {bool lenient, // FIXME not sure if this lenient works right with the partial resolver, needs to be set twice?
bool htmlEscapeValues}) = _TemplateRenderer;
String renderString(String templateName, values);
diff --git a/lib/template.dart b/lib/template.dart
index c41f857..aa8a7a8 100644
--- a/lib/template.dart
+++ b/lib/template.dart
@@ -288,8 +288,16 @@
_renderPartial(_Node node) {
var partialName = node.value;
_Template template = _partialResolver(partialName);
- var renderer = new _Renderer.partial(this, template);
- renderer.render();
+ if (template != null) {
+ var renderer = new _Renderer.partial(this, template);
+ renderer.render();
+ } else if (_lenient) {
+ // do nothing
+ } else {
+ throw new MustacheFormatException(
+ 'Partial not found: $partialName',
+ _templateName, node.line, node.column);
+ }
}
static const Map<String,String> _htmlEscapeMap = const {