summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-05 14:20:00 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-05 14:20:00 +0000
commit7232ed56774f9bfc89e4a31d486fa2f82bdec1ec (patch)
tree441f3755c48d5904635c453377fdb901c367a45c
parent9c98ff2e3e6dbf13eb650bff91b49b37594ca4b9 (diff)
HTML IRCification: try to handle super and subscripts
-rw-r--r--lib/rbot/core/utils/extends.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb
index ff9d0f35..4b7e57f3 100644
--- a/lib/rbot/core/utils/extends.rb
+++ b/lib/rbot/core/utils/extends.rb
@@ -61,6 +61,12 @@ class ::String
txt.gsub!("\n", ' ')
txt.gsub!("\r", ' ')
+ # Superscripts and subscripts are turned into ^{...} and _{...}
+ # where the {} are omitted for single characters
+ txt.gsub!(/<sup>(.*?)<\/sup>/, '^{\1}')
+ txt.gsub!(/<sub>(.*?)<\/sub>/, '_{\1}')
+ txt.gsub!(/(^|_)\{(.)\}/, '\1\2')
+
# All other tags are just removed
txt.gsub!(/<[^>]+>/, '')