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.
meta: metaname => metavalue
base: "href" => http:/...
so in the template we first convert the hardcoded headers into a datastructure:
[% default =
meta => {
author => "docs-dev (at) perl.apache.org",
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 http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
