steve8x8 / geotoad

Geocaching query tool written in Ruby
https://buymeacoffee.com/steve8x8
Other
28 stars 8 forks source link

Translate smileys back from <img...> to [...] notation #265

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, log entries often contain <img> tags for smileys, usually with a 
relative URL.
To ensure non-HTMLness of log entries (as much as possible, with the Ruby 1.9 
transition in mind which will allow to output proper UTF-8), it seems 
reasonable to replace the <img> tags with their "BB" equivalent, e.g. 
icon_smile_big.gif becomes [:D] as shown in /about/smilies.aspx on the GC site.
So basically I suggest to

  comment.gsub(/<img.*icon_smile(.*?)\.gif[^>]*>/) { iconmap[$1] }
with

iconmap[] = {
"" => '[:)]',
"_angry" => '[:(!]',
"_approve" => '[^]',
"_big" => '[:D]',       #big smile
"_blackeye" => '[B)]',      #black eye
"_blush" => '[:I]',
"_clown" => '[:o)]',
"_cool" => '[8D]',
"_dead" => '[xx(]',
"_dissapprove" => '[V]',    #disapprove
"_8ball" => '[8]',      #eightball
"_evil" => '[}:)]',
"_sad" => '[:(]',       #frown
"_kisses" => '[:X]',
"_question" => '[?]',
"_shocked" => '[:O]',
"_shy" => '[8)]',
"_sleepy" => '[|)]',
"_tongue" => '[:P]',
"_wink" => '[;)]',
}

Consequently, all remaining <img> tags should be completely removed...
Opinions?

Original issue reported on code.google.com by Steve8x8 on 28 Mar 2013 at 12:56

GoogleCodeExporter commented 9 years ago
What about the appended patch?
(I'm supplying two patches, one against latest branch with the patch for issue 
264 in place - and one against trunk which currently doesn't have this fix.)

Original comment by Steve8x8 on 28 Mar 2013 at 1:25

Attachments:

GoogleCodeExporter commented 9 years ago
To be included in 3.16.6 (due next week)

Original comment by Steve8x8 on 18 Apr 2013 at 1:25

GoogleCodeExporter commented 9 years ago
Since 3.16.7 is out now, and there have been no regressions reported: Closing.

Original comment by Steve8x8 on 13 May 2013 at 10:26