X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fdict.rb;h=c9bfabafadef5fb75491d6590f492d7ec8caa48a;hb=c79880731ad9335af4832d2b2f2505fa1fa03671;hp=edadd3c7cbb877a08ad104af2d8ff66280c46006;hpb=e974d55bd3acfabde77f4e19b305d5445ea6df90;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/dict.rb b/data/rbot/plugins/dict.rb index edadd3c7..c9bfabaf 100644 --- a/data/rbot/plugins/dict.rb +++ b/data/rbot/plugins/dict.rb @@ -53,8 +53,8 @@ class DictPlugin < Plugin def initialize super - @dmurl = "http://www.demauroparavia.it/" - @dmurlrx = %r{http://(?:www\.)?demauroparavia\.it/(\d+)} + @dmurl = "http://old.demauroparavia.it/" + @dmurlrx = %r{http://(?:www|old\.)?demauroparavia\.it/(\d+)} @dmwapurl = "http://wap.demauroparavia.it/index.php?lemma=%s" @dmwaplemma = "http://wap.demauroparavia.it/lemma.php?ID=%s" @oxurl = "http://www.askoxford.com/concise_oed/%s" @@ -112,7 +112,8 @@ class DictPlugin < Plugin text += entries[0...hits].map { |ar| n += 1 urls << @dmwaplemma % ar[2] - "#{n}. #{Bold}#{ar[0]}#{Bold} - #{ar[1].gsub(/<\/?em>/,'')}: #{@dmurl}#{ar[2]}" + key = ar[1].ircify_html + "#{n}. #{Bold}#{ar[0]}#{Bold} - #{key}: #{@dmurl}#{ar[2]}" }.join(" | ") m.reply text @@ -140,9 +141,9 @@ class DictPlugin < Plugin url << "?view=uk" end h = @bot.httputil.get(url, :max_redir => 5) - if h and h.match(%r!

#{word}(?:1)?

!) + if h and h.match(/

#{word}<\/h2>(.*)Perform/m) m.reply("#{word} : #{url}") unless justcheck - defn = $' + defn = $1 m.reply("#{Bold}%s#{Bold}: %s" % [word, defn.ircify_html(:nbsp => :space)], :overlong => :truncate) return true end