0c385a9e203fd2c8585b1bd41b895f2aac3edaa1
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

1) #!wml
2) 
Andrew Lewman work on the new website a b...

Andrew Lewman authored 14 years ago

3) <define-tag gitblob whitespace=delete>https://gitweb.torproject.org/tor.git?a=blob_plain;hb=HEAD;f=</define-tag>
4) <define-tag gitblobstable whitespace=delete>https://gitweb.torproject.org/tor.git?a=blob_plain;hb=release-0.2.1;f=</define-tag>
5) <define-tag gittree whitespace=delete>https://gitweb.torproject.org/tor.git?a=tree;hb=HEAD;f=</define-tag>
6) <define-tag gitrepo whitespace=delete>https://gitweb.torproject.org/tor.git?a=tree;hb=HEAD</define-tag>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

7) <define-tag svnwebsite whitespace=delete>https://svn.torproject.org/svn/website/trunk/</define-tag>
8) <define-tag svnprojects whitespace=delete>https://svn.torproject.org/svn/projects/</define-tag>
9) 
10) #  Xinclude "locallinks.wmi"
11) #  Xinclude "langlocallinks.$(LANG).wmi"
12) 
13) <:
14) 	sub stripDotSlashs($) {
15) 		my ($s) = @_;
16) 		1 while ($s =~ s|/\./|/|);
17) 		1 while ($s =~ s|^\./||);
18) 		return $s;
19) 	};
20) :>
21) 
22) <:  sub pageToURL($$) {
23)  	    my ($page, $lang) = @_;
24) 	    my ($dir, $base) = $page =~ m,^(?:(.*)/)?(.*?)$,;
25) 	    $dir = '.' unless defined $dir;
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 14 years ago

26) 	    if (-e "$(DOCROOT)/$lang/$dir/$base.wml") {
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

27) 	    	return stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
28) 	    } elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
29) 	    	return stripDotSlashs("$(DOCROOT)/$dir/$base.html");
30)         } elsif ($page =~ /^http/) {
31)           return $page;
32) 	    } else {
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 14 years ago

33) 	    	warn "$WML_SRC_FILENAME has a [page $page] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$lang/$dir/$base.wml), but that doesn't exist.";
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

34) 	    }; 
35)     }
36) :>
37) 
38) <define-tag page whitespace=delete>
39) <:{
40) 	my $page="%0";
41) 	my $lang="$(LANG)";
42) 	my ($dir, $base) = $page =~ m,^(?:(.*)/)?(.*?)$,;
43) 	$dir = '.' unless defined $dir;
44) 	if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
45) 		print stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 14 years ago

46) 	} elsif (-e "$(DOCROOT)/en/$dir/$base.wml") {
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

47) 		print stripDotSlashs("$(DOCROOT)/$dir/$base.html");
48) 	} else {
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 14 years ago

49) 		warn "$WML_SRC_FILENAME has a [page $page] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$lang/$dir/$base.wml), but that doesn't exist.";