]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/weather.rb
weather plugin: refactor HTML cleanup code
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / weather.rb
index 4ff92769b5c710f87aaca7ebe3d031f21536be89..c241daa832f0e8a97f7fd317592478006aca8c0a 100644 (file)
@@ -214,16 +214,20 @@ class WeatherPlugin < Plugin
     end
   end
 
-  def wu_weather_filter(stuff)
+  def wu_clean(stuff)
     txt = stuff
     txt.gsub!(/[\n\s]+/,' ')
-    data = Hash.new
     txt.gsub!(/&nbsp;/, ' ')
     txt.gsub!(/&#176;/, ' ') # degree sign
     txt.gsub!(/<\/?b>/,'')
     txt.gsub!(/<\/?span[^<>]*?>/,'')
     txt.gsub!(/<img\s*[^<>]*?>/,'')
     txt.gsub!(/<br\s?\/?>/,'')
+    txt
+  end
+
+  def wu_weather_filter(stuff)
+    txt = wu_clean(stuff)
 
     result = Array.new
     if txt.match(/<\/a>\s*Updated:\s*(.*?)\s*Observed at\s*(.*?)\s*<\/td>/)