Support mustache partials in server-side templates

This is sufficient to make https://gerrit.wikimedia.org/r/#/c/223165/
work.  It hardcodes .mustache as the extension, but so does
existing getTemplateFilename().

Bug: T97188
Change-Id: Id588ae9b43b13fcf35ebd285c826dd502ac424ec
This commit is contained in:
S Page 2015-07-06 18:32:21 -07:00
parent 240f4c15d5
commit c235e0717e
4 changed files with 19 additions and 2 deletions

View file

@ -173,7 +173,9 @@ class TemplateParser {
array(
// Do not add more flags here without discussion.
// If you do add more flags, be sure to update unit tests as well.
'flags' => LightnCandy::FLAG_ERROR_EXCEPTION
'flags' => LightnCandy::FLAG_ERROR_EXCEPTION,
'basedir' => $this->templateDir,
'fileext' => '.mustache',
)
);
}

View file

@ -0,0 +1 @@
Partial {{>nonexistenttemplate}} in here

View file

@ -0,0 +1 @@
Partial {{>foobar_args}} in here

View file

@ -57,7 +57,20 @@ class TemplateParserTest extends MediaWikiTestCase {
array(),
false,
'RuntimeException',
)
),
array(
'has_partial',
array(
'planet' => 'world',
),
"Partial hello world!\n in here\n",
),
array(
'bad_partial',
array(),
false,
'Exception',
),
);
}
}