Module: Kramdown::Utils::Html
- Defined in:
- lib/darkmouun/kramdown/utils/html.rb
Instance Method Summary collapse
Instance Method Details
#html_attributes(attr) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/darkmouun/kramdown/utils/html.rb', line 16 def html_attributes(attr) return '' if attr.empty? attr.map do |k, v| if v.nil? || (k == 'id' && v.strip.empty?) '' elsif k == 'href' " #{k}=\"#{v.to_s}\"" else " #{k}=\"#{escape_html(v.to_s, :attribute)}\"" end end.join('') end |