[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tagged string builder
From: |
Bill Gribble |
Subject: |
Re: tagged string builder |
Date: |
Mon, 26 Mar 2001 08:26:37 -0600 |
User-agent: |
Mutt/1.3.15i |
On Mon, Mar 26, 2001 at 11:28:37AM +0200, Martin Grabmueller wrote:
> Just for those who are interested in generating HTML with Guile: Some
> time ago, I wrote a little skript for generating my personal pages,
> which is small, simple to use and closer to writing HTML (for example,
> you can use Emacs' html-mode without great problems.
Another data point: gnucash uses Guile to generate HTML for financial
reports. We needed to have stylesheets/templates but the browser in
gnucash only supports HTML 3.2, so I put together a system that
generates the HTML at runtime from a structured set of records of
various types (<html-table>, <html-text>, etc), with inherited style
information.
The style information is sort of similar to CSS but not exactly; it
also includes support for parameterizable "renderers" for Scheme data
types, with inheritable properties, so you can do things like say
numbers in a certain table column should be displayed to a certain
precision, and it has a template mechanism.
It looks way more like scheme than HTML, and it's a lot more verbose,
but it's really nice to be able to have runtime dynamic style
information when people are doing report customization.
(let ((doc (gnc:make-html-document)))
(gnc:html-document-add-object!
doc
(gnc:make-html-text
(gnc:html-markup-p
"This is a paragraph of plain text. It can have "
(gnc:html-markup-b "bold") " or " (gnc:html-markup "red" "red-colored")
" text in the middle. You might notice that <red> is not an HTML tag. "
"That's OK because you can create your own semantic tags with the "
"style system.")))
(gnc:html-document-set-style!
doc "red"
'font-color "red"
'tag #f)
(gnc:html-document-render doc))
<html>
<body>
<p>This is a paragraph of plain text. It can have <b>bold</b> or
<font color=red>red-colored</font> text in the middle. You might notice
that <red> is not an HTML tag. That's OK because you can create your
own semantic tags with the style system.</p>
</body>
</html>
b.g.