[cl-typesetting-devel] HTML rendering
Marc Battyani
marc.battyani at fractalconcept.com
Sun Apr 18 12:46:04 UTC 2004
"Klaus Weidner" <klaus at atsec.com> wrote:
> after an all-day hacking session, I now have a proof of concept for XHTML
> rendering via cl-typesetting working, see attachment. It's still missing
> many tags, but that's mostly a matter of patience, I think the hard work
> is largely done.
Great! The ouput is already rather nice.
> The following article had inspired me to do this:
>
> http://www-106.ibm.com/developerworks/library/x-xslfo2app/
>
> It covers using XSL-FO stylesheet transforms on XHTML documents. There
> you can also find the input document "everything.html" I used, along with
> a FOP-rendered PDF version for comparison.
The comparison is not bad. Especially for only one day.
> Instead of XSL-FO, I'm using Lisp-based tree transform from XML (read
> from a file via the XMLS library) to cl-typesetting commands.
>
> I think this is an important step towards having cl-typesetting behave
> more like a normal program with input and output files rather than
> exclusively as a library. And all it took was an "eval" in the right
> place :-)
Lisp Rulez! :)
> I've extended cl-typesetting a bit, to support cross-referencing (needed
> for the table of contents and intra-document page references), left/right
> page header alternation (containing chapter titles) and some other minor
> stuff.
Good. I will add this to cl-typesetting.
> The only change to the core code was adding a :fresh-page token. It works
> like :eop, but does not start a new page if the current one is already
> empty. (This makes automated generation easier.) All the other extensions
> were in client code.
>
> I've attached the :fresh-page patch, and sample code to demonstrate the
> new features. The latter is still a bit messy and undocumented, it's a
> work in progress.
It will probably match the cl-typesetting doc anyway.
> The XHTML transformer is still too unfinished for distribution, but please
> let me know if you're interested in that and I'll work on cleaning it up.
> But I'm surprised at how well it works already, considering that most of
> my time had been spent figuring out how things work.
Of course I'm interested! Please send it as soon as you feel it's clean
enough.
> Some miscellaneous things I noticed:
>
> - there are a couple of rather grating spelling errors in the source
> code, which I'd suggest fixing before the code is in more widespread
> use (later changes would be harder) - I can make a patch for those but
> wanted to check first if that's okay.
>
> trimable => trimmable
> splitable => splittable
> ponctuation => punctuation
Ahem... ok I will change them.
> Also, I'm not sure what a "trie" is (used by hyphenation). And I think
> that keyword arguments should not use a "-p" suffix.
A trie is a kind of search tree (prefix). This code is a contribution, but
you can fix it if you want. What keyword arg are you talking about ?
> - This would also be a good opportunity to document the style parameters
> supported by the public interface, since grepping through the source is
> suboptimal.
>
> - I don't know how leaders (the dots joining table-of-content entries to
> the page numbers) should be implemented. Note that the dots should line
> up even if the TOC entries have different lengths, so it's not a simple
> matter of sticking periods in boxes.
IMO it's only a matter of sticking the correct number of dots with a hfill
between the last word and the dots. The only trouble is to compute the
correct number of dots ;-)
> - PDF hyperlinks aren't handled yet by the typesetting code - how about a
> link-box class which acts as a clickable area for the bounding box of
> the content?
I wanted to do this but it's not so simple. I have a few ideas on how to do
it. I will try to find some time to implement them.
> - The W3 FO specification is a surprisingly good fit to the
> cl-typesetting internals, and since XML is isomorphic to s-exprs, I
> think it would make sense to stay close to that model where
> appropriate. That would make it much easier to reuse existing work,
> i.e. for DocBook or OpenOffice rendering.
It's a good idea. I wil look at this.
> Comments and feedback would be much appreciated.
Good work, go on!
Marc
BTW what about the CMUCL problems ?
More information about the cl-typesetting-devel
mailing list