mhonarc-users

Graphics for smileys

1999-01-25 16:59:36
Dear All!

I just made a small hack on the mhtxtplain filter to insert a small
graphic for the most common internet smileys.
I apologize if someone has posted a better solution than this before, I
couldn't find anything in the archives.

In guideline A.1 of the W3C working draft on Page Authoring Guidelines,
it is recommended that ASCII art is replaced with an image with
alternative text. This was part of my motivation for doing this hack. 

It is yet very much a hack, so it should be used with caution. It would
be nice to have a list of such emoticons and their mapping to images and
alternative text. 

I included the procedure 

##---------------------------------------------------------------------------##

sub make_smileys {
    local($str) = shift;
    $str =~ s/:-\)|\(-:|:\)|\;-\)|\;\)/<IMG SRC=\"\/icons\/smiley.gif\"
ALT=\"(Internet smiley, indicates irony or humor)\">/g;
    $str;
}

and called it by saying:
    $data = &make_smileys($data); 
just before URLs are converted by hyperlinks.

This may not be very elegant programming, I'm not that experience at it,
but it works for me, and I thought it may be useful.

Friendly Tiddely-pom,

Kjetil
-- 
Kjetil Kjernsmo
Graduate astronomy-student                    Problems worthy of attack
University of Oslo, Norway            Prove their worth by hitting back
E-mail: kjetikj(_at_)astro(_dot_)uio(_dot_)no                                - 
Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster(_at_)skepsis(_dot_)no

<Prev in Thread] Current Thread [Next in Thread>
  • Graphics for smileys, Kjetil Kjernsmo <=