protected function renderChildrenHaml(HamlNode $node) { $parent = $node->getParent(); $haml = $parent !== null ? $parent->getSpaces() . $node->getHaml() : $node->getRawHaml(); $output = $haml . "\n"; if ($node->hasChildren()) { $children = $node->getChildren(); for ($i = 0, $count = count($children); $i < $count; ++$i) { $output .= $this->renderChildrenHaml($children[$i]); } } return $output; }
/** * @see IFilter::filter() */ public function filter(HamlNode $node) { if (null === $node) { throw new Exception("MarkdownFilter: node is null."); } $children = $node->getChildren(); $output = ''; $indent = 999999999; // gets the lowes indent among the children to set as base foreach ($children as $child) { if ($indent > ($ind = $child->getIndentationLevel())) { $indent = $ind; } } foreach ($children as $childNode) { $output .= substr($childNode->getRawHaml(), $indent) . "\n"; } return $this->parser->transform($output); }