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

Bug or feature - handling url "./" in wml::des::navbar



Hi Denis,

sorry if I am disturbing the packaging of the next release, but I just 
stumbled over the problem an hour ago.

I am trying to create a navigation bar with a button entry

  <navbar:define name=topbar urlbase="$(ROOT)">
    <navbar:button id=index txt="First page" url="./">

(-DROOT~. in .wmlrc) which does not yield one of the expected results

    <a href="./">First page</a>
    <a href="$(BASE_URL)">First page</a>

in files in the $(ROOT) directory but

    First page

without any links. However, it would certainly be better to get a link
to "./" instead. 

The relevant lines from wml::des::navbar (line 467+, wml 1.7.2)
modifying the url information are 

        #   cleanup url information
        if ($url =~ m|#([a-zA-Z]+)#|) {
            $url = $NAVBAR{"$name"}->{uc($1)};
        }
        if ($url ne '') {
            $url  = "$urlbase/$url" if ($urlbase ne '' and $url !~ m;^(http://|/););
            $url  = &canonpath($url) if ($url !~ m;^http://;);
        }

and if $url is "./" the call to &canonpath will yield an empty
string for $url. 

The following modification to the code will yield a link to "./"
respectively "(../)+" for "./" or "." as $url.

        #   cleanup url information
        if ($url =~ m|#([a-zA-Z]+)#|) {
            $url = $NAVBAR{"$name"}->{uc($1)};
        }
        if ($url ne '') {
            $url  = "$urlbase/$url" if ($urlbase ne '' and $url !~ m;^(http://|/););
            if ($url =~ m;^(\./)*\.?$;) {
                $url = "./";
            } elsif ($url !~ m;^http://;) {
                $url  = &canonpath($url);
            }
        }

It works - at least for me :-)

Now the questions are:

(a) Is that behaviour desirable for all applications of
    wml::des::navbar? 

(b) Is that behaviour perhaps even desirable all applications of
    &canonpath()? 

Personally I would answer (a) with a definite "yes" and (b) with a
definite "perhaps".

Greets,

Uli
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com