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); }
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; }
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(); }
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(); }
public function render() { $interpolation = new Interpolation($this->renderDoctype()); return $interpolation->render(); }
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(); }
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; }