[Petal] Problems with HTML Parser

William McKee william@knowmad.com
Thu, 8 Aug 2002 10:58:03 -0400


On 8 Aug 2002 at 12:28, Jean-Michel Hiver wrote:
> I think in the near future Petal is going to feature pluggable
> canonicalizers... The current one is going to be renamed
> Petal::Canonicalizer::XML and I'll write a Petal::Canonicalizer::XHTML.

Hmm, I guess I don't understand very well the role of the canonicalizer. I 
thought the canonicalizer rewrote the petal tags just before the template 
was parsed. Do I have the order reversed?

I did a bit more investigating of the HTMLWrapper library after my email 
and it looks like the problem with the closing tags and the quoted CSS 
properties is due to not enough intelligence in that library. How is 
creating a canonicalizer for each input type going to fix the problems 
we're seeing?


> There will be an extra global variable for the output.

This is an interesting idea. I wonder if adding this ability to a template 
library is the appropriate place.... In a sense, Petal is becoming an 
application instead of a template library. I've been meaning to look into 
AxKit because I think it provides this kind of capability that I've been 
wanting to have available to my web apps. I'm not trying to discourage the 
idea, just trying to flesh out the big picture.
 

> As I'm writing this I realize that maybe the $Petal::PARSER should
> perhaps be renamed $Petal::INPUT.
> 
> Then you'd do something like.
> 
> $Petal::INPUT  = 'HTML';
> $Petal::OUTPUT = 'XHTML';
> 
> I'm thinking of loosing the 'ANY' which does not make much sense. By
> default, petal would be set as follow:
> 
> $Petal::INPUT  = 'XML';
> $Petal::OUTPUT = 'XML';
> 
> Because by default Petal should be able to template all kinds of XML
> (Voice XML, RDF, RSS, SVG...) and not just HTML.

At present, it just outputs HTML, right? This would indeed be a valuable 
library when you add these capabilities! It's easy to use (unlike Template 
Toolkit and AxKit), does not embed logic into the templates (unlike Mason, 
PHP, *SP, etc) and does not lock you into any specific application 
environment.


Regards,
William
-- 
 Lead Developer
 Knowmad Services Inc. || Internet Applications & Database Integration
 http://www.knowmad.com