diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-11 05:53:51 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-11 05:53:51 +0000 |
commit | d9878de310537cec9c9db889b453b36464aafbe2 (patch) | |
tree | e031f4bf2237cb8dc9d24e42099e8fbe29cc6ebe | |
parent | cbdd5e3f0330ebb1433223424adba6af52ea52d5 (diff) |
Requirements: document 'htmlentities' dependency-with-fallback
-rw-r--r-- | REQUIREMENTS | 5 | ||||
-rw-r--r-- | lib/rbot/core/utils/utils.rb | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/REQUIREMENTS b/REQUIREMENTS index 74fd26f6..5789d5fc 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS @@ -9,8 +9,13 @@ Core requirements net/https (for debian, this will also need libopenssl-ruby) socket uri + +Useful but fallback provided ruby-gettext 1.8.0+ http://www.yotabanana.com/hiki/ruby-gettext.html?ruby-gettext optional, if installed rbot can use localized messages + htmlentities http://htmlentities.rubyforge.org/ + optional, if missing rbot will use an internal table to decode + the most common HTML entities Plugin requirements (these are all optional, if you don't have them, the plugins just won't diff --git a/lib/rbot/core/utils/utils.rb b/lib/rbot/core/utils/utils.rb index a4f3ab8c..fe073c62 100644 --- a/lib/rbot/core/utils/utils.rb +++ b/lib/rbot/core/utils/utils.rb @@ -15,9 +15,9 @@ require 'tempfile' require 'set' +# Try to load htmlentities, fall back to an HTML escape table. begin require 'htmlentities' - $we_have_html_entities_decoder = true rescue LoadError gems = nil begin @@ -28,7 +28,6 @@ rescue LoadError if gems retry else - $we_have_html_entities_decoder = false module ::Irc module Utils UNESCAPE_TABLE = { @@ -396,7 +395,7 @@ module ::Irc def Utils.decode_html_entities(str) - if $we_have_html_entities_decoder + if defined? ::HTMLEntities return HTMLEntities.decode_entities(str) else str.gsub(/(&(.+?);)/) { |