TemplateParser: Pass FLAG_MUSTACHELOOKUP to enable parent context access
authorRoan Kattouw <roan.kattouw@gmail.com>
Fri, 31 Aug 2018 03:18:44 +0000 (20:18 -0700)
committerRoan Kattouw <roan.kattouw@gmail.com>
Tue, 4 Sep 2018 19:39:34 +0000 (12:39 -0700)
commit3c06d76521a85c0da35b836e3510d316414b7028
treeaf9a929a62a1143fc1e4ac3f2c3ade81952356ed
parent486905a17f33e02484897c84c3084529f9e87472
TemplateParser: Pass FLAG_MUSTACHELOOKUP to enable parent context access

This allows variables defined in an outer context to be used in inner
contexts. For example:

<h2>{{foo}}</h2>
<ul>
{{#things}}
    <!-- bar is a property of each thing, foo is an outer variable -->
    <li>{{foo}} is a {{bar}}</li>
{{/things}}
</ul>

Bug: T203209
Change-Id: Ib0ae0fb0b4be6b161f548c79db6fb6f4b831f7c1
includes/TemplateParser.php
tests/phpunit/data/templates/parentvars.mustache [new file with mode: 0644]
tests/phpunit/includes/TemplateParserTest.php