[cl-typesetting-devel] HTML rendering

Klaus Weidner klaus at atsec.com
Mon Apr 19 23:46:12 UTC 2004


On Tue, Apr 20, 2004 at 01:20:01AM +0200, Marc Battyani wrote:
> There is also the TeX syntax which is rather popular.

You mean the old-style {\bf bold} and {\it italic}? Sure, I still use
that myself on occasion if I have to write LaTeX and I don't have my
emacs macros available. 

I think that parsing TeX would be harder than XML (unless you restrict
yourself to a very small subset), and you'd have to be careful not to
inherit the limitations. The TeX/LaTeX table model is not a good thing to
emulate. If somebody wants to do this, more power to them, but it isn't
going to be me.

> > I am not an XML expert, but many respectful lispniks (IIRC Eric Naggum,
> > Erann Gat to name a few) do not share your love with XML :-)
> 
> Ahem, I don't think Klaus wants to work with XML, just import some.

Exactly. Just a few lines of code to be able to read and (if needed)
write it. Lisp is unfortunately a niche language, and beside that it's
much easier to deal with XML in Lisp than to convince people to import
s-exps in their favourite language.

> The syntax is a subject that was debated a lot on c.l.l  My position is that
> the intermediate syntax layer must be s-expr based otherwise we would loose
> a lot of power. But though some (like Dmitri) prefer to work directly in
> this syntax, it seems that people generally prefer to work on a more user
> friendly syntax.
> 
> I think both are needed. When I write a document, A user friendly syntax is
> better IMO. But when I write code to generate a document then I prefer to
> work on the s-expr syntax.

I fully agree here. It's great to have the full power of Lisp at your
fingertips if you want to do something complex, but most of the time I
just want to write text and let the engine handle the formatting.

It's not an either/or choice, you can simply pick the right tool for the
job at hand.

> A lot of people proposed some syntaxes that could be cool but so far nobody
> has published one.  :(
> So all syntaxes are welcomed as long as there is some lisp code to convert
> it to s-expr.

That's exactly what I'm working on. Here's an extract from my XHTML tree
rewriter (which corresponds to an XSL-FO stylesheet expressed in Lisp):

    (case elem
      ((:h1) `(with-style ()
               :fresh-page
               (paragraph (:font "Helvetica-Bold" :font-size 20
                                 :top-margin 12 :bottom-margin 12)
                 (tt::make-ref-mark (cons :chapter ,(incf *chapter-num*))
                                    ,(xml-extract-text node))
                 , at clst)))
      ((:pre) `(with-style (:font "Courier" :font-size 12 :bottom-margin 0)
                           (verbatim , at clst)))
      ((:nobr) `(with-style () (hbox () , at clst)))
      ((:br) :eol)
      ((:i :em :var) `(with-style (:font "Times-Italic") , at clst))
      ((:b :strong) `(with-style (:font "Times-Bold") , at clst))
      ((:tt :kbd :samp :code :address) `(with-style (:font "Courier") , at clst))
      ((:big) `(with-style (:font-size 14) , at clst))

> BTW, I looked at some FO typesetting systems and it seems that the price of
> a server licence can be of more than 80Keuros !

Yes, the commercial systems are horrendously expensive.

There are some free alternatives - FOP is a Java-based solution developed
by the Apache team (which I couldn't get working on my machine), and
there's passivetex a.k.a. xmltex, which appears to be rather fragile due
to the choice of a TeX backend.

-Klaus




More information about the cl-typesetting-devel mailing list