diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-18 13:24:55 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-18 13:24:55 +0000 |
commit | ef60325fc646625ace71030b7ed2b55ff911a9f0 (patch) | |
tree | 9867fa52e07223c3c25b7929b18f916c1521e564 /lib/rbot | |
parent | 7ab3595d60d2232b003049686403ee8add8e547d (diff) |
extends: String#ircify_html now has an option to obey non-breakable spaces or turn them into normal spaces
This option is used e.g. by the dict plugin to reduce the excessive whitespace in oxford entries.
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/core/utils/extends.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 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') |