require 'hanami/helpers/html_helper/html_builder' module Hanami module Helpers # HTML builder # # By including Hanami::Helpers::HtmlHelper it will inject one private method: html. # This is a HTML5 markup builder. # # Features: # * Support for complex markup without the need of concatenation # * Auto closing HTML5 tags # * Custom tags # * Content tag auto escape (XSS protection) # * Support for view local variables # # Usage: # # * It knows how to close tags according to HTML5 spec (1) # * It accepts content as first argument (2) # * It accepts another builder as first argument (3) # * It accepts content as block which returns a string (4) # * It accepts content as a block with nested markup builders (5) # * It builds attributes from given hash (6) # * It combines attributes and block (7) # # @since 0.1.0 # # @see Hanami::Helpers::HtmlHelper#html # # @example Usage # # 1 # html.div # =>
# html.img # => # # # 2 # html.div('hello') # =>hello
hello
# #hello
# html.div do # p 'hello' # end # =>hello
# # # # html.div("") # # => "<script>alert('xss')</script>
<script>alert('xss')</script>