Changeset 2414 for lang/ruby/ssb
- Timestamp:
- 12/04/07 17:05:18 (13 months ago)
- Files:
-
- 1 modified
-
lang/ruby/ssb/trunk/libs/ssb/emoji.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/ruby/ssb/trunk/libs/ssb/emoji.rb
r2306 r2414 40 40 41 41 # SJIS Binary 42 ret.gsub!(RE_IMODE_SJIS) do |s| 43 orig_match = $1 44 if not $2.nil? 45 sprintf '<img class="emoji" src="emoji/docomo/%X.gif" />', orig_match.unpack('n')[0] 46 else 47 orig_match 42 if term.get_carrier == KtaiSpec::CARRIER_DOCOMO 43 ret.gsub!(RE_IMODE_SJIS) do |s| 44 orig_match = $1 45 if not $2.nil? 46 sprintf '<img class="emoji" src="emoji/docomo/%X.gif" />', orig_match.unpack('n')[0] 47 else 48 orig_match 49 end 48 50 end 49 end50 51 51 # UTF8 BINARY 52 if term.get_carrier == KtaiSpec::CARRIER_DOCOMO and is_utf8 53 ret.gsub!(/./) do |c| 54 sjis = SSB::Emoji.docomo_uni2sjis("%X" % c.unpack("U")[0]) 55 sjis ? sprintf('<img class="emoji" src="emoji/docomo/%s.gif" />', sjis) : c 52 # UTF8 BINARY 53 if is_utf8 54 ret.gsub!(/./) do |c| 55 sjis = SSB::Emoji.docomo_uni2sjis("%X" % c.unpack("U")[0]) 56 sjis ? sprintf('<img class="emoji" src="emoji/docomo/%s.gif" />', sjis) : c 57 end 56 58 end 57 end58 59 59 # SJIS 10進数実体参照60 ret.gsub!(/&#([0-9]+);/) do |s|61 '<img class="emoji" src="emoji/docomo/' + $1.to_i.to_s(16).upcase + '.gif" />'62 end60 # SJIS 10進数実体参照 61 ret.gsub!(/&#([0-9]+);/) do |s| 62 '<img class="emoji" src="emoji/docomo/' + $1.to_i.to_s(16).upcase + '.gif" />' 63 end 63 64 64 # UNICODE 16進数実体参照 (とりあえず拡張絵文字だけ) 65 ret.gsub!(/(&#x([0-9a-zA-Z]+);)/) do |s| 66 code = 67 case ($2.hex) 68 when 0xE63E..0xE69B 69 # 4705 70 $2.hex + 4705 71 when 0xE69C..0xE6DA, 0xE6AC..0xE6BA 72 # 4772 73 $2.hex + 4772 74 when 0xE6DB..0xE70A, 0xE70C..0xE757 75 # 4773 76 $2.hex + 4773 65 # UNICODE 16進数実体参照 (とりあえず拡張絵文字だけ) 66 ret.gsub!(/(&#x([0-9a-zA-Z]+);)/) do |s| 67 code = 68 case ($2.hex) 69 when 0xE63E..0xE69B 70 # 4705 71 $2.hex + 4705 72 when 0xE69C..0xE6DA, 0xE6AC..0xE6BA 73 # 4772 74 $2.hex + 4772 75 when 0xE6DB..0xE70A, 0xE70C..0xE757 76 # 4773 77 $2.hex + 4773 78 else 79 $1 80 end 81 if code.is_a?(Integer) 82 '<img class="emoji" src="emoji/docomo/' + (code).to_s(16).upcase + '.gif" />' 77 83 else 78 $184 code 79 85 end 80 if code.is_a?(Integer)81 '<img class="emoji" src="emoji/docomo/' + (code).to_s(16).upcase + '.gif" />'82 else83 code84 86 end 85 87 end
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)