diff --git a/change_log.txt b/change_log.txt
index fbdf0ab5..19fccc1b 100644
--- a/change_log.txt
+++ b/change_log.txt
@@ -1,4 +1,8 @@
===== 3.1.32 - dev ===
+09.8.2017
+ - improvement repeated delimiter like {{ and }} will be treated as literal
+ https://groups.google.com/forum/#!topic/smarty-developers/h9r82Bx4KZw
+
05.8.2017
- bugfix wordwrap modifier could fail if used in nocache code.
converted plugin file shared.mb_wordwrap.php into modifier.mb_wordwrap.php
diff --git a/lexer/smarty_internal_configfilelexer.plex b/lexer/smarty_internal_configfilelexer.plex
index 5b494084..1741206a 100644
--- a/lexer/smarty_internal_configfilelexer.plex
+++ b/lexer/smarty_internal_configfilelexer.plex
@@ -138,6 +138,10 @@ class Smarty_Internal_Configfilelexer
$this->configBooleanize = $this->smarty->config_booleanize;
}
+ public function replace ($input) {
+ return $input;
+ }
+
public function PrintTrace()
{
$this->yyTraceFILE = fopen('php://output', 'w');
diff --git a/lexer/smarty_internal_templatelexer.plex b/lexer/smarty_internal_templatelexer.plex
index 98ff6f40..cb2ec22e 100644
--- a/lexer/smarty_internal_templatelexer.plex
+++ b/lexer/smarty_internal_templatelexer.plex
@@ -240,9 +240,11 @@ class Smarty_Internal_Templatelexer
$this->line = 1;
$this->smarty = $compiler->smarty;
$this->compiler = $compiler;
- $this->ldel = 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_length = strlen($this->smarty->left_delimiter);
- $this->rdel = preg_quote($this->smarty->right_delimiter, '/');
+ $rdel = preg_quote($this->smarty->right_delimiter, '/');
+ $this->rdel = "(?rdel_length = strlen($this->smarty->right_delimiter);
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
$this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
@@ -253,13 +255,8 @@ class Smarty_Internal_Templatelexer
$this->yyTraceFILE = fopen('php://output', 'w');
$this->yyTracePrompt = '
';
}
-
- /*
- * 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) {
+ return str_replace(array('SMARTYldel','SMARTYrawldel','SMARTYrdel'),array($this->ldel,$this->pldel,$this->rdel),$input);
}
/*!lex2php
@@ -269,15 +266,16 @@ class Smarty_Internal_Templatelexer
%value $this->value
%line $this->line
linebreak = ~[\t ]*[\r\n]+[\t ]*~
+ ldelrepeat = ~SMARTYrawldel{2,}~
text = ~[\S\s]~
textdoublequoted = ~([^"\\]*?)((?:\\.[^"\\]*?)*?)(?=(SMARTYldel|\$|`\$|"))~
namespace = ~([0-9]*[a-zA-Z_]\w*)?(\\[0-9]*[a-zA-Z_]\w*)+~
all = ~[\S\s]+~
emptyjava = ~[{][}]~
- phptag = ~(SMARTYldel\s*php([ ].*?)?SMARTYrdel)|(SMARTYldel\s*[/]phpSMARTYrdel)~
+ phptag = ~(SMARTYldelphp([ ].*?)?SMARTYrdel)|(SMARTYldel[/]phpSMARTYrdel)~
phpstart = ~(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(