Sha256: ec890bfe537347c1f3d89df74dce8deeeddfe9f7e227eeab968708054cc294bb

Contents?: true

Size: 561 Bytes

Versions: 2

Compression:

Stored size: 561 Bytes

Contents

require 'nokogiri'

class DaisyDiff::Result

  attr_reader :html

  def initialize(result_text)
    doc = Nokogiri::HTML.parse result_text
    body = doc.css('body')
    body.css('script').remove
    body.css('div.diff-topbar').remove
    
    body.xpath("//@*[starts-with(name(.), 'on')]").remove # Remove any daisy diff ui js handler
    # body.xpath('//@id').remove
    # body.xpath('//@changeid').remove
    # body.xpath('//@previous').remove
    # body.xpath('//@next').remove

    # body.xpath('//@changes').remove

    @html = body.inner_html
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
daisydiff-0.0.2 lib/daisydiff/result.rb
daisydiff-0.0.1 lib/daisydiff/result.rb