Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace :spec do
RSpec::Core::RakeTask.new(:all) do |t|
t.verbose = false
t.pattern = 'spec/*_spec.rb'
t.rspec_opts = '-f documentation'
t.rspec_opts = '-f documentation -w'
end
end

Expand Down
34 changes: 17 additions & 17 deletions lib/html/mixin/html_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def modify_html(attribute, arg = nil)
if @html_begin.scan(/\b#{attribute}\b/).empty?
case arg
when Integer
@html_begin << " #{attribute}=#{arg}"
@html_begin += " #{attribute}=#{arg}"
when TrueClass
@html_begin << " #{attribute}"
@html_begin += " #{attribute}"
else
@html_begin << " #{attribute}='#{arg}'"
@html_begin += " #{attribute}='#{arg}'"
end
else
case arg
Expand All @@ -41,8 +41,8 @@ def modify_html(attribute, arg = nil)
#
def html(formatting = true)
if HTML::Table.html_case == 'upper'
@html_begin.upcase!
@html_end.upcase!
@html_begin = @html_begin.upcase
@html_end = @html_end.upcase
end

ilevel = 0
Expand All @@ -57,12 +57,12 @@ def html(formatting = true)

if is_a?(Array)
if formatting
html << map { |e| "\n#{e.html(formatting)}" }.join
html += map { |e| "\n#{e.html(formatting)}" }.join
else
html << map { |e| e.html(formatting).to_s }.join
html += map { |e| e.html(formatting).to_s }.join
end
else
html << @html_body
html += @html_body
end

#####################################################################
Expand All @@ -78,37 +78,37 @@ def html(formatting = true)
if self.class.respond_to?(:end_tags?)
if formatting
if self.class.end_tags?
html << ("\n" << (' ' * ilevel) << @html_end)
html += ("\n" + (' ' * ilevel) + @html_end)
end
else
html << ((' ' * ilevel) << @html_end) if self.class.end_tags?
html += ((' ' * ilevel) + @html_end) if self.class.end_tags?
end
else
if formatting
html << ("\n" << (' ' * ilevel) << @html_end)
html += ("\n" + (' ' * ilevel) + @html_end)
else
html << ((' ' * ilevel) << @html_end)
html += ((' ' * ilevel) + @html_end)
end
end
else
unless self.class.respond_to?(:end_tags?)
if formatting
html << ("\n" << (' ' * ilevel) << @html_end)
html += ("\n" + (' ' * ilevel) + @html_end)
else
html << ((' ' * ilevel) << @html_end)
html += ((' ' * ilevel) + @html_end)
end
end
end
else
if HTML::Table.global_end_tags?
if self.class.respond_to?(:end_tags?)
html << @html_end if self.class.end_tags?
html += @html_end if self.class.end_tags?
else
html << @html_end
html += @html_end
end
else
unless self.class.respond_to?(:end_tags?)
html << @html_end
html += @html_end
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions lib/html/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ def self.html_case
#
def self.html_case=(arg)
expect(arg, String)
arg.downcase!
unless %w[upper lower].include?(arg)
unless %w[upper lower].include?(arg.downcase)
msg = "Argument to html_case() must be 'upper' or 'lower'"
raise ArgumentError, msg
end
Expand Down