diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-03-26 12:44:14 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-03-26 12:44:14 +0000 |
commit | cb9a6b2b4f3d5b79e12e97a4ef9e75190803606a (patch) | |
tree | b9c5e0f8d3b1d32a465cc51f10676458c0659bc9 /lib/rbot/core/utils/extends.rb | |
parent | a3cf806450893638f98096ab96c4c25023bb01c3 (diff) |
Utils: more first par enhancements
Diffstat (limited to 'lib/rbot/core/utils/extends.rb')
-rw-r--r-- | lib/rbot/core/utils/extends.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb index 7022fb91..0ecf7aa2 100644 --- a/lib/rbot/core/utils/extends.rb +++ b/lib/rbot/core/utils/extends.rb @@ -41,18 +41,24 @@ class ::String def ircify_html txt = self + # remove scripts + txt.gsub!(/<script(?:\s+[^>]*)?>.*?<\/script>/im, "") + + # remove styles + txt.gsub!(/<style(?:\s+[^>]*)?>.*?<\/style>/im, "") + # bold and strong -> bold - txt.gsub!(/<\/?(?:b|strong)\s*>/, "#{Bold}") + txt.gsub!(/<\/?(?:b|strong)(?:\s+[^>]*)?>/im, "#{Bold}") # italic, emphasis and underline -> underline - txt.gsub!(/<\/?(?:i|em|u)\s*>/, "#{Underline}") + txt.gsub!(/<\/?(?:i|em|u)(?:\s+[^>]*)?>/im, "#{Underline}") ## This would be a nice addition, but the results are horrible ## Maybe make it configurable? # txt.gsub!(/<\/?a( [^>]*)?>/, "#{Reverse}") # Paragraph and br tags are converted to whitespace - txt.gsub!(/<\/?(p|br)\s*\/?\s*>/, ' ') + txt.gsub!(/<\/?(p|br)(?:\s+[^>]*)?\s*\/?\s*>/, ' ') txt.gsub!("\n", ' ') txt.gsub!("\r", ' ') |