[cgi-wiki-dev] Formatter API change proposal

Kake L Pugh cgi-wiki-dev@earth.li
Mon, 24 Jan 2005 16:09:21 +0000

On Sun 23 Jan 2005, Kjetil Kjernsmo <kjetil@kjernsmo.net> wrote:
> In other cases, you can't reasonably expect to get just a fragment, 
> you'll get the whole document, even if you're just interested in a 
> fragment. I'd like to create a Formatter around HTML::Tidy RSN, and 
> while libtidy can format fragments, HTML::Tidy can't yet, AFAIK.

I'm not sure that the limitations of a helper module are a good thing
to base an API on.  You seem to be saying that because HTML::Tidy
can't be told not to add <head>, <body>, etc to things, then a
Formatter using it as a helper module must always return a full HTML
document regardless of whether this is appropriate.

Or perhaps I'm misunderstanding, since you mention the "fragment"
method.  But if you're going to provide a method to return a fragment,
the limitations of whatever module you get to do the heavy lifting
aren't relevant, surely.

I've just read the HTML::Tidy docs at
and as far as I can tell what it does is check the syntax of an HTML
document.  I can't see how to make it spit out HTML.  What am I missing?

> For an AxKit Provider, you would usually want to return a document,
> since, in principle it can be served directly to the user.

I don't actually know how AxKit works, but it seems to me that a
Formatter can only ever create a really basic HTML document.  How is
it to know things like keywords, description, stylesheet, RDF
auto-discovery whatsit, etc, to put in the <head>?  What can it be
reasonably expected to do other than stick in a really basic
<html><head><title>Whatever the title was set as in the
input</title></head><body> at the start of the output and </body></html>
at the end?  Is that ever really going to be useful?

This is not meant to pour scorn on your idea, but to explain how I see
it at the moment and hopefully provoke comments from others.