Blaze blogger emoticons


In my original Markdown setup I had some smilies, or emoticons, defined that could be used in the posts. As Python Markdown lacks that I decided to hack it into BlazeBlogger. The only reason being that I can hack Perl and I can’t hack Python.

In the .blaze/config I now have an option called smilies that points to the top of the directory containing all smiley images. If this option is not defined the smiley conversion is skipped.

The option looks like this:

smilies=/images/smilies

and the code hacked into blaze-make.pl is:

sub convert_smilies {
    #
    # Change the smiley ascii's to picts
    #
    my $text  = shift;
    my $smurl = $conf->{blog}->{smilies} || return $text;
    $smurl: '<img class="smiley" alt="smiley" src="' . $smurl;

    my %smilies = (
    ':-\)',  'regular_smile.gif',   ':-\D',  'teeth_smile.gif',
    ':-\O',  'omg_smile.gif',       ':-\P',  'tongue_smile.gif',
    ';-\)',  'wink_smile.gif',      ':-\(',  'sad_smile.gif',
    ':-\S',  'confused_smile.gif',  ':-\|',  'what_smile.gif',
    ':\'\(', 'cry_smile.gif',       ':-\$',  'red_smile.gif',
    '\(H\)', 'shades_smile.gif',    ':-\@',  'angry_smile.gif',
    '\(A\)', 'angel_smile.gif',     '\(6\)', 'devil_smile.gif',
    ':-\#',  '47_47.gif',           '8o\|',  '48_48.gif',
    '8-\|',  '49_49.gif',           '\^o\)', '50_50.gif',
    ':-\*',  '51_51.gif',           '\+o\(', '52_52.gif',
    ':\^\)', '71_71.gif',           '\*-\)', '72_72.gif',
    '\<:o\)','74_74.gif',           '8-\)',  '75_75.gif',
    '\|-\)', '77_77.gif',           '\(C\)', 'coffee.gif',
    '\(Y\)', 'thumbs_up.gif',       '\(N\)', 'thumbs_down.gif',
    '\(B\)', 'beer_mug.gif',        '\(D\)', 'martini.gif',
    '\(X\)', 'girl.gif',            '\(Z\)', 'guy.gif',
    '\(\{\)','guy_hug.gif',         '\(\}\)','girl_hug.gif',
    '\:-\[', 'bat.gif',             '\(^\)', 'cake.gif',
    '\(L\)', 'heart.gif',           '\(U\)', 'broken_heart.gif',
    '\(K\)', 'kiss.gif',            '\(G\)', 'present.gif',
    '\(F\)', 'rose.gif',            '\(W\)', 'wilted_rose.gif',
    '\(P\)', 'camera.gif',          '\(\~\)','film.gif',
    '\(\@\)','cat.gif',             '\(\&\)','dog.gif',
    '\(T\)', 'phone.gif',           '\(I\)', 'lightbulb.gif',
    '\(8\)', 'note.gif',            '\(S\)', 'moon.gif',
    '\(\*\)','star.gif',            '\(E\)', 'envelope.gif',
    '\(O\)', 'clock.gif',           '\(sn\)','53_53.gif',
    );

    my $tag;
    foreach $tag (keys %smilies)
    {
        $text =~ s!$tag!$smurl/$smilies{$tag}\" />!g;
    }

    return $text;
}

and add it to the functions generate_posts and read_entry.

This list is already rather long, and I do think it’s not a very good idea to make it longer. It will seriously impact the performance.

blog 

See also