Remove ././././././ from links

This commit is contained in:
Peter Palfrader 2006-03-31 05:28:14 +00:00
parent bc3ffdaa2b
commit 11c72e898f
3 changed files with 18 additions and 9 deletions

View File

@ -17,11 +17,11 @@ include $(WMLBASE)/Makefile.common
all: $(SUBDIRS)
docs:
$(MAKE) -C "$@" WMLBASE=../$(WMLBASE)
$(MAKE) -C "$@" WMLBASE=..
eff:
$(MAKE) -C "$@" WMLBASE=../$(WMLBASE)
$(MAKE) -C "$@" WMLBASE=..
gui:
$(MAKE) -C "$@" WMLBASE=../$(WMLBASE)
$(MAKE) -C "$@" WMLBASE=..
# XXX: this also depends on all subs' wmlfiles. How to fix?
translation-status.html.en: $(LANGS) $(WMIFILES) $(WMLFILES)

View File

@ -42,11 +42,11 @@
$page =~ s/\.wml//;
if ($page ne $key) {
if (-e "$(DOCROOT)/$(LANG)/$key.wml") {
printf '<a href="$(DOCROOT)/%s.html.$(LANG)">%s</a>'."\n",
$key, $navigation{$key};
printf '<a href="%s">%s</a>'."\n",
stripDotSlashs("$(DOCROOT)/$key.html.$(LANG)"), $navigation{$key};
} else {
printf '<a href="$(DOCROOT)/%s.html">%s</a>'."\n",
$key, $navigation{$key};
printf '<a href="%s">%s</a>'."\n",
stripDotSlashs("$(DOCROOT)/$key.html"), $navigation{$key};
}
} else {
printf '<a class="current">%s</a>'."\n", $navigation{$key};

View File

@ -6,15 +6,24 @@
# Xinclude "locallinks.wmi"
# Xinclude "langlocallinks.$(LANG).wmi"
<:
sub stripDotSlashs($) {
my ($s) = @_;
1 while ($s =~ s|/\./|/|);
1 while ($s =~ s|^\./||);
return $s;
};
:>
<define-tag page whitespace=delete><:{
my $page="%0";
my $lang="$(LANG)";
my ($dir, $base) = $page =~ m,^(?:(.*)/)?(.*?)$,;
$dir = '.' unless defined $dir;
if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
print "$(DOCROOT)/$dir/$base.html.$lang";
print stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
} elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
print "$(DOCROOT)/$dir/$base.html";
print stripDotSlashs("$(DOCROOT)/$dir/$base.html");
} else {
warn "$WML_SRC_FILENAME has a [page $page] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
};