[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian WWW CVS: joey



On Thu, May 17, 2001 at 08:16:48PM +0200, Josip Rodin wrote:
[...]
> > Log message:
> > Added support for an automatically generated sub-menu which makes the
> > pages more flexible.
> 
> Can you please change it to use   in '[ foo ]' so that things like this
> don't happen:
> 
>    [ Ports ] [ Debian PowerPC ] [ News ] [ Devel ] [ Documentation ] [ Supply
>    ] [ Installation ]
> 
> (or should I just do that)

Hi,

you could also use wml::des::navbar, here is a complete example:

  #############  menu.inc  ###################
  #   These macro definitions may reside on a template
  <define-tag menu-button whitespace=delete>
    <preserve entry url>
    <set-var %attributes>
    <defvar url entry>
    <navbar:button txt=<subst-in-string "=LT=menutext-<get-var entry>>"
                                        "=LT=" "<">
                   id=<get-var entry> url=<get-var url>>
    <restore entry url>
  </define-tag>
  
  <define-tag menu endtag=required>
     <navbar:define name=menu>
        <navbar:prolog>[</navbar:prolog>
        <navbar:epilog>]</navbar:epilog>
        <navbar:prolog type=S>[<b></navbar:prolog>
        <navbar:epilog type=S></b>]</navbar:epilog>
        #  Previous macros gobble surrounding whitespaces, so we insert
        #  them now, and add &nbsp; too
        <navbar:filter>
           my ($mcode, $CFG, $select) = @_;
           $mcode =~ s/\[/ [&nbsp;/g;
           $mcode =~ s/\]/&nbsp;] /g;
           return $mcode;
        </navbar:filter>
        %body
     </navbar:define>
     <navbar:render name=menu select=<get-var WML_SRC_BASENAME> nohints>
  </define-tag>
  
  #   Now define the desired buttons
  <define-tag menutext-top whitespace=delete>
  Ports
  </define-tag>
  <define-tag menutext-index whitespace=delete>
  Debian PowerPC
  </define-tag>
  <define-tag menutext-news whitespace=delete>
  News
  </define-tag>
  <define-tag menutext-devel whitespace=delete>
  Devel
  </define-tag>
  <define-tag menutext-docu whitespace=delete>
  Documentation
  </define-tag>
  <define-tag menutext-supply whitespace=delete>
  Supply
  </define-tag>
  <define-tag menutext-install whitespace=delete>
  Installation
  </define-tag>
  
  <menu>
     <menu-button entry=top url="../">
     <menu-button entry=index>
     <menu-button entry=news>
     <menu-button entry=devel>
     <menu-button entry=docu>
     <menu-button entry=supply>
     <menu-button entry=install url="inst/install">
  </menu>
  #############  end of menu.inc  ###############

and remember to add #use wml::des::navbar in your WML source files.
Now translators can do their job on menutext-* macros, and new buttons
can easily be added.

HTH ;)

Denis



Reply to: