lib/converters/nokogiri.rb
# Scan a string with Nokogiri and convert if match string
Scan a string with Nokogiri and convert if match string
Scan a string with Nokogiri and convert if match string
def scan(string, options = {})
      return string if !options[:converters] or options[:converters].empty?
      doc = Nokogiri::HTML.fragment(string)
      doc.search('.//text()').each do |el|
        t = el.text
        if t.strip.size > 0
          t = convert(t, options) if convertable?(el)
        end
        el.replace(t)
      end
      doc.to_html
    end
def scan ( string , options = { } ) return string if ! options [ :converters ] or options [ :converters ] . empty? doc = Nokogiri :: HTML . fragment ( string ) doc . search ( './/text()' ) . each do | el | t = el . text if t . strip . size > 0 t = convert ( t , options ) if convertable? ( el ) end el . replace ( t ) end doc . to_html end
Scan a string with Nokogiri and convert if match string
Scan a string with Nokogiri and convert if match string
string
options