HAML Cheat Sheet by J Lee (Specialbrand) Via Cheatography.Com/395/Cs/188
Total Page:16
File Type:pdf, Size:1020Kb
HAML Cheat Sheet by J Lee (specialbrand) via cheatography.com/395/cs/188/ Doctype Elements Class and ID !!! <!DOCTYPE html PUBLIC "-//W3C//DTD %p %div#things XHTML 1.0 Transitional//EN" A paragraph %span#rice Chicken Fried "http://www.w3.org/TR/xhtml1/DTD/xhtml1- %strong bold %p.beans{ :food => 'true' } The magical fruit transitional.dtd"> %h1.class.otherclass#id La La La !!! 5 <!DOCTYPE html> is compiled to: <p>A paragraph <strong>bold</strong></p> is compiled to: !!! Strict <!DOCTYPE html PUBLIC "-//W3C//DTD <div id='things'> XHTML 1.0 Strict//EN" Attributes <span id='rice'>Chicken Fried</span> "http://www.w3.org/TR/xhtml1/DTD/xhtml1- <p class='beans' food='true'>The magical fruit</p> strict.dtd"> %html{:xmlns => "http://www.w3.org/1999/xhtml", <h1 class='class otherclass' id='id'>La La La</h1> "xml:lang" => "en", :lang => "en"} !!! <!DOCTYPE html PUBLIC "-//W3C//DTD </div> Frameset XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- is compiled to: Implicit Div Elements frameset.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' xml:la ng='en' lang='en'></html> #collection .item Filters Self-Closing Tags .description What a cool item! %p %br :markdown is compiled to: %meta{'http-equiv' => 'Content-Type', :content => # Heading <div id='collection'> 'text/html'} Hello, *World* <div class='item'> <div class='description'>What a cool item!</div> is compiled to: is compiled to: </div> <br /> <p> </div> <h1>Heading</h1> <meta http-equiv='Content-Type' content='text/html' <p>Hello, <em>World</em></p> /> Comments </p> Escaping HTML HTML Comments: / Some Filters Available To Use &= "I like cheese and crackers" %peanutbutterjelly :plain Does not parse the filtered text. This is / This is the peanutbutterjelly element compiles to: useful for large blocks of text without HTML I like sandwiches! tags, when you don’t want lines starting I like cheese &amp; crackers with . or - to be parsed. is compiled to: :javas Surrounds the filtered text with <script> and <peanutbutterjelly> cript CDATA tags. Useful for including inline <!-- This is the peanutbutterjelly ellement --> Javascript. I like sandwiches! </peanutbutterjelly> :css Surrounds the filtered text with <style> and CDATA tags. Useful for including inline Haml Comments: -# CSS. %p foo :sass Parses the filtered text with Sass to produce -# This is a comment CSS output. %p bar :textile Parses the filtered text with Textile. is compiled to: :makuru Parses the filtered text with Maruku, which <p>foo</p> has some non-standard extensions to <p>bar</p> Markdown. Cheatographer Cheat Sheet Sponsor J Lee (specialbrand) This cheat sheet was published on 5th January, Envoy, for simple and effective bug management. cheatography.com/specialbrand/ 2012 and was last updated on 5th January, 2012. Try it free! www.specialbrand.net http://www.envoyapp.com.