b817b1e8254219fbbe34f703e1340cfe31b2e686
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 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 10 years ago

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

Andrew Lewman authored 14 years ago

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

Nima Fatemi authored 10 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 8 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 10 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 10 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 10 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 10 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 10 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 
Sebastian Hahn iAttempt at adding the rule...

Sebastian Hahn authored 8 years ago

43) 
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

94) 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 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

139)                 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.";