module Hpricot::Container::Trav

def insert_after(nodes, ele)

after the node +ele+, a child of the current node.
Insert +nodes+, an array of HTML elements or a single element,
def insert_after(nodes, ele)
  case nodes
  when Array
    nodes.reverse_each { |n| insert_after(n, ele) }
  else
    reparent nodes
    idx = children.index(ele)
    children[idx ? idx + 1 : children.length, 0] = nodes
  end
end