Currency exchange for MovableType
I’ve written a regular expression using Brad Choate’s nifty MT-Regex plugin for MovableType. It turns the string “100 SEK” into this: “100 SEK.” It’s easy to modify the currencies you want to change from/to. Here’s the code:
<MTAddRegex name="currency">s|([0-9]+) <span style="color: red;">SEK</span>|$1 <acronym title="Swedish Crowns"><span style="color: red;">SEK</span></acronym> (<a href="http://www.exchangerate.com/quick_calculator.html?amount_from=$1&calc_short_from_iso=<span style="color: red;">SEK</span>&calc_short_to_iso=<span style="color: green;">USD</span>&Submit=Convert" title="Convert from SEK to USD">convert currency</a>)|g;</MTAddRegex>
Replace the red part with the ISO code for the currency you want to translate from, and the green one with the ISO code for the currency to translate to. You then place it in a template module (mine is called “RegExps”), and include it in your index or archive templates with “<$MTInclude module="RegExps"$>“. Then all that is left is to activate the module for the tag you want to apply it on like this: <$MTEntryBody regex="currency"$>.” And you’re done.
Note: you can’t see it in action if you syndicate my RSS feed, this regular expression isn’t run on the XML feeds. You’ll have to view the entry to see it.