New Message: opmlBlogroll issues

webmaster at userland.com webmaster at userland.com
Mon May 30 17:15:09 CDT 2005


A new message was posted:

Address: http://manila.userland.com/discuss/msgReader$991

By: Matt Deatherage (frontier at gcsf.com)

If an OPML file contains valid shortcuts (in quotation marks), the opmlBlogroll macro renders them even if flProcessMacros is false. This is the opposite of how it works in includeMessage and other places that flProcessMacros is used. I think it's because opmlBlogroll just returns the quoted text, and the shortcuts get processed at some point after that, but I'm largely making that up because it sounds good.

I'm actually OK with that, since I think by default, shortcuts should be rendered. However, they're not rendered until the very end of the rendering process (in html.data.standardMacros.opmlBlogroll), so the code puts the "non-linked text" CSS style around all of the shortcut links. I don't know if the OPML renderer expects URLs to be in their own attribute, or what, but I don't think it should be applying the "non-link" style around links. I have a hunch I could fix this by adding something like string.processHTMLMacros to the outline before it's passed to xml.compile, but not enough of a hunch to spend a few hours trying it.

Also, as long as I'm in here, the documentation [1] says that the OPML file is cached for one hour, but this line:

if clock.now () date (adrincache^.whenLastSizeCheck + cacheSeconds) //only check size if cache is expired

..really makes me think that it's cached for one /minute/, especially since the first line of the script sets cacheSeconds to 60.

A one-hour cache really makes debugging an OPML rendering difficult, anyway, so it would be better to document that we can pass our own value of cacheSeconds to avoid caching problems.

And, for that matter, if you're caching the compiled XML file for an hour, why not cache the rendered HTML as well, especially if flProcessMacros is false? If you're not rendering macros or shortcuts, the rendered HTML text isn't going to change unless the file does. If you're not re-reading the file, why bother re-rendering it every time the page is displayed? This could save a lot of computational time for sites that use opmlBlogroll in a page template, like in a sidebar.

If flProcessMacros is true, you could compare the result of html.processMacros(htmltext) to the original htmltext. If they're identical, nothing got processed, and you can safely cache the result as long as you cache the OPML file.

[1] http://macros.userland.com/basic/opmlBlogroll

This is a Manila site.. http://manila.userland.com/.




More information about the Manila-Users mailing list