Remove ././././././ from links
Peter Palfrader

Peter Palfrader commited on 2006-03-31 07:28:14
Zeige 3 geänderte Dateien mit 18 Einfügungen und 9 Löschungen.

... ...
@@ -17,11 +17,11 @@ include $(WMLBASE)/Makefile.common
17 17
 all: $(SUBDIRS)
18 18
 
19 19
 docs:
20
-	$(MAKE) -C "$@" WMLBASE=../$(WMLBASE)
20
+	$(MAKE) -C "$@" WMLBASE=..
21 21
 eff:
22
-	$(MAKE) -C "$@" WMLBASE=../$(WMLBASE)
22
+	$(MAKE) -C "$@" WMLBASE=..
23 23
 gui:
24
-	$(MAKE) -C "$@" WMLBASE=../$(WMLBASE)
24
+	$(MAKE) -C "$@" WMLBASE=..
25 25
 
26 26
 # XXX: this also depends on all subs' wmlfiles.  How to fix?
27 27
 translation-status.html.en: $(LANGS) $(WMIFILES) $(WMLFILES)
... ...
@@ -42,11 +42,11 @@
42 42
 	      $page =~ s/\.wml//;
43 43
 	      if ($page ne $key) {
44 44
 	        if (-e "$(DOCROOT)/$(LANG)/$key.wml") {
45
-	          printf '<a href="$(DOCROOT)/%s.html.$(LANG)">%s</a>'."\n",
46
-	                 $key, $navigation{$key};
45
+	          printf '<a href="%s">%s</a>'."\n",
46
+	                 stripDotSlashs("$(DOCROOT)/$key.html.$(LANG)"), $navigation{$key};
47 47
 	        } else {
48
-	          printf '<a href="$(DOCROOT)/%s.html">%s</a>'."\n",
49
-	                 $key, $navigation{$key};
48
+	          printf '<a href="%s">%s</a>'."\n",
49
+	                 stripDotSlashs("$(DOCROOT)/$key.html"), $navigation{$key};
50 50
 	        }
51 51
 	      } else {
52 52
 	       printf '<a class="current">%s</a>'."\n", $navigation{$key};
... ...
@@ -6,15 +6,24 @@
6 6
 #  Xinclude "locallinks.wmi"
7 7
 #  Xinclude "langlocallinks.$(LANG).wmi"
8 8
 
9
+<:
10
+	sub stripDotSlashs($) {
11
+		my ($s) = @_;
12
+		1 while ($s =~ s|/\./|/|);
13
+		1 while ($s =~ s|^\./||);
14
+		return $s;
15
+	};
16
+:>
17
+
9 18
 <define-tag page whitespace=delete><:{
10 19
 	my $page="%0";
11 20
 	my $lang="$(LANG)";
12 21
 	my ($dir, $base) = $page =~ m,^(?:(.*)/)?(.*?)$,;
13 22
 	$dir = '.' unless defined $dir;
14 23
 	if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
15
-		print "$(DOCROOT)/$dir/$base.html.$lang";
24
+		print stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
16 25
 	} elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
17
-		print "$(DOCROOT)/$dir/$base.html";
26
+		print stripDotSlashs("$(DOCROOT)/$dir/$base.html");
18 27
 	} else {
19 28
 		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.";
20 29
 	};
21 30