예제 #1
0
파일: Jade.php 프로젝트: SC7639/jade.php
 public function render($input, $scope = null, $includes = array())
 {
     if ($scope !== null && is_array($scope)) {
         extract($scope);
     }
     $parser = new Parser($input, array('includes' => $includes));
     $compiler = new Compiler($this->prettyprint);
     return $compiler->compile($parser->parse($input));
 }
예제 #2
0
 public function parse()
 {
     static $i = 0;
     if ($i++) {
         throw new OnlyOnceException("I: Works only once", 1);
     }
     parent::parse();
 }
예제 #3
0
파일: Jade.php 프로젝트: volter9/jade-php
 /**
  * @param $input
  * @return string
  */
 public function compile($input)
 {
     $parser = new Parser($input, null, $this->options['extension']);
     $compiler = new Compiler($this->options['prettyprint'], $this->options['phpSingleLine'], $this->options['allowMixinOverride'], $this->filters);
     return $compiler->compile($parser->parse($input));
 }
예제 #4
0
파일: Jade.php 프로젝트: XaBerr/JUICE
 /**
  * Compile PHP code from a Pug input or a Pug file.
  *
  * @param string input
  *
  * @throws \Exception
  *
  * @return string
  */
 public function compile($input)
 {
     $parser = new Parser($input, null, $this->options);
     $compiler = new Compiler($this->options, $this->filters, $parser->getFilename());
     $php = $compiler->compile($parser->parse());
     if (version_compare(PHP_VERSION, '7.0.0') < 0) {
         $php = preg_replace_callback('/(' . preg_quote('\\Jade\\Compiler::getPropertyFromAnything', '/') . '\\(((?>[^()]+)|(?-2))*\\))[ \\t]*(\\(((?>[^()]+)|(?-2))*\\))/', function ($match) {
             return 'call_user_func(' . $match[1] . ', ' . $match[4] . ')';
         }, $php);
     }
     $postRender = $this->getOption('postRender');
     if (is_callable($postRender)) {
         $php = call_user_func($postRender, $php);
     }
     return $php;
 }
예제 #5
0
 /**
  * @param $input
  * @return string
  */
 public function compile($input)
 {
     $parser = new Parser($input, null, $this->options['extension']);
     $compiler = new Compiler($this->options['prettyprint'], $this->filters);
     return $compiler->compile($parser->parse($input));
 }
예제 #6
0
 public function __construct($input, $filename = null, array $options = array())
 {
     parent::__construct($input, $filename, $options);
     $this->lexer = new Lexer($this->input, $this->options);
 }