Class: Hpricot::Elem
- Inherits:
-
Object
- Object
- Hpricot::Elem
- Defined in:
- lib/html2slim/hpricot_monkeypatches.rb
Constant Summary collapse
- BLANK_RE =
/\A[[:space:]]*\z/
Instance Method Summary collapse
Instance Method Details
#slim(lvl = 0) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/html2slim/hpricot_monkeypatches.rb', line 53 def slim(lvl=0) r = ' ' * lvl return r + slim_ruby_code(r) if ruby? r += name unless skip_tag_name? r += slim_id r += slim_class r += slim_attributes r end |
#to_slim(lvl = 0) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/html2slim/hpricot_monkeypatches.rb', line 65 def to_slim(lvl=0) if respond_to?(:children) and children return %(#{slim(lvl)}\n#{children.map{|c| c.to_slim(lvl+1) }.select{|e| !e.nil? }.join("\n")}) else slim(lvl) end end |