perl-docs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: [PATCH] Implement <head> elements moving in DocSet
Date Wed, 12 Jun 2002 08:03:04 GMT
Per Einar Ellefsen wrote:
> At 08:55 12.06.2002, Stas Bekman wrote:
>> Per Einar Ellefsen wrote:
>>> At 06:08 12.06.2002, Stas Bekman wrote:
>>>> 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.
> Well, I was trying to make it so that we would just get all the tags in 
> head, except title and meta:description.
> But ok, your idea seems fine (and easier too :) My reason for looking to 
> another parser was to get an easy tree structure.

so just to make sure that we are on the same line, currently we will 
handle only <meta> and <base> tags, right? These should be deparsed into 
key/value pairs which will be then reconsructed by the templates.

metaname => metavalue

"href" => http:/...

so in the template we first convert the hardcoded headers into a 
[% default =
    meta => {
       author => "docs-dev (at)",
       description => "Manuals, Hints, Guidelines, Scenarios...",


[% # merging headers with defaults
FOR m = headers.meta.keys %]
  <meta name="[% m %]" content="[% headers.meta.m ? headers.meta.m : 
default.meta.m %]">
[% END %]
[% <base href="${headers.base.value}"> IF headers.base.value %]

all this written without testing, but you get the idea. this code is 
obviously incomplete, since it takes into account only headers from 
headers.meta, whereas it should merge with default.meta as well. so it 
should probably be:

FOR m = [headers.meta.keys, default.meta.keys]

> But should I drop the current special handling of title and abstract, or 
> should those still exist, *and* add their respective tags to whatever I 
> return for the headers? Or should I return the headers without title and 
> meta:description?

without title, but we need to add the description. The problem with 
description is that it may come from POD and it may include " chars so 
they need to be escaped so they won't break HTML.

Also we want to always prepend the:
   mod_perl documentation:
string to all descriptions, for the search engines mainly.

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message