function apply(Hamle\Tag $rootTag) { if ($this->type == "append" or $this->type == "prepend") { $matchTags = $rootTag->find($this->path); foreach ($matchTags as $tag) { foreach ($this->tags as $t) { $tag->addChild($t, $this->type); } } } elseif ($this->type == "replace") { $rootTag->replace($this->path, $this); } else { throw new Hamle\Exception\ParseError("Cant Apply snippet to document '{$this->type}'"); } }
function __construct($param) { parent::__construct(); $param = explode(' ', $param); if (count($param) < 2) { throw new ParseError("|form requires 2 arguments, form type, and instance"); } $this->var = new H\Text($param[1]); if (preg_match('/^(.*)\\((.*)\\)/', $param[0], $m)) { $this->form = new $m[1]($m[2]); } else { $this->form = new $param[0](); } }
function __construct($tag, $class = array(), $attr = array(), $id = "") { parent::__construct(); $this->opt = $attr; if (isset($attr['class']) && !is_array($attr['class'])) { $this->opt['class'] = $attr['class'] ? explode(" ", $attr['class']) : array(); } $this->source = array(); $this->type = $tag ? $tag : "div"; if ($class) { if (isset($this->opt['class'])) { $this->opt['class'] = array_merge($this->opt['class'], $class); } else { $this->opt['class'] = $class; } } if ($id) { $this->opt['id'] = $id; } }
function __construct($tag) { parent::__construct(); $this->escape = $tag == "_"; }
function render($indent = 0, $doIndent = true) { return parent::render($indent - self::INDENT_SIZE, false); }
function renderContent($pad = "", $oneliner = false) { $c = $this->filter; return $c::filterText(parent::renderContent($pad)); }