Module: Webby::Helpers::TagHelper
- Includes:
- ERB::Util
- Defined in:
- lib/webby/helpers/tag_helper.rb
Overview
Provides methods to generate HTML tags programmatically. By default, they output XHTML compliant tags.
Constant Summary collapse
- BOOLEAN_ATTRIBUTES =
Set.new(%w(disabled readonly multiple))
Constants included from ERB::Util
Instance Method Summary collapse
-
#escape_once(html) ⇒ Object
Returns an escaped version of
html
without affecting existing escaped entities.
Methods included from ERB::Util
Instance Method Details
#escape_once(html) ⇒ Object
Returns an escaped version of html
without affecting existing escaped entities.
Examples
escape_once("1 > 2 & 3")
# => "1 < 2 & 3"
escape_once("<< Accept & Checkout")
# => "<< Accept & Checkout"
36 37 38 |
# File 'lib/webby/helpers/tag_helper.rb', line 36 def escape_once( html ) html.to_s.gsub(/[\"><]|&(?!([a-zA-Z]+|(#\d+));)/) { |special| ERB::Util::HTML_ESCAPE[special] } end |