]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/core/utils/extends.rb
extends: String#ircify_html now has an option to obey non-breakable spaces or turn...
[user/henk/code/ruby/rbot.git] / lib / rbot / core / utils / extends.rb
index dcc257a2df85330f073377ca95e38f21bf64250c..4e5459d850b2493e8435b6b4f545ce836b1c9f4d 100644 (file)
@@ -144,6 +144,14 @@ class ::String
     # such as  
     txt = Utils.decode_html_entities(txt)
 
+    # Keep unbreakable spaces or conver them to plain spaces?
+    case val = opts[:nbsp]
+    when :space, ' '
+      txt.gsub!([160].pack('U'), ' ')
+    else
+      warning "unknown :nbsp option #{val} passed to ircify_html" if val
+    end
+
     # Remove double formatting options, since they only waste bytes
     txt.gsub!(/#{Bold}(\s*)#{Bold}/, '\1')
     txt.gsub!(/#{Underline}(\s*)#{Underline}/, '\1')