webwml/include/links.wmi
2015-07-06 03:18:47 +02:00

61 lines
2.6 KiB
Plaintext

#!wml
<define-tag gitblob whitespace=delete>https://gitweb.torproject.org/tor.git/plain/</define-tag>
<define-tag cgitstable whitespace=delete>?id=tor-<version-stable></define-tag>
<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>
<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>
<define-tag wiki whitespace=delete>https://trac.torproject.org/projects/tor/wiki/</define-tag>
<define-tag wikifaq whitespace=delete>https://trac.torproject.org/projects/tor/wiki/doc/TorFAQ</define-tag>
<define-tag blog whitespace=delete>https://blog.torproject.org/blog/</define-tag>
<define-tag tbbrepo whitespace=delete>https://gitweb.torproject.org/torbrowser.git/blob_plain/HEAD:</define-tag>
<define-tag specblob whitespace=delete>https://gitweb.torproject.org/torspec.git/tree/</define-tag>
<define-tag spectree whitespace=delete>https://gitweb.torproject.org/torspec.git?a=tree;hb=HEAD;f=</define-tag>
<define-tag doxygen whitespace=delete>https://doxygen.torproject.org/</define-tag>
# 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;
if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
return stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
} elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
return stripDotSlashs("$(DOCROOT)/$dir/$base.html.en");
} elsif ($page =~ /^http/) {
return $page;
} 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.";
};
}
:>
<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");
} elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
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.";
};
}:>
</define-tag>