예제 #1
0
 public function testSetIndentationLevelTemplate()
 {
     $parentNode = new HamlNode("parent");
     $childNode = new HamlNode("  child");
     $childNode2 = new HamlNode("    child");
     $parentNode->addNode($childNode);
     $childNode->addNode($childNode2);
     $parentNode->setIndentationLevel($parentNode->getIndentationLevel() + 2);
     $output = $parentNode->render();
     $this->assertEquals("  parent\n    child\n      child\n", $output);
 }
예제 #2
0
 public function filter(HamlNode $node)
 {
     if (null === $node) {
         throw new Exception("CssFilter: node is null.");
     }
     $plainFilter = new PlainFilter();
     $output = $node->getSpaces() . "<style type=\"text/css\">\n";
     $oldLevel = $node->getIndentationLevel();
     $node->setIndentationLevel($oldLevel + 2);
     $output .= $plainFilter->filter($node);
     $node->setIndentationLevel($oldLevel);
     $output .= $node->getSpaces() . "</style>";
     return $output . "\n";
 }
예제 #3
0
 public function filter(HamlNode $node)
 {
     if ($node === null) {
         throw new Exception('Javascript filter: node is null');
     }
     $plainFilter = new PlainFilter();
     $output = $node->getSpaces() . "<script type=\"text/javascript\">\n";
     $oldLevel = $node->getIndentationLevel();
     $node->setIndentationLevel($oldLevel + 2);
     $output .= $plainFilter->filter($node);
     $node->setIndentationLevel($oldLevel);
     $output .= $node->getSpaces() . "</script>";
     return $output . "\n";
 }