/** * Test attribute reparing. phpHaml can repair: * - value without quotation marks (eg. { :bgcolor => green }) * - value without quotation marks followed by colon (same syntax like key eg. { :align => :center } */ public function testAttributeRepair() { $this->markTestIncomplete(); return; $this->parser->setSource('%b{ :bgcolor => green, :align => :center } Hello, World!'); $this->assertEquals('<b align="center" bgcolor="green">Hello, World!</b>', $this->parser->fetch()); }
/** * Render Haml. Append globals variables * * Simple way to use Haml * <code> * echo HamlParser::haml('%strong Hello, World!'); // <strong>Hello, World!</strong> * $foo = 'bar'; // This is global variable * echo Haml::haml('%strong= "Foo is $foo"'); // <strong>Foo is bar</strong> * </code> * * @param string Haml source * @return string xHTML */ public static function haml($sSource) { static $__haml_parser; if (!$__haml_parser) { $__haml_parser = new HamlParser(); } $__haml_parser->setSource($sSource); $__haml_parser->append($GLOBALS); return $__haml_parser->fetch(); }
public function testFrameBorder() { $this->parser->setSource('%iframe{ :frameBorder => "0" } Hello!!'); $this->assertEquals('<iframe frameBorder="0">Hello!!</iframe>', $this->parser->fetch()); }
/** * Test tag with dash in name */ public function testTagWithDash() { $this->parser->setSource('%foo-bar Hello, World!'); $this->assertEquals('<foo-bar>Hello, World!</foo-bar>', $this->parser->fetch()); }
/** * Test very_basic.haml */ public function testVeryBasic() { $this->parser->setSource($this->getModifiedFile('very_basic', array(1 => '!!! Transitional'))); $this->assertEquals($this->getResults('very_basic', array(3 => ' <head></head>')), $this->parser->fetch() . "\n"); }