class Mato::HtmlFilters::BareInlineElement

Constants

STANDALONE_INLINE_ELEMENTS

Public Instance Methods

call(doc) click to toggle source
# File lib/mato/html_filters/bare_inline_element.rb, line 17
def call(doc)
  doc.children.each do |node|
    next unless STANDALONE_INLINE_ELEMENTS.include?(node.name)

    parent = Nokogiri::HTML4.fragment('<p/>')
    parent.child.add_child(node.dup)
    node.replace(parent)
  end
end