mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/template-engine] Allow leading underscores in variable names.
Subsilver uses ._file in overall_header. PHPBB3-9726
This commit is contained in:
parent
203187a841
commit
f29f32e0d6
3 changed files with 33 additions and 3 deletions
|
@ -23,13 +23,13 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
class phpbb_template_filter extends php_user_filter
|
class phpbb_template_filter extends php_user_filter
|
||||||
{
|
{
|
||||||
const REGEX_NS = '[a-z][a-z_0-9]+';
|
const REGEX_NS = '[a-z_][a-z_0-9]+';
|
||||||
|
|
||||||
const REGEX_VAR = '[A-Z][A-Z_0-9]+';
|
const REGEX_VAR = '[A-Z_][A-Z_0-9]+';
|
||||||
|
|
||||||
const REGEX_TAG = '<!-- ([A-Z][A-Z_0-9]+)(?: (.*?) ?)?-->';
|
const REGEX_TAG = '<!-- ([A-Z][A-Z_0-9]+)(?: (.*?) ?)?-->';
|
||||||
|
|
||||||
const REGEX_TOKENS = '~<!-- ([A-Z][A-Z_0-9]+)(?: (.*?) ?)?-->|{((?:[a-z][a-z_0-9]+\.)*\\$?[A-Z][A-Z_0-9]+)}~';
|
const REGEX_TOKENS = '~<!-- ([A-Z][A-Z_0-9]+)(?: (.*?) ?)?-->|{((?:[a-z_][a-z_0-9]+\.)*\\$?[A-Z][A-Z_0-9]+)}~';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
|
|
@ -235,6 +235,15 @@ class phpbb_template_template_test extends phpbb_test_case
|
||||||
array('loop.inner'),
|
array('loop.inner'),
|
||||||
"first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast",
|
"first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast",
|
||||||
),*/
|
),*/
|
||||||
|
array(
|
||||||
|
// Just like a regular loop but the name begins
|
||||||
|
// with an underscore
|
||||||
|
'loop_underscore.html',
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
"noloop\nnoloop",
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'lang.html',
|
'lang.html',
|
||||||
array(),
|
array(),
|
||||||
|
|
21
tests/template/templates/loop_underscore.html
Normal file
21
tests/template/templates/loop_underscore.html
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<!-- BEGIN _underscore_loop -->
|
||||||
|
loop
|
||||||
|
<!-- BEGINELSE -->
|
||||||
|
noloop
|
||||||
|
<!-- END loop -->
|
||||||
|
|
||||||
|
<!-- IF ._underscore_loop -->
|
||||||
|
loop
|
||||||
|
<!-- ELSE -->
|
||||||
|
noloop
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
<!-- IF ._underscore_loop == 2 -->
|
||||||
|
loop
|
||||||
|
<!-- ENDIF -->
|
||||||
|
|
||||||
|
<!-- BEGIN _underscore_loop -->
|
||||||
|
<!-- BEGIN !block -->
|
||||||
|
loop#{loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT}
|
||||||
|
<!-- END !block -->
|
||||||
|
<!-- END _underscore_loop -->
|
Loading…
Add table
Reference in a new issue