From: Duncan C. <dun...@wo...> - 2005-04-18 23:31:03
|
On Sun, 2005-04-17 at 10:02 +0100, Axel Simon wrote: > On Fri, 2005-04-15 at 13:57 -0300, Aurelio Marinho Jargas wrote: > > what you could use are *filters* like preproc and postproc > > which are applyed to verbatim areas as well. and example: > > > > %!postproc: (keyword) <font color="green">\1</font> > > > > but that will be a boring task, and some common text can > > be expanded as if it was haskell code. > > Oh, ok. I didn't make the distinction between filter and macros. In > fact, the filter are probably sufficient for our purposes. While syntax > highlighting is nice, what we are really after is to automatically > hyperlink all the library functions in the example to the corresponding > html documentation. Hence I though we would just generate filters for > the 3000+ functions and include those. We could then live with a manual > set of syntax-highlighting filters. [snip] > That's nice as well, but we couldn't combine that with hyperlinking the > library functions. I think we are looking at code fragments rather than > at complete programs, so we can probably live without complete syntax > highlighting. Here's a system for doing the hyperlinking. Since filters are not applied to verbatum sections we have to apply them to the final output instead which means doing it differently depending on wether we're producing tex or (x)html. If figured that instead of producing lots of filer directives it'd be simpler just to post-process the stuff directly. So, I wrote a little Haskell program... :-) Honnestly, it's very little (170 lines) and does tex,html and xhtml. It hyperlinks all the used symbols from gtk/Graphics/UI/Gtk.hi to the appropriate Haddock html file (with a configurable base URL). It doesn't do syntax highligting. See the attached files for details. Save them to gtk2hs/docs/tutorial or somewhere (if you put it somewhare else adjust the 'top' var in the Makefile) and run $ make to build the HelloWorld example. Duncan |