include/links.wmi
2a9aaa80
 #!wml
 
34e59f00
 <define-tag gitblob whitespace=delete>https://gitweb.torproject.org/tor.git/plain/</define-tag>
912f73ff
 <define-tag cgitstable whitespace=delete>?id=tor-<version-stable></define-tag> 
0c385a9e
 <define-tag gittree whitespace=delete>https://gitweb.torproject.org/tor.git?a=tree;hb=HEAD;f=</define-tag>
 <define-tag gitrepo whitespace=delete>https://gitweb.torproject.org/tor.git?a=tree;hb=HEAD</define-tag>
2a9aaa80
 <define-tag svnwebsite whitespace=delete>https://svn.torproject.org/svn/website/trunk/</define-tag>
 <define-tag svnprojects whitespace=delete>https://svn.torproject.org/svn/projects/</define-tag>
f4d76878
 <define-tag wiki whitespace=delete>https://trac.torproject.org/projects/tor/wiki/</define-tag>
81720f6d
 <define-tag wikifaq whitespace=delete>https://trac.torproject.org/projects/tor/wiki/doc/TorFAQ</define-tag>
8a056da2
 <define-tag blog whitespace=delete>https://blog.torproject.org/blog/</define-tag>
8f5328eb
 <define-tag newsletter whitespace=delete>https://newsletter.torproject.org</define-tag>
be7fab5f
 <define-tag tbbrepo whitespace=delete>https://gitweb.torproject.org/torbrowser.git/blob_plain/HEAD:</define-tag>
39fb3c52
 <define-tag specblob whitespace=delete>https://gitweb.torproject.org/torspec.git/tree/</define-tag>
0abe3aa4
 <define-tag doxygen whitespace=delete>https://doxygen.torproject.org/</define-tag>
656a7a38
 <define-tag donatefaq whitespace=delete>https://donate.torproject.org/donor-faq</define-tag>
365df400
 
2a9aaa80
 
 #  Xinclude "locallinks.wmi"
 #  Xinclude "langlocallinks.$(LANG).wmi"
 
 <:
 	sub stripDotSlashs($) {
 		my ($s) = @_;
 		1 while ($s =~ s|/\./|/|);
 		1 while ($s =~ s|^\./||);
 		return $s;
 	};
 :>
 
 <:  sub pageToURL($$) {
  	    my ($page, $lang) = @_;
 	    my ($dir, $base) = $page =~ m,^(?:(.*)/)?(.*?)$,;
 	    $dir = '.' unless defined $dir;
d6b24539
 	    if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
2a9aaa80
 	    	return stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
 	    } elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
af1268af
 	    	return stripDotSlashs("$(DOCROOT)/$dir/$base.html.en");
d6b24539
 	    } elsif ($page =~ /^http/) {
 	    	return $page;
2a9aaa80
 	    } else {
d6b24539
 	    	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.";
2a9aaa80
 	    }; 
     }
 :>
 
 <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 stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
d6b24539
 	} elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
2a9aaa80
 		print stripDotSlashs("$(DOCROOT)/$dir/$base.html");
 	} else {
d6b24539
 		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.";
2a9aaa80
 	};
 }:>
 </define-tag>