render() public method

public render ( )
Example #1
0
 public function testRenderInsidePhp()
 {
     $i = new Interpolation("#{ImTheWholeThing()}", true);
     $actual = $i->render();
     $this->assertEquals('ImTheWholeThing()', $actual);
     $i = new Interpolation("\"Hey, look! #{ImInsidePhp()}! And #{\$me + \$too}!\"", true);
     $actual = $i->render();
     $this->assertEquals('"Hey, look! ".(ImInsidePhp())."! And ".($me + $too)."!"', $actual);
 }
Example #2
0
 public function render()
 {
     $output = $this->_spaces . $this->_haml . "\n";
     $interpolation = new Interpolation($output);
     $output = $interpolation->render();
     if ($this->hasChildren()) {
         $output = $output . $this->renderChildren();
     }
     return $output;
 }
Example #3
0
 public function render()
 {
     if (null === $this->_filterContainer) {
         return '';
     }
     $identifier = str_replace(':', '', $this->getHaml());
     $filter = $this->_filterContainer->getFilter($identifier);
     if (null === $filter) {
         throw new Exception(sprintf("Unknown filter '%s'.", $identifier));
     }
     $interpolation = new Interpolation($filter->filter($this));
     return $interpolation->render();
 }
Example #4
0
 public function render()
 {
     $output = "";
     switch ($this->_commentType) {
         case CommentNode::HTML_COMMENT_TYPE:
             $output = $this->renderHtmlComment() . "\n";
             break;
         case CommentNode::HAML_COMMENT_TYPE:
             $output = $this->renderHamlComment() . "\n";
             break;
         case CommentNode::CONDITIONAL_COMMENT_TYPE:
             $output = $this->renderConditionalComment() . "\n";
             break;
         default:
             throw new Exception("Invalid comment type: " . $this->getHaml());
     }
     $interpolation = new Interpolation($output);
     return $interpolation->render();
 }
Example #5
0
 public function render()
 {
     $interpolation = new Interpolation($this->renderDoctype());
     return $interpolation->render();
 }
Example #6
0
 private function _interpolate($str)
 {
     if (!$this->_containsInterpolation($str)) {
         return $str;
     }
     $nStr = '';
     $s = new StringScanner($str);
     $quote = $s->check(StringScanner::rQUOTE);
     // If it doesn't starts with a quote, it CAN'T be inside php context
     if (empty($quote) || !s($str)->endsWith($quote)) {
         $int = new Interpolation($str);
         return $int->render();
     }
     $int = new Interpolation($str, true);
     return $int->render();
 }
Example #7
0
 private function renderTagContent($content)
 {
     if ($this->hasChildren()) {
         $content = "\n" . $this->renderChildren() . $this->getSpaces();
     }
     if ($content === null) {
         $content = '';
     }
     if ($this->_phpVariable) {
         $content = "<?php echo " . $content . " ?>";
     } else {
         $interpolation = new Interpolation($content);
         $content = $interpolation->render();
     }
     return $content;
 }