categories:
.
#title "opmlRender"
#opmlStory "http://radio.weblogs.com/0104487/gems/opml/opmlRender.opml"
#renderOutlineWith "activeRenderer"
What is opmlRender ?
opmlRender is a UserTalk macro command that renders, or translates, an OPML outline into HTML.
Why use it at all ?
I find it easier to manage some of the content published in a Radio weblog as outline files.
Some of those outlines are rendered directly in s l a m 's #homeTemplate file.
The headlines, home, tracks and resources sections for instance, are all outlines.
I created those outlines directly in Radio, and saved them as opml documents (Radio's default format for external outlines).
Installing opmlRender.
Simple enough, just save a copy of opmlRender as a text file in your Radio application Macros folder.
If you're a user of activeRenderer, opmlRender is part of the tool, it is already installed. Neat uh ?
How does it work ?
Insert <% opmlRender ( "url" ) %> anywhere you want the "url" outline to be rendered.
"url" must be a regularly formed uniform resource locator for the outline to render.
A local url uses the file:// header. It could be something like: file:///C/Program%20files/Radio%20UserLand/www/instantOutliner/yourOutline.opml.
A remote url uses the http:// header. As in http://radio.weblogs.com/0104487/instantOutliner/marcBarrot.opml.
The style of the html that opmlRender outputs can be customized using Cascading Style Sheets.
Every node in the outline is rendered in a paragraph with a CSS class attribute.
The default class name used by opmlRender is "l" (lowercase l), a bit terse maybe :-)
You can substitude any other name by supplying a name string as the second argument to opmlRender.
For instance : <% opmlRender ( "file:///Data/Marc/Radio%20UserLand/www/gems/opml/tracks.opml", "track" ) %>.
There's a catch: the string you supply, or the default "l" string, is not rendered directly as class="string".
The macro adds a suffix, which is the level in the outline of the node being rendered. All outline summits are at level 1, their children are at level 2, and so on.
This very node of the opmlRender outline is rendered as a class="story5" paragraph (I entered <% opmlRender ( "file:///Data/Marc/Radio%20UserLand/www/gems/opml/opmlRender.opml", "story" ) %> in the story text for the html version of this tutorial - still with me :-) ?
You've got to provide for the matching CSS style definitions in the header part of the file where you insert opmlRender macros.
I inserted the following line in the <header> section of the template for this (and all) stories:
<link rel="stylesheet" type="text/css" href="http://radio.weblogs.com/0104487/gems/css/stories.css">
The stories.css file is where all styling rules are specified.
It gets worse, you can specify an optional third parameter to opmlRender, that defines the way the outline is expanded before rendering.
If you do not specify a third parameter, or enter false (or 0), the outline is rendered as it was saved: collapsed nodes are not visible and skipped entirely in the rendered version.
If you enter true, or 1, as third parameter, all the outline nodes are fully expanded before rendition.
The fourth and fifth optional parameters are specially useful if you've specified true as third argument.
I promise, those are the last ones :-)
The 4th optional argument is the maximum depth level rendered in the outline.
It defaults to 0, no limit.
If an outline has a depth of 4 levels, but opmlRender's 4th argument is 2, all nodes of level 3 and 4 are ignored at rendering time.
The 5th optional argument is the maximum number of summit (level 1) nodes rendered in the outline.
It defaults to 0, no limit as well.
If an outline includes 4 summits, but opmlRender's 5th argument is 2, only the first 2 summits and their children are rendered, the remaining 2 are ignored.
Some additional examples.
The headlines section at the top of s l a m 's home page :
<% opmlRender ( "file:///Data/Marc/Radio%20UserLand/www/gems/opml/headlines.opml", "headline", true, 2, 1 ) %>
The resources section in s l a m 's home page :
<% opmlRender ( "file:///Data/Marc/Radio%20UserLand/www/gems/opml/resources.opml", "track", true, 3, 0 ) %>
Dave Winer's instant outline, in HTML attire, why not :-)
<% opmlRender ( "http://radio.weblogs.com/0001015/instantOutliner/daveWiner.opml" ) %>
Credits
The opmlRender macro was born 'renderCss' quite some time ago.
renderCss was based on some interesting work by Carlos Granier and Andy Fragen.
in the story text for the html version of this tutorial - still with me :-) ?activeRenderer Version 1.4 Released
Now Renders RSS Feeds - Includes New Outline Browser
11/16/02; 10:55:02 AM by DW
Working on an issue reported by Roger Turner on Radio-Dev list.
In xml.rss.compileService, our support for guids and permalinks is horribly confused. The confusion doesn't show up in Radio-generated RSS files, not surprising, but did show up in this feed, http://www.raibledesigns.com/rss/rd, which is a correct feed, the problem is with our code.
The first problem is when isPermalink is explicitly present as an attribute. You can't just dereference adrguid to get the value of the permalink. If you do, you get a table with a /atts and a /pcdata. A permalink should be a URL. It's a lot simpler.
The second problem is if it's not a permalink. Hey, we're still supposed to respect the guid. I'll deal with that fix second.
11/15/02; 1:21:10 PM by DW
Working on restoring from backups.
11/14/02; 12:10:34 PM by DW
To do
Allow the user to provide a list of addresses that we'll back up (in an outline).
Figure out how and when to run backup script. Certainly need a prefs page for backup.
Optimize the monthly posts backup -- if nothing has changed in a given month (the usual thing) don't write a new file and force an upstream. Done.
New things we're backing up
user.prefs (but not user.prefs.serialnumber)
user.bookmarksmenu
weblog posts now have a
Things I'm not comfortable backing up
1. workspace.notepad -- there could be tons of confidential info in there. I don't want to back it up automatically.
2. callbacks tables -- the addresses likely don't work on the second machine. I'm going to leave these for round two.
Parts
radio.data.folderNames.wwwBackupsSubFolderName
radio.backup
11/13/02; 5:52:15 PM by DW
What I'm working on
The backup side of a backup and restore system for Radio 8.
If you want to do a code review, check it out..
http://radio.weblogs.com/0001015/userland/scratchpad/radio.backup.fttb
11/9/02; 7:33:36 AM by DW
11/5/02; 10:25:14 AM by DW
10/20/02; 10:37:38 AM by DW
10/20/02; 9:52:27 AM by DW
10/14/02; 10:15:44 AM by DW
8/29/02; 6:15:31 PM by DW

