diff options
author | xue <> | 2006-05-03 18:19:13 +0000 |
---|---|---|
committer | xue <> | 2006-05-03 18:19:13 +0000 |
commit | 4c2920064d561701016476b91ce28813e2368270 (patch) | |
tree | 90d671be43be7db100bf9d03d03a16d4b439b951 | |
parent | ee6dd9872aabf90d71662c4c39a33f071a8886d0 (diff) |
Fixed #154: HTML comments are now parsed as regular template strings.
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 21 |
2 files changed, 9 insertions, 15 deletions
@@ -1,6 +1,7 @@ Version 3.0.1 June 1, 2006
==========================
-ENH: Ticket#153 - TAssetManager now ignores .svn directories (Qiang)
+CHG: Ticket#153 - TAssetManager now ignores .svn directories (Qiang)
+CHG: Ticket#154 - HTML comments are now parsed as regular template strings (Qiang)
ENH: added sanity check to calling event handlers (Qiang)
Version 3.0.0 May 1, 2006
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index b065b4de..86567243 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -127,9 +127,7 @@ class TTemplateManager extends TModule * - directive: directive specifies the property values for the template owner.
* It is in the format of <% property name-value pairs %>
* - expressions: They are in the formate of <= PHP expression > and <% PHP statements >
- * - comments: There are two kinds of comments, regular HTML comments and special template comments.
- * The former is in the format of <!-- comments -->, which will be treated as text strings.
- * The latter is in the format of <%* comments %>, which will be stripped out.
+ * - comments: Special template comments enclosed within <!-- comments --!> will be stripped out.
*
* Tags other than the above are not required to be well-formed.
*
@@ -147,13 +145,12 @@ class TTemplate extends TApplicationComponent implements ITemplate {
/**
* '<!--.*?--!>' - template comments
- * '<!--.*?-->' - HTML comments
* '<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>' - component tags
* '<\/?prop:([\w\.]+)\s*>' - property tags
* '<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>' - directives
* '<%[%#~\\$=\\[](.*?)%>' - expressions
*/
- const REGEX_RULES='/<!--.*?--!>|<!--.*?-->|<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>|<%[%#~\\$=\\[](.*?)%>/msS';
+ const REGEX_RULES='/<!--.*?--!>|<\/?com:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?")*)\s*%>|<%[%#~\\$=\\[](.*?)%>/msS';
/**
* Different configurations of component property/event/attribute
@@ -618,15 +615,11 @@ class TTemplate extends TApplicationComponent implements ITemplate }
else if(strpos($str,'<!--')===0) // comments
{
- if(strrpos($str,'--!>')===strlen($str)-4) // template comments
- {
- if($expectPropEnd)
- throw new TConfigurationException('template_comments_forbidden');
- if($matchStart>$textStart)
- $tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
- $textStart=$matchEnd+1;
- }
- // else, HTML comments and we do nothing
+ if($expectPropEnd)
+ throw new TConfigurationException('template_comments_forbidden');
+ if($matchStart>$textStart)
+ $tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
+ $textStart=$matchEnd+1;
}
else
throw new TConfigurationException('template_matching_unexpected',$match);
|