Thursday, May 11, 2006

RTFD

Well, I was idly thinking that I could move the HTML parsing code of HelpViewer in a GNUstep TextConverter bundle (so that *any* application using text would be automagically able to load html... or at leas the particular HelpViewer brand ;-), so I looked into the RTF TextConverter to see how that worked. It's fairly simple in fact :-)

But reading the code, I also realized that adding RTFD support (RTFD are basically RTF documents + Images) would be trivial. I am actually fairly surprised nobody did that before, particularly as I remember numerous complaint about its non-existence :-/

So, I modified the RTF parser to deal with the \NeXTGraphic tag, and it seem to work well -- at least reading RTFD documents that come from Mac OS X. Though, the actual grammar I used for dealing with it is pretty crude, so I wouldn't be surprised if some documents do not work (likely old NeXT documents... OS X documents produced by TextEdit seem fairly consistent with what I did). Anyway now the basic support is done, tweaking the grammar won't be difficult if it's needed.

Here is a screenshot showing two documents opened in Ink.app (and obviously no modifications were needed in Ink.app...):







It's committed on the gnustep repository, so you can try it by updating and reinstalling the RTF TextConverter bundle.

I'm thinking I'll perhaps commit my actual HelpViewer version (as it can use rtf files) without waiting for the html parser to be finished... plus "commit early commit often" is a good idea ;-) (which I don't follow enough...)

We could write a simple Text editor dealing with links, etc. as well. Oh well we'll see.. :-)

1 comment:

Anonymous said...

if the rtfd fits you must commit!