AppleScript — maybe you’ve heard of it. In fact, if you’re reading my website, you’ve probably heard of it. What’s cool about AppleScript is basically what I have been known to say is cool about PHP; its a big spool of bungie cord and a bag of clip-on ends. But that’s entirely beside the point.

This very website is driven by a CMS, and I have a plugin installed that adds some source code formatting features. This plugin, unsurprisingly, doesn’t know much about AppleScript1 — so I added a really simple one myself. On my PowerBook, it worked perfectly — on the public webserver, it didn’t.

The reason why turned out to be fairly simple, but it was one of those “simple problems” that you can only find the next day and several meals later. The code formatting package the plugin is based on is a perl translation of an existing PHP package, but most of the syntax definitions haven’t been translated along with it yet.2 What’s more, of the small number of definitions present, half of them map to lousy search keywords.

That’s the thing — there are only about 6, one of them is the language the CMS is implemented in, another is a word that gets used in comments a lot, a third gets abbreviated to AS. Getting the picture?

So, to make a long story infinitesimally shorter, I picked one of the remaining definitions to find all the right places that my new syntax had to be registered in order to get used. By some strange coincidence, the C# binding (a.k.a., “csharp”), which I used as an example, was the newest of the lot, and itself wasn’t registered in all the right places, given the way I use everything.

So, by copying the registration details from one non-functional syntax, as if by magic, my new syntax was also non-functional. Yay!

Someday soon, when I’m feeling less cynical, there will be another Cookbook entry on this, with more technical details, probably including my lame syntax definition, and connected to the upstream source so this all gets fixed.

  1. Hey, its cool, but how many people have the good sense to own a Mac? []
  2. Don’t get me wrong, there are an awful lot of them. []

Movable Type | Permalink | No Comments