perl-docs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [PATCH] Implement <head> elements moving in DocSet
Date Wed, 12 Jun 2002 06:55:37 GMT
Per Einar Ellefsen wrote:
> At 06:08 12.06.2002, Stas Bekman wrote:
> 
>> Per Einar Ellefsen wrote:
>>
>>> Hi,
>>> So I decided to try and get that one working. I did :)
>>> It works ok for 404.html... It might create some problems if somebody 
>>> inserts meta tags into the source HTML that we're already setting in 
>>> the resulting HTML (by the way--wouldn't it be better to set the 
>>> description to the current abstract instead of the same for all 
>>> pages?), as those would be duplicated.
>>> I copy the headers verbatim. It's easier that way, because I didn't 
>>> have to invent complicated datastructures that aren't really 
>>> necessary anyway.
>>
>>
>> Easier yes, but it won't work nicely. The <head> must be parsed 
>> completely and sent to the templates as a hash (array?) with elements 
>> of the head (excluding title and description), so the templates will 
>> be able to set the default for those headers that weren't set, but not 
>> duplicate the existing headers e.g. consider <meta name="keywords" 
>> content="...">, which can be set in the source html header.
>>
>> probably something like this:
>>
>>   headers => {
>>       meta => [
>>          'keywords'    => 'the content part',
>>          'description' => '...'
>>       ],
>>       base => ...
>>   }
>>
>> It's not easy though, since different tags have different elements, so 
>> the templates should be aware of that.
>>
>> But if templates never receive raw HTML, later on we can extend POD to 
>> provide similar headers.
> 
> 
> Bah, so this means I have to invent a tree structure for the HTML a la 
> XML::Simple? Sounds prtty shaky to me... I was going to try 
> HTML::TreeBuilder, but it's not easy enough.. I'll continue to look at 
> this problem.

HTML::Parser should do just fine for parsing. It's not the question of 
implementation it's the question of how it should be implemented so the 
future will be as flexible as possible.

For example we can make the only certain parts of the header 
reproducable and without trying to reproduce them all. Like we do now 
for title and meta:description. So I suggest that we handle in addition 
any other meta tags and the base tag. later we can add other tags as 
requirement grows. If this is satisfying it's very easy to implement in 
the code and then make the templates use these new datastructures.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Mime
View raw message