= IQ::HTML A simple gem containing a series of helper methods for creating html markup including the escaping of strings. The aim was to create the simplest possible gem for creating HTML snippets for when the alternatives are overkill. ==Install gem install iq-html ==Usage ===Tag examples: IQ::HTML.tag('br') #=> "
" IQ::HTML.tag('strong', 'Bill & Ben') #=> "Bill & Ben" IQ::HTML.tag('strong', 'Bill & Ben', false) #=> "Bill & Ben" IQ::HTML.tag('strong', 'B&B', { :id => 'bb' }, false) #=> "Bill & Ben" IQ::HTML.tag('input', :title => 'B&B') #=> '' IQ::HTML.tag('strong', 'B&B', :title => 'Bill & Ben') #=> "B&B" ===Escaping strings: IQ::HTML.escape('Letters, Num83r5, & -- & > -- > < -- < " -- " Ӓ') #=> 'Letters, Num83r5, & -- &amp; > -- &gt; < -- &lt; " -- &quot; &#1234;' IQ::HTML.escape_once('Letters, Num83r5, & -- & > -- > < -- < " -- " Ӓ') #=> 'Letters, Num83r5, & -- & > -- > < -- < " -- " Ӓ' ===Sanitising a string for use in an HTML "id" attribute: IQ::HTML.sanitize_as_dom_id('product[variants][0][stock]') #=> 'product-variants-0-stock' == Documentation Documentation is handled with YARD[http://github.com/lsegal/yard]. You can view the docs at http://rdoc.info/projects/soniciq/iq-html or alternatively, if you have the yard gem installed, run: rake yard == Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. == Copyright Copyright (c) 2010 Jamie Hill, SonicIQ Ltd. See LICENSE for details.