summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorYaohan Chen <yaohan.chen@gmail.com>2007-07-24 22:16:55 +0000
committerYaohan Chen <yaohan.chen@gmail.com>2007-07-24 22:16:55 +0000
commit4d25b749c765dd6c2d88f3be961d3249de2c7000 (patch)
tree35682b80026c856736b82224aabcc971a213a97c /data
parent98dde0dfe318d01e108acaed2413cc842a907b12 (diff)
* dictclient: adjusted output format
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/dictclient.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/data/rbot/plugins/dictclient.rb b/data/rbot/plugins/dictclient.rb
index 2cd782ce..910583ff 100644
--- a/data/rbot/plugins/dictclient.rb
+++ b/data/rbot/plugins/dictclient.rb
@@ -42,7 +42,12 @@ class ::Definition
end
def body
- definition[1..-1].join.gsub(/\s+/, ' ').strip
+ # two or more consecutive newlines are replaced with double spaces, while single
+ # newlines are replaced with single spaces
+ lb = /\r?\n/
+ definition[1..-1].join.
+ gsub(/\s*(:#{lb}){2,}\s*/, ' ').
+ gsub(/\s*#{lb}\s*/, ' ').strip
end
end
@@ -127,7 +132,7 @@ class DictClientPlugin < Plugin
).gsub(
'<definition>', r.body.truncate(@bot.config['dictclient.max_length_per_def'])
)
- }.join ' '
+ }.join ' | '
end
else
_("No definition for %{phrase} found from %{database}.") %
@@ -162,7 +167,7 @@ class DictClientPlugin < Plugin
def cmd_databases(m, params)
with_dict(m) do |d|
m.reply _("Databases: %{list}") % {
- :list => d.show_db.collect {|db, des| "#{format_database db}: #{des}"}.join('; ')
+ :list => d.show_db.collect {|db, des| "#{format_database db}: #{des}"}.join(' | ')
}
end
end
@@ -170,7 +175,7 @@ class DictClientPlugin < Plugin
def cmd_strategies(m, params)
with_dict(m) do |d|
m.reply _("Strategies: %{list}") % {
- :list => d.show_strat.collect {|s, des| "#{s}: #{des}"}.join('; ')
+ :list => d.show_strat.collect {|s, des| "#{s}: #{des}"}.join(' | ')
}
end
end