lib/cucumber/formatter/html.rb in aslakhellesoy-cucumber-0.3.9.4 vs lib/cucumber/formatter/html.rb in aslakhellesoy-cucumber-0.3.9.5

- old
+ new

@@ -14,13 +14,17 @@ include Duration def initialize(step_mother, io, options) super(step_mother) @options = options - @builder = Builder::XmlMarkup.new(:target => io, :indent => 2) + @builder = create_builder(io) end + def create_builder(io) + Builder::XmlMarkup.new(:target => io, :indent => 2) + end + def visit_features(features) # <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @builder.declare!( :DOCTYPE, :html, @@ -87,10 +91,11 @@ def visit_background_name(keyword, name, file_colon_line, source_indent) @listing_background = true @builder.h3 do |h3| @builder.span(keyword, :class => 'keyword') + @builder.text!(' ') @builder.span(name, :class => 'val') end end def visit_feature_element(feature_element) @@ -106,10 +111,11 @@ def visit_scenario_name(keyword, name, file_colon_line, source_indent) @listing_background = false @builder.h3 do @builder.span(keyword, :class => 'keyword') + @builder.text!(' ') @builder.span(name, :class => 'val') end end def visit_outline_table(outline_table) @@ -125,11 +131,15 @@ super(examples) end end def visit_examples_name(keyword, name) - @builder.h4("#{keyword} #{name}") + @builder.h4 do + @builder.span(keyword, :class => 'keyword') + @builder.text!(' ') + @builder.span(name, :class => 'val') + end end def visit_steps(steps) @builder.ol do super @@ -179,11 +189,11 @@ end end def visit_py_string(string) @builder.pre(:class => 'val') do |pre| - pre << string + @builder.text!(string) end end def visit_table_row(table_row) @row_id = table_row.dom_id @@ -219,9 +229,10 @@ def build_step(keyword, step_match, status) step_name = step_match.format_args(lambda{|param| %{<span class="param">#{param}</span>}}) @builder.div do |div| @builder.span(keyword, :class => 'keyword') + @builder.text!(' ') @builder.span(:class => 'step val') do |name| name << h(step_name).gsub(/&lt;span class=&quot;(.*?)&quot;&gt;/, '<span class="\1">').gsub(/&lt;\/span&gt;/, '</span>') end end end