HamlNestedRenderer.php in Sassy 7
File
phamlp/haml/renderers/HamlNestedRenderer.php
View source
<?php
class HamlNestedRenderer extends HamlRenderer {
public function renderOpeningTag($node) {
return ($node->whitespaceControl['outer'] ? '' : $this
->getIndent($node)) . parent::renderOpeningTag($node) . ($node->whitespaceControl['inner'] ? '' : ($node->isSelfClosing && $node->whitespaceControl['outer'] ? '' : "\n"));
}
public function renderClosingTag($node) {
return $node->isSelfClosing ? '' : ($node->whitespaceControl['inner'] ? '' : $this
->getIndent($node)) . parent::renderClosingTag($node) . ($node->whitespaceControl['outer'] ? '' : "\n");
}
public function renderContent($node) {
return $this
->getIndent($node) . parent::renderContent($node) . "\n";
}
public function renderOpenComment($node) {
return parent::renderOpenComment($node) . (empty($node->content) ? "\n" : '');
}
public function renderCloseComment($node) {
return parent::renderCloseComment($node) . "\n";
}
public function renderStartCodeBlock($node) {
return $this
->getIndent($node) . parent::renderStartCodeBlock($node) . "\n";
}
public function renderEndCodeBlock($node) {
return $this
->getIndent($node) . parent::renderEndCodeBlock($node) . "\n";
}
private function getIndent($node) {
return str_repeat(' ', 2 * $node->level);
}
}
Classes
Name |
Description |
HamlNestedRenderer |
HamlNestedRenderer class.
Blocks and content are indented according to their nesting level.
@package PHamlP
@subpackage Haml.renderers |