leah blogs

December 2005

18dec2005 · Marking up outlines: Tagged OPML

For a bigger school project I recently had to make some outlines. I used the OPML Editor for that, because it’s the only outliner I seriously can use (despite all efforts to write one for Emacs on my own, but more on that below). After all, it wasn’t a bad experience; the outlining is quick and straight-forward and just works. The keybindings are comparatively sane, and the OPML Editor is open source.

Then, I decided I would like to print out the outline. Hehe.

Of course, the OPML Editor doesn’t have a print function. I don’t even expect that actually. However, the only way to get your data out of it is the HTML export. Good, the HTML looks very basic, the HTML is very unclean ([Winer rant suppressed]) and invalid. I also needed to add a title because I had to turn it in.

Trying to do this the “Macintosh Way”… let’s copy the outline (essentially, a nested <ul>) from Safari and paste into Pages. The indentation got lost. Enough, let’s do it the “Unix Way” and edit the generated HTML on my own. I hacked some <h1> in there and quickly had it how I wanted it. Add some CSS styling and the thing is ready to print.

The next time I had to prepare a similar outline, I thought that the OPML Editor provides an almost perfect way to write. You can easily group related paragraphs and so on. All it lacks is a way to declare some outline entries to be shown as titles (and display them in a different style), or as block-quotes or similar. With a bit of thinking on, it would turn out to be a graphical Vooly editor.

I looked around if someone already had that idea (apparently not, which I think is interesting.) Essentially, what I wanted to do is tagging the OPML entries, and the OPML “specification” ([Winer rant suppressed]) even has the type= attribute that could be used for this (alternatively, I’d have added one).

Marked-up Outline: An outline which entries can be of different types and are displayed accordingly.

It’s a bit like that style selector known from popular word-processing (yuck) applications.

Given a marked-up outline, useful things can directly be made from it:

  • A XOXO-version (a.k.a., [Winer rant suppressed]) that has appropriate class= attributes and easily can be styled using CSS however you want.

  • A properly typeset version for printing, for example using ConTeXt’s XML facilities or some custom code to map the markup tags to TeX.

  • Filtered outlines, which only contain certain parts. This could be used to work around limitations of hierarchies.

  • and likely something nifty I didn’t think of…

Today, I decided to try implementing it, and dug into the OPML Editor.

This post was written using Emacs.

The display part of the OPML Editor is very hard to customize. Basically, the only thing that can be changed easily is the icon next to the entry, which is not enough for my purposes. If you have used the OPML Editor, you may have noticed it actually does style basic HTML (this was added in Frontier 7.0), for example it makes <b>foo</b> look bold. I thought I simply could add my own tags to that and only needed to figure out how to save the entry tags in the model.

The model part turned out easy, every node can have certain attributes that directly reflect the <outline> attributes of the corresponding OPML.

But it’s impossible to set the font size and style per-node, at least from UserTalk ([Winer rant suppressed]). The code that styles the basic HTML actually is written in C ([Winer rant suppressed]) and uncustomizable ([Winer rant suppressed]). Also, while searching for that code, I found some code I rather wish I hadn’t seen.

No go. I don’t want to hack C and build my own version of the OPML Editor just to make something like that possible.

I quickly looked into other means of editing outlines, especially browser-based ones. The ones I liked were the free sproutliner, Les Orchard’s experiments and the proprietary iJot. All of them are heavily JavaScript-based and I couldn’t figure out an easy way to extend them. If anyone wants to give that a try, by all means, do it!

For now, I’m deciding to go the “Unix way”. I’ll just add the entry tags directly into the outline entry (still need to figure a convenient syntax) and write some scripts to transform them to XOXO and TeX. Also, I may revive my ideas about an new Emacs mode, because with font-locking all that should be rather easy to do.

It’s a bit sad, I think quite a lot of people would have liked to have an easy program that can be used to create valid and semantic HTML documents based on some easy set of allowed elements…

NP: David Gilmour—Wish You Were Here

Copyright © 2004–2022