Jun
3
Making Radio emit XHTML
Filed Under Wikis, Weblogs and Outliners |
I’ve spent most of today trying to get Radio to output XHTML. This is decidedly non-trivial, and I still haven’t managed it. Most of it was quite straight-forward editing of the default templates, but there are a variety of things that I can’t manage to control.
Most of the images that get inserted (the coffee mug, XML button etc) don’t have the empty element closing slash. I could theoretically replace these calls with explicit links, but that doesn’t seem to be the correct approach.
More seriously, each post listed has 3 spurious <P> tags after it. Trying to work out how to fix this led to an interesting voyage through the Radio macro system. To play with it, I decided firstly to rewrite the recentPosts macro (mainly because I didn’t like the US-centric date format!)
I’m sure there’s a sensible way to find the source code of the built-in macros, but I couldn’t find one, so I ended up creating a page with a call to the macro omitting the brackets - which dumps the source of the macro in your page, rather than executing it. This doesn’t always render well, but in this case it was fairly straightforward.
Editing it, however, was a highly frustrating experience. If I made the smallest mistake in the code (e.g. not realising that you often need a space before an opening bracket) the whole thing would stop working and give me a decidedly non-helpful error. [Macro error: Can't call the script because the name "myRecentPosts" hasn't been defined.]
It may have been easier if I could bring myself to code in Radio’s inbuilt script editor, but I was having a hard enough time adjusting to the language syntax without having to try to work out how to write it in an outliner as well! I eventually discovered that if you used the Quick Script editor it would at least show you where your errors were…
But I eventually got it working, and went in search of the macro which inserts the blog entries one by one. This seems to be radio.weblog.render (), but that doesn’t contain the offending tags.
So now I’m lost.