mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Added comment syntax to SS templates: <%-- ... --%>
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65926 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a25320a99c
commit
0328ff5c9d
@ -355,6 +355,7 @@ class SSViewer extends Object {
|
||||
|
||||
// $val, $val.property, $val(param), etc.
|
||||
$replacements = array(
|
||||
'/<%--.*--%>/U' => '',
|
||||
'/\$Iteration/' => '<?= {dlr}key ?>',
|
||||
'/{\\$([A-Za-z_][A-Za-z0-9_]*)\\(([^),]+), *([^),]+)\\)\\.([A-Za-z0-9_]+)\\.([A-Za-z0-9_]+)}/' => '<?= {dlr}item->obj("\\1",array("\\2","\\3"),true)->obj("\\4",null,true)->XML_val("\\5",null,true) ?>',
|
||||
'/{\\$([A-Za-z_][A-Za-z0-9_]*)\\(([^),]+), *([^),]+)\\)\\.([A-Za-z0-9_]+)}/' => '<?= {dlr}item->obj("\\1",array("\\2","\\3"),true)->XML_val("\\4",null,true) ?>',
|
||||
|
@ -33,4 +33,14 @@ SS
|
||||
$template = $viewer->process($data);
|
||||
$this->assertFalse((bool)trim($template), "Should be no content in this return.");
|
||||
}
|
||||
|
||||
function testComments() {
|
||||
$viewer = SSViewer::fromString(<<<SS
|
||||
This is my template<%-- this is a comment --%>This is some content<%-- this is another comment --%>This is the final content
|
||||
SS
|
||||
);
|
||||
$output = $viewer->process(new ArrayData(array()));
|
||||
|
||||
$this->assertEquals("This is my templateThis is some contentThis is the final content", $output);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user