4decfd830cfa3d9e47934915ece80d5e7cb573fd
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

1) #! /usr/bin/wml
2) <: use strict; :>
3) <: use warnings; :>
4) #use "perl-globals.wmi"
5) #use "links.wmi"
6) #use "versions.wmi"
7) #use "navigation.wmi"
8) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

9) <!DOCTYPE html>
10)  <html>
11)  <head>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

12) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

13)    <meta charset="utf-8">
14)    <meta http-equiv="X-UA-Compatible" content="IE=edge">
15)    <meta name="viewport" content="width=device-width, initial-scale=1">
16)    <meta name="author" content="The Tor Project, Inc.">
Arthur Edelstein Bug 20465: Call it 'Tor Bro...

Arthur Edelstein authored 7 years ago

17)    <meta name="description" content="Tor is a free software that prevents people from learning your location or browsing habits by letting you communicate anonymously on the Internet. It also helps you bypass censorship online. If you can't open the website, email gettor@torproject.org for instruction on how to get Tor Browser.">
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

18)    <meta name="keywords" content="anonymity online, tor, tor project, censorship circumvention, traffic analysis, anonymous communications research">
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

19)    <meta property="og:image" content="https://www.torproject.org/images/tor-logo.jpg">
20) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

21)    <title>$(TITLE)</title>
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

22) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

23)    <link rel="icon" href="$(IMGROOT)/favicon.ico">
24)    <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)">">
25)    <ifneq "$(REDIRECT_GLOBAL)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT_GLOBAL)">">
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

26) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

27)    # begin WML to generate css/js paths 
28)    <ifneq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/$(STYLESHEET)" rel="stylesheet">">
29)    <ifeq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/css/master.css" rel="stylesheet">">
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

30) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

31)    #<link href="css/master.css" rel="stylesheet">
32)    <!--[if lte IE 8]>
33)    <link href="$(DOCROOT)/css/ie8-and-down.css" rel="stylesheet">
34)    <![endif]-->
35)    <!--[if lte IE 7]>
36)    <link href="$(DOCROOT)/css/ie7-and-down.css" rel="stylesheet">
37)    <![endif]-->
38)    <!--[if IE 6]>
39)    <link href="$(DOCROOT)/css/ie6.css" rel="stylesheet">
40)    <![endif]-->
41)  #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
42)    # end WML to generate css/js paths 
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

43) </head>
44) <body>
45) <div id="wrap">
46)   <div id="header">
Andrew Lewman it's called index, not home

Andrew Lewman authored 13 years ago

47)     <h1 id="logo"><a href="<page index>">Tor</a></h1>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

48)       # navigation menu generation
49)       <div id="nav">
50)         <ul>
51)         <:{
52)             # create a hash and maintain order of keys
53)             my %navigation;
54)             my @keys;
55)             while (@navigation) {
56)               my $key = shift @navigation;
57)               my $val = shift @navigation;
58)               push @keys, $key;
59)               $navigation{$key} = $val;
60)             }
61) 
62)             my $page = $WML_SRC_BASENAME;
63)             my $lang = "$(LANG)";
64) 
65)             for my $key (@keys) {
66)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
67) 
68)               # in directory of active link, set class active 
69)               my $class;
70)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
71)                 $class = 'class="active"';
72)               } else {
73)                 $class = '';
74)               }
75) 
76) 	            $dir = '.' unless defined $dir;
77)                 
78)               # translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

80)                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
81)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
82)               } 
83)               # english version
84)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
85)               	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
86)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $navigation{$key};
87)               }
88)               # full url
89)               elsif ($key =~/^http/) {
90)                 printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
91)               } else {
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 13 years ago

92)                 warn "$WML_SRC_FILENAME has a [page $key] (parses to
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

93) docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

94)               }
95)             }
96)         }:>
97)         </ul>
98)       </div>
99)       <!-- END NAV -->
100)      # end navigation generation
101)       <div id="calltoaction">
102)         <ul>
103)           <:{
104)             my %calltoaction;
105)             my @keys;
106)             while (@calltoaction) {
107)               my $key = shift @calltoaction;
108)               my $val = shift @calltoaction;
109)               push @keys, $key;
110)               $calltoaction{$key} = $val;
111)             } 
112) 
113)             my $page = $WML_SRC_BASENAME;
114)             my $lang = "$(LANG)";
115)             for my $key (@keys) {
116)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
117) 
118)               # in directory, set active 
119)               my $class;
120)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
121)               #if ($WML_SRC_BASENAME eq $base) {
122)                 $class = 'class="active"';
123)               } else {
124)                 $class = '';
125)               }
126) 
127) 	          $dir = '.' unless defined $dir;
128)               # try to use a translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

130)                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
131)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
132)               } 
133)               # default to english version
134)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
135)               	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
136)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
137)               } else {
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

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