예제 #1
0
 /**
  * Remove the keywords.
  *
  * @return self   $this
  */
 public function unsetMinify()
 {
     $this->pug->removeKeyword('assets');
     $this->pug->removeKeyword('concat');
     $this->pug->removeKeyword('concat-to');
     $this->pug->removeKeyword('minify');
     $this->pug->removeKeyword('minify-to');
     $this->minify = null;
     return $this;
 }
예제 #2
0
 public function testPhpKeyWord()
 {
     $jade = new Jade(array('prettyprint' => false));
     $actual = trim($jade->render('for ;;'));
     $expected = '<for>;;</for>';
     $this->assertSame($expected, $actual, 'Before adding keyword, a word render as a tag.');
     $jade->addKeyword('for', function ($args) {
         return array('beginPhp' => 'for (' . $args . ') {', 'endPhp' => '}');
     });
     $actual = trim($jade->render('for $i = 0; $i < 3; $i++' . "\n" . '  p= i'));
     $expected = '<p>0</p><p>1</p><p>2</p>';
     $this->assertSame($expected, $actual, 'addKeyword should allow to customize available keywords.');
     $jade->replaceKeyword('for', new ForKeyword());
     $actual = trim($jade->render('for $i = 0; $i < 3; $i++' . "\n" . '  p'));
     $expected = '$i = 0; $i < 3; $i++<p></p>';
     $this->assertSame($expected, $actual, 'The keyword action can be an callable class.');
     $jade->removeKeyword('for');
     $actual = trim($jade->render('for ;;'));
     $expected = '<for>;;</for>';
     $this->assertSame($expected, $actual, 'After removing keyword, a word render as a tag.');
 }