arguments to -render in HTML generator code

Bill Gribble grib@gnumatic.com
Mon, 15 Jan 2001 09:34:53 -0600


On Tue, Jan 16, 2001 at 03:53:49PM +1100, Robert Graham Merkel wrote:
> Hey grib, I'm almost to the point of doing useful things
> with panes (finally).  One of the final things that needs
> to be in place is a renderer along the lines of the 
> gnc:html-*foo*-render that are required to display guppi
> charts in reports.

I'm skeptical that this is what you need.  The html-*-render functions
are strictly for block-level structural elements of HTML, and I don't
think you are defining any new kinds of block level HTML elements, are
you?

Tell me more about what you are doing.  Oh, wait.. are you talking
about a renderer for the mainwindow account tree?  That makes sense.

To answer your question, the arguments to the html-foo-render
functions are (1) the object to render and (2) the HTML document to
render into.  You need to have the document in order to get inherited
style infomation.  ATM, the Guppi objects all ignore the style
information since they are sort of a special case of HTML rendering,
but in the future they might respect 'data style' (for example how
many decimal digits to display in legends) or default colors or
somesuch.

To add a new type of html object, you need to do two things: basically
cut-n-paste html-piechart.scm with appropriate changes for the new
object type, then patch the 'cond' statement at html-document.scm:341
to add the new class.  This is a bassackwards attempt to get some sort
of genericity... with a real object system there would be an
inheritance relationship between <html-object> and the various
<html-foo> classes.

The renderer function should return a string containing the HTML for
the object.  I've been using the with-output-to-string / display
metaphor throughout, because the old string-tree approach bugs me and
I think Guile's shared strings + GC are smart enough to DTRT.

Hope this is clear.  Let me know if it ain't.

b.g.