I’ve got a couple requests to post the mechanism that I use to create the poker hands on my blog. The system below will work with Movable Type (deployed on 2.6x), but some of the concepts may be applicable for other blog systems. This comes with no warranty, but I’ll try to help. If you screw up your blog, you did it on your own. Please try to understand a little bit about what is going on, if you have any questions, please ask before you screw things up 
The whole point of this is to be able to do something like: <pokerhand>AsKcQdTh</pokerhand> and get
AsKcQdTh.
In order for this to work for Movable Type, you will first need to install a couple of plug-ins:
I first added the CSS needed to format the entries. I like the four color decks so I made my suits look like that (obviously you can change this to whatever you want). You should add this to your Stylesheet template:
.diamonds { color: blue }
.clubs { color: green; }
.hearts { color: red; }
.spades { color: black; }
Next, if you don’t already have one, you need to create a new template to hold your new macro. Go to your config, then to “Templates” and create a new “Template Module”. I called mine “Misc”. You do not need to link this to a file. In the “Module Body”, enter the following macro:
<MTMacroDefine name=”pokerhand” tag=”pokerhand”>
<MTPerlScript>
$ret = “”;
$diams = qq(<?php echo \$diamonds ?>);
$clubs = qq(<span class=”clubs”>♣</span>);
$hearts = qq(<span class=”hearts”>♥</span>);
$spades = qq(<span class=”spades”>♠</span>);
@a = split(//,”<MTMacroContent>”);
foreach (@a) {
if ($_ eq “d”) {
$ret .= $diams;
} elsif ($_ eq “c”) {
$ret .= $clubs;
} elsif ($_ eq “h”) {
$ret .= $hearts;
} elsif ($_ eq “s”) {
$ret .= $spades;
} else {
$ret .= $_;
}
}
print $ret;
</MTPerlScript>
</MTMacroDefine>
What this does is create a new HTML tag called “pokerhand” (rename the “ctag” if you want it something else). You’ll notice that the code for the diamonds is actually PHP. The reason for this is that Internet Explorer sucks in terms of CSS support and has a major issue showing the ♦ symbol if you have any other text formatting in place. Thanks to The Fat Guy for letting me know about this as I only use Mozilla and didn’t notice anything was wrong.
I have MT save out my pages as PHP so that I can add arbitrary PHP code. I am using this for the browser detection and part of this macro. For a comprehensive howto on converting to PHP, see: Converting MT to PHP.
I created another Template Module called “PHP Functions” and linked that to a file called “vars.php”. In order to work around the IE issue, I added some cheap browser detection in the “Module Body” of the template:
<?php
if (preg_match(”/MSIE/i”,$_SERVER[HTTP_USER_AGENT])) {
$isIE = 1;
} else {
$isIE = 0;
}
if ($isIE) {
$diamonds = ‘<font color=”blue” face=”Symbol”>¨</font>’;
} else {
$diamonds = ‘<span style=”color: blue;”>♦</span>’;
}
?>
If you would prefer to use JavaScript instead of PHP, add the following to the top of your page (or in a JavaScript include):
<script language=”javascript” type=”text/javascript”>
var isIE, diamonds;
if (navigator.appName.indexOf(”Microsoft”) >= 0) {
isIE = 1;
} else {
isIE = 0;
}
if (isIE) {
diamonds = ‘<font color=”blue” face=”Symbol”>&168;<font>’;
} else {
diamonds = ‘♦’;
}
You must then change the Perl program where the diams variable is set:
$diams = qq(<script language=”javascript” type=”text/javascript”>document.write(diamonds);<script>);
Now you must edit the templates that are used to display the articles, index, archives, etc.
At a minimum (in order to allow the processing of the macro, and to include it), you must add the following to your template:
<MTInclude module=”Misc”>
Replacing “Misc” with whatever you called your module.
You will also need to modify the part of the template that called MTEntryBody to look like:
<$MTEntryBody apply_macros=”1″ process_tags=”1″$>
The “apply_macros” and “process_tags” allow the macros to be parsed.
To include the PHP code, you must also add the following to your templates:
<?php include ‘/full/path/to/vars.php’; ?>
This allows the diamonds symbol to work correctly with both IE and Mozilla by dynamically replacing which one it uses. In order to ensure this works with multiple directories, you must put the full path to the file.
Now you need to rebuild your site. In theory everything should work, it is for me 
It seems fairly involved, but it’s just a lot of small steps. The biggest hurdle may be that if you don’t already use PHP then this will not work as expected. Changing to another extention if you already have an extablished blog could be difficult.
Hope this helps. You should be able to glean some help for other systems or modify it to you own. If you have any questions, send me an email or leave a comment so others can get something out of it too.