Re: FWD: Re: A few comments on recent changes; ATTN: translators, DWN
On Sat, Sep 23, 2000 at 02:53:56PM +0200, peter karlsson wrote:
> Joey Hess on 29 Aug 2000 15:09:02 -0700:
>
> > > Can't you just do a <:=spokendate($(PUBDATE)):> or similar? I think I used
> > > something like that when I fiddled with using the DWN summaries as meta
> > > description tags. Or perhaps the syntax was <:=spokendate("<PUBDATE>"):>
> > > there, I do not remember.
> >
> > That works everywhere except for in a #use line
[...]
> I've tried it quite a few ways now, but I also cannot figure out how to
> get wml to allow the conversion of the date in the title from the
> number format to the spokendate format. No matter what I try, I get
> error messages (and the times I do not get errors, I get Perl code in
> the HTML file).
>
> Any wml guru out there who can help?
AFAICT there is no solution with current templates, because you want
$(title) to contain some Perl commands, but in wml::debian::template
$(title) is used inside ePerl commands, whereas it is used outside in
wml::debian::basic.
You could replace in wml::debian::template
<: if ("$(NOHEADER)" eq "") {
print "<H1>$(title)</H1>\n";
}
:>
by
<perl>
if ("$(NOHEADER)" eq "") {
<perl:print><H1>$(title)</H1>
</perl:print>
}
</perl>
and then use safe <perl...> commands.
But i do not understand why you need ePerl there, maybe
<ifeq "$(NOHEADER)" ""
"<H1>$(title)</H1>
">
is a better alternative.
After choosing this alternative, you can patch wml::debian::weeklynews::header
by writing
#use wml::debian::template title="Debian Weekly News - <:=&spokendate('$(PUBDATE)'):>$(PAGENAME)" NOHOMELINK="yes" BARETITLE="yes" NOCOMMENTS="yes" SUMMARY="$(SUMMARY)"
But the spokendate subroutine is defined in wml::debian::ctime, which is
not yet read when wml::debian::weeklynews::header is invoked, so a
working copy of wml::debian::weeklynews::header could be
#use wml::std::tags
#use wml::debian::ctime
#use wml::debian::template title="Debian Weekly News - <:=&spokendate('$(PUBDATE)'):>$(PAGENAME)" NOHOMELINK="yes" BARETITLE="yes" NOCOMMENTS="yes" SUMMARY="$(SUMMARY)"
If you do not want to change global templates in order not to rebuild
the whole website, you have to decide which of the 2 $(title) could be
broken. Obviously the one used in wml::debian::template is visually more
important than the one in wml::debian::basic.
This version of wml::debian::weeklynews::header works without changing
global templates, but the title page (i.e. the title defined in the HEAD
section) is broken
#use wml::std::tags
#use wml::debian::ctime
<define-tag news-pubdate>" . &spokendate('$(PUBDATE)') . "</define-tag>
#use wml::debian::template title="Debian Weekly News - <news-pubdate>$(PAGENAME)" NOHOMELINK="yes" BARETITLE="yes" NOCOMMENTS="yes" SUMMARY="$(SUMMARY)"
Let me know if you need more details.
Denis
PS: i will send other fixes for global templates in a separate post
Reply to: