From 1d7ab28b2162db5c3a7b332a2f268d496b7c3c60 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 15 Oct 2006 08:12:59 +0000 Subject: Refine urban plugin output with bold, reverse and underline. If it's too much, we'll spartanize. --- data/rbot/plugins/urban.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/data/rbot/plugins/urban.rb b/data/rbot/plugins/urban.rb index 36c39077..95210b25 100644 --- a/data/rbot/plugins/urban.rb +++ b/data/rbot/plugins/urban.rb @@ -59,7 +59,21 @@ class UrbanPlugin < Plugin end def get_def(text) - Utils.decode_html_entities text.gsub(/(?:prev<\/a> )?home<\/a>(?: next<\/a>)?/,'').gsub(/<\/?p>/, ' ').gsub(/<.*?>/, '').gsub("\n", ' ').strip + # Start by removing the prev/home/next links + t = text.gsub(/(?:prev<\/a> )?home<\/a>(?: next<\/a>)?/,'') + # Close up paragraphs + t.gsub!(/<\/?p>/, ' ') + t.gsub!("\n", ' ') + # Reverse headings + t.gsub!(/<\/?b>/,"#{Reverse}") + # Enbolden links + t.gsub!(/<\/?a(?: .*?)?>/,"#{Bold}") + # Reverse examples + t.gsub!(/<\/?(?:i|em)>/,"#{Underline}") + # Clear anything else + t.gsub!(/<.*?>/, '') + + Utils.decode_html_entities t.strip end def uotd(m, params) -- cgit v1.2.3