lib/wunderbar/node.rb in wunderbar-0.22.1 vs lib/wunderbar/node.rb in wunderbar-0.22.2

- old
+ new

@@ -11,10 +11,11 @@ "'" => '&apos;', '&' => '&amp;', '"' => '&quot;', '<' => '&lt;', '>' => '&gt;', + "\u00A0" => '&#xA0;', } def initialize(name, *args) @name = name @text = nil @@ -71,21 +72,21 @@ attrs.each do |name, value| next unless value name = name.to_s.gsub('_','-') if Symbol === name value=name if value==true - line += " #{name}=\"#{value.to_s.gsub(/[&\"<>]/,ESCAPE)}\"" + line += " #{name}=\"#{value.to_s.gsub(/[&\"<>\u00A0]/,ESCAPE)}\"" end if children.empty? if options[:pre] line += ">#{options[:pre]}#{text}#{options[:post]}</#{name}>" else width = options[:width] unless preserve_spaces? if text - line += ">#{text.to_s.gsub(/[&<>]/,ESCAPE)}</#{name}>" + line += ">#{text.to_s.gsub(/[&<>\u00A0]/,ESCAPE)}</#{name}>" elsif VOID.include? name.to_s line += "/>" else line += "></#{name}>" end @@ -213,13 +214,13 @@ super(nil, *args) end def serialize(options, result, indent) if options[:space] == :preserve - result << @text.to_s.gsub(/[&<>]/,ESCAPE) + result << @text.to_s.gsub(/[&<>\u00A0]/,ESCAPE) else - result << @text.to_s.gsub(/[&<>]/,ESCAPE).gsub(/\s+/, ' ') + result << @text.to_s.gsub(/[&<>\u00A0]/,ESCAPE).gsub(/\s+/, ' ') end end end class IndentedTextNode < TextNode @@ -245,10 +246,10 @@ else text = @text end result.push *IndentedTextNode.reflow(indent, - text.to_s.gsub(/[&<>]/,ESCAPE), options[:width]) + text.to_s.gsub(/[&<>\u00A0]/,ESCAPE), options[:width]) end end class ScriptNode < CDATANode def pre; "//<![CDATA["; end