You are here

abstract class _HamlMarkdownFilter in Sassy 7

Markdown Filter for {@link http://haml-lang.com/ Haml} class. Parses the text with Markdown.

This is an abstract class that must be extended and the init() method implemented to provide the vendorPath if the vendor class is not imported elsewhere in the application (e.g. by a framework) and vendorClass if the default class name is not correct. @package PHamlP @subpackage Haml.filters

Hierarchy

Expanded class hierarchy of _HamlMarkdownFilter

File

phamlp/haml/filters/_HamlMarkdownFilter.php, line 25

View source
abstract class _HamlMarkdownFilter extends HamlBaseFilter {

  /**
   * @var string Path to Markdown Parser
   */
  protected $vendorPath;

  /**
   * @var string Markdown class
   * Override this value if the class name is different in your environment
   */
  protected $vendorClass = 'MarkdownExtra_Parser';

  /**
   * Child classes must implement this method.
   * Typically the child class will set $vendorPath and $vendorClass
   */
  public function init() {
  }

  /**
   * Run the filter
   * @param string text to filter
   * @return string filtered text
   */
  public function run($text) {
    return '<?php	' . (!empty($this->vendorPath) ? 'require_once "' . $this->vendorPath . '";' : '') . '$markdown___=new ' . $this->vendorClass . '();echo  $markdown___->safeTransform("' . preg_replace(HamlParser::MATCH_INTERPOLATION, '".\\1."', $text) . '");?>';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
_HamlMarkdownFilter::$vendorClass protected property * * Override this value if the class name is different in your environment
_HamlMarkdownFilter::$vendorPath protected property *
_HamlMarkdownFilter::init public function * Child classes must implement this method. * Typically the child class will set $vendorPath and $vendorClass Overrides HamlBaseFilter::init 2
_HamlMarkdownFilter::run public function * Run the filter * Overrides HamlBaseFilter::run