public function HamlElementNode::render in Sassy 7
Overrides HamlNode::render
File
- phamlp/
haml/ tree/ HamlElementNode.php, line 28
Class
- HamlElementNode
- HamlElementNode class. Represents an element. @package PHamlP @subpackage Haml.tree
Code
public function render() {
$renderer = $this->renderer;
$this->output = $renderer
->renderOpeningTag($this);
$close = $renderer
->renderClosingTag($this);
if ($this->whitespaceControl['outer']['left']) {
$this->output = ltrim($this->output);
$close = rtrim($close);
$this->parent->output = rtrim($this->parent->output);
}
foreach ($this->children as $index => $child) {
$output = $child
->render();
$output = $this->whitespaceControl['inner'] ? trim($output) : $output;
if ($index && $this->children[$index - 1] instanceof HamlElementNode && $this->children[$index - 1]->whitespaceControl['outer']['right']) {
$output = ltrim($output);
}
$this->output .= $output;
}
// foreach
return $this
->debug($this->output . (isset($child) && $child instanceof HamlElementNode && $child->whitespaceControl['outer']['right'] ? ltrim($close) : $close));
}