[cgi-wiki-dev] Formatter API change proposal

Kake L Pugh cgi-wiki-dev@earth.li
Mon, 24 Jan 2005 18:26:40 +0000


On Mon 24 Jan 2005, Kjetil Kjernsmo <kjetil@kjernsmo.net> wrote:
> Currently, the format method is undefined, and that's not good
> enough. [...]

> In the case of HTML::Tidy, format will naturally return a document, [...]
> In the case of Textile, format will naturally return a fragment, [...]

This feels to me as though it's breaking the main strength of the whole
idea of using Formatter instead of just using the underlying modules - a
standard API.  Surely it would be best to have ->format act in the same
way whichever Formatter module you were using?  If you can't rely on it
to always return a document, or always return a fragment, then you lose
the possibility of blithely swapping from one Formatter to another without
making changes in the code.

How about you standardise that ->format will always return a fragment,
and ->format_as_document will always return a document?

Kake