public function HamlJavascriptFilter::run in Sassy 7
* Run the filter *
Parameters
string text to filter: * @return string filtered text
Overrides HamlBaseFilter::run
File
- phamlp/
haml/ filters/ HamlJavascriptFilter.php, line 26
Class
- HamlJavascriptFilter
- Javascript Filter for {@link http://haml-lang.com/ Haml} class. Surrounds the filtered text with <script> and CDATA tags. Useful for including inline Javascript. Code to be interpolated can be included by wrapping it in…
Code
public function run($text) {
return "<script type=\"text/javascript\">\n //<![CDATA[\n" . preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \\1; ?>', $text) . " //]]>\n</script>\n";
}