| Class | Uttk::Dumpers::Html |
| In: |
lib/uttk/dumpers/Html.rb
|
| Parent: | Dumper |
Use me at least with the Compact filter:
Compact: [NodeCut: [!skip ^contents$, [Html: [log.html]]]]
# File lib/uttk/dumpers/Html.rb, line 260 def self.clean_js_str ( str ) res = str.to_s.html_encode.dump res.gsub!(/([^\\])\\n/, '\1<BR>\n') res end
# File lib/uttk/dumpers/Html.rb, line 142 def initialize ( *a, &b ) @uttk_js = base_url + 'javascripts/uttk.js' @uttk_css = base_url + 'stylesheets/uttk.css' super reset end
# File lib/uttk/dumpers/Html.rb, line 209 def close super x = XmlMarkup.new(:indent => 2, :target => self) x.html do x.head do x.script '', :language => 'javascript', :src => @uttk_js x.style :type => 'text/css' do x.itext! "@import url('#@uttk_css');" end x.script :language => 'javascript' do @elts.each do |elt| x << elt.to_html_uttk_js(@status) << "\n" end end end x.body :onLoad => 'uttk_main()' do x.table :class => 'uttk_infos' do x.tr :class => 'uttk_infos_box' do x.expand_and_collapse 'null', '' x.expand_and_collapse "'node'", 'nodes' x.expand_and_collapse "'leaf'", 'leaves' end end x.div '', :id => 'uttk_contents' end end reset end
# File lib/uttk/dumpers/Html.rb, line 240 def id_of ( prefix, path ) path = path.inspect @ids[prefix] ||= {} result = @ids[prefix][path] if result.nil? result = @ids[prefix][path] = new_id(prefix) end result end
# File lib/uttk/dumpers/Html.rb, line 252 def new_id ( prefix ) id = "#{prefix}#{@current_ids[prefix]}" @current_ids[prefix] += 1 id.dump end
# File lib/uttk/dumpers/Html.rb, line 177 def new_leaf ( path, leaf ) super if path.last.segment == :status @status[id_of(:status, path)] = leaf @elts.pop else father = id_of :node, path path << leaf id = id_of :leaf, path contents = leaf n = @elts.pop father, leaf, id, status = n.father, n.name, n.id, n.status state, status = 0, '' if contents.is_a? Hash status = contents[:status] [:status].each do |k| contents.delete k if contents.has_key? k end else state = 2 end @elts << Leaf.new(:father => father, :id => id, :name => leaf, :status => status, :state => state, :contents => contents) end end