You are here

class HamlJavascriptFilter in Sassy 7

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 #(). @package PHamlP @subpackage Haml.filters

Hierarchy

Expanded class hierarchy of HamlJavascriptFilter

File

phamlp/haml/filters/HamlJavascriptFilter.php, line 20

View source
class HamlJavascriptFilter extends HamlBaseFilter {

  /**
   * Run the filter
   * @param string text to filter
   * @return string filtered text
   */
  public function run($text) {
    return "<script type=\"text/javascript\">\n  //<![CDATA[\n" . preg_replace(HamlParser::MATCH_INTERPOLATION, '<?php echo \\1; ?>', $text) . "  //]]>\n</script>\n";
  }

}

Members

Namesort descending Modifiers Type Description Overrides
HamlBaseFilter::init public function * Initialise the filter. 2
HamlJavascriptFilter::run public function * Run the filter * Overrides HamlBaseFilter::run