summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/dict.rb2
-rw-r--r--lib/rbot/core/utils/extends.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/data/rbot/plugins/dict.rb b/data/rbot/plugins/dict.rb
index 6d35bd65..ca5f2588 100644
--- a/data/rbot/plugins/dict.rb
+++ b/data/rbot/plugins/dict.rb
@@ -115,7 +115,7 @@ class DictPlugin < Plugin
if h and h.match(%r!<h2>#{word}(?:<sup>1</sup>)?</h2>!)
m.reply("#{word} : #{url}") unless justcheck
defn = $'
- m.reply("#{Bold}%s#{Bold}: %s" % [word, defn.ircify_html], :overlong => :truncate)
+ m.reply("#{Bold}%s#{Bold}: %s" % [word, defn.ircify_html(:nbsp => :space)], :overlong => :truncate)
return true
end
}
diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb
index dcc257a2..4e5459d8 100644
--- a/lib/rbot/core/utils/extends.rb
+++ b/lib/rbot/core/utils/extends.rb
@@ -144,6 +144,14 @@ class ::String
# such as &nbsp;
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')