Sha256: 9d85716b2e5b4c95e7f43338d59d53b4fc554c8394fa21c5e2f81702c3bd6f25

Contents?: true

Size: 383 Bytes

Versions: 3

Compression:

Stored size: 383 Bytes

Contents

module CrazyHarry
  module Foster

    def foster!
      self.steps << foster_orphaned_li

      run!

      self
    end

    private

    def foster_orphaned_li
      Loofah::Scrubber.new do |node|
        node.replace("<ul>#{node}</ul>") if orphaned_li?(node)
      end
    end

    def orphaned_li?(node)
      node.name == 'li' && node.parent.name !~ /ol|ul/
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
crazy_harry-0.2.1 lib/crazy_harry/foster.rb
crazy_harry-0.2.0 lib/crazy_harry/foster.rb
crazy_harry-0.1.2 lib/crazy_harry/foster.rb