mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- improvement repeated delimiter like {{ and }} will be treated as literal
https://groups.google.com/forum/#!topic/smarty-developers/h9r82Bx4KZw
This commit is contained in:
@@ -255,6 +255,14 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->yyTraceFILE = fopen('php://output', 'w');
|
$this->yyTraceFILE = fopen('php://output', 'w');
|
||||||
$this->yyTracePrompt = '<br>';
|
$this->yyTracePrompt = '<br>';
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Check if this tag is autoliteral
|
||||||
|
*/
|
||||||
|
public function isAutoLiteral ()
|
||||||
|
{
|
||||||
|
return $this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false;
|
||||||
|
}
|
||||||
|
|
||||||
public function replace ($input) {
|
public function replace ($input) {
|
||||||
return str_replace(array('SMARTYldel','SMARTYrawldel','SMARTYrdel'),array($this->ldel,$this->pldel,$this->rdel),$input);
|
return str_replace(array('SMARTYldel','SMARTYrawldel','SMARTYrdel'),array($this->ldel,$this->pldel,$this->rdel),$input);
|
||||||
}
|
}
|
||||||
|
@@ -176,6 +176,10 @@ class Smarty_Internal_Templatelexer
|
|||||||
*/
|
*/
|
||||||
private $yy_global_pattern1 = null;
|
private $yy_global_pattern1 = null;
|
||||||
private $yy_global_pattern2 = null;
|
private $yy_global_pattern2 = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if this tag is autoliteral
|
||||||
|
*/
|
||||||
private $yy_global_pattern3 = null;
|
private $yy_global_pattern3 = null;
|
||||||
private $yy_global_pattern4 = null;
|
private $yy_global_pattern4 = null;
|
||||||
private $yy_global_pattern5 = null;
|
private $yy_global_pattern5 = null;
|
||||||
@@ -202,8 +206,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->pldel = preg_quote($this->smarty->left_delimiter, '/');
|
$this->pldel = preg_quote($this->smarty->left_delimiter, '/');
|
||||||
$this->ldel = $this->pldel . ($this->smarty->auto_literal ? '(?!\\s+)' : '\\s*');
|
$this->ldel = $this->pldel . ($this->smarty->auto_literal ? '(?!\\s+)' : '\\s*');
|
||||||
$this->ldel_length = strlen($this->smarty->left_delimiter);
|
$this->ldel_length = strlen($this->smarty->left_delimiter);
|
||||||
$rdel = preg_quote($this->smarty->right_delimiter, '/');
|
$this->rdel = preg_quote($this->smarty->right_delimiter, '/');
|
||||||
$this->rdel = "(?<!{$rdel}){$rdel}(?!{$rdel})";
|
|
||||||
$this->rdel_length = strlen($this->smarty->right_delimiter);
|
$this->rdel_length = strlen($this->smarty->right_delimiter);
|
||||||
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
|
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
|
||||||
$this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
|
$this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
|
||||||
@@ -215,6 +218,12 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->yyTracePrompt = '<br>';
|
$this->yyTracePrompt = '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isAutoLiteral()
|
||||||
|
{
|
||||||
|
return $this->smarty->auto_literal && isset($this->value[ $this->ldel_length ]) ?
|
||||||
|
strpos(" \n\t\r", $this->value[ $this->ldel_length ]) !== false : false;
|
||||||
|
}
|
||||||
|
|
||||||
public function yylex1()
|
public function yylex1()
|
||||||
{
|
{
|
||||||
if (!isset($this->yy_global_pattern1)) {
|
if (!isset($this->yy_global_pattern1)) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user