[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Remove ././././././ from links



Update of /home/or/cvsroot/website/include
In directory moria:/tmp/cvs-serv26293/include

Modified Files:
	head.wmi links.wmi 
Log Message:
Remove ././././././ from links

Index: head.wmi
===================================================================
RCS file: /home/or/cvsroot/website/include/head.wmi,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -p -d -r1.14 -r1.15
--- head.wmi	19 Feb 2006 22:39:04 -0000	1.14
+++ head.wmi	31 Mar 2006 05:28:14 -0000	1.15
@@ -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};

Index: links.wmi
===================================================================
RCS file: /home/or/cvsroot/website/include/links.wmi,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -d -r1.7 -r1.8
--- links.wmi	26 Jan 2006 23:15:02 -0000	1.7
+++ links.wmi	31 Mar 2006 05:28:14 -0000	1.8
@@ -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.";
 	};