11e5a7d631f3c1c593f6f12c1e4cf706cde5d816
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.">
17)    <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

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

Nima Fatemi authored 10 years ago

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

Sebastian Hahn authored 9 years ago

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

Nima Fatemi authored 10 years ago

22)    <link rel="icon" href="$(IMGROOT)/favicon.ico">
23)    <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)">">
24)    <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

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

Nima Fatemi authored 10 years ago

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

Sebastian Hahn authored 9 years ago

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

Nima Fatemi authored 10 years ago

30)    #<link href="css/master.css" rel="stylesheet">
31)    <!--[if lte IE 8]>
32)    <link href="$(DOCROOT)/css/ie8-and-down.css" rel="stylesheet">
33)    <![endif]-->
34)    <!--[if lte IE 7]>
35)    <link href="$(DOCROOT)/css/ie7-and-down.css" rel="stylesheet">
36)    <![endif]-->
37)    <!--[if IE 6]>
38)    <link href="$(DOCROOT)/css/ie6.css" rel="stylesheet">
39)    <![endif]-->
40)  #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
41)    # end WML to generate css/js paths 
Sebastian Hahn iAttempt at adding the rule...

Sebastian Hahn authored 8 years ago

42)    <!--[if !(lt IE 8)]><!-->
43)    <script type="text/javascript">
44)      var banner_config = {
45)        localAssets: true, //
46)      };
47) 
48)      (function(){
49)        var e = document.createElement('script'); e.type='text/javascript'; e.async = true;
50)        e.src = 'rule-41/widget.min.js';
51)        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s);
52)      })();
53)    </script>
54)    <!--<![endif]-->
55) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 10 years ago

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

Andrew Lewman authored 14 years ago

57) </head>
58) <body>
59) <div id="wrap">
60)   <div id="header">
Andrew Lewman it's called index, not home

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

62)       # navigation menu generation
63)       <div id="nav">
64)         <ul>
65)         <:{
66)             # create a hash and maintain order of keys
67)             my %navigation;
68)             my @keys;
69)             while (@navigation) {
70)               my $key = shift @navigation;
71)               my $val = shift @navigation;
72)               push @keys, $key;
73)               $navigation{$key} = $val;
74)             }
75) 
76)             my $page = $WML_SRC_BASENAME;
77)             my $lang = "$(LANG)";
78) 
79)             for my $key (@keys) {
80)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
81) 
82)               # in directory of active link, set class active 
83)               my $class;
84)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
85)                 $class = 'class="active"';
86)               } else {
87)                 $class = '';
88)               }
89) 
90) 	            $dir = '.' unless defined $dir;
91)                 
92)               # translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

94)                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
95)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
96)               } 
97)               # english version
98)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
99)               	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
100)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $navigation{$key};
101)               }
102)               # full url
103)               elsif ($key =~/^http/) {
104)                 printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
105)               } else {
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

107) 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

108)               }
109)             }
110)         }:>
111)         </ul>
112)       </div>
113)       <!-- END NAV -->
114)      # end navigation generation
115)       <div id="calltoaction">
116)         <ul>
117)           <:{
118)             my %calltoaction;
119)             my @keys;
120)             while (@calltoaction) {
121)               my $key = shift @calltoaction;
122)               my $val = shift @calltoaction;
123)               push @keys, $key;
124)               $calltoaction{$key} = $val;
125)             } 
126) 
127)             my $page = $WML_SRC_BASENAME;
128)             my $lang = "$(LANG)";
129)             for my $key (@keys) {
130)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
131) 
132)               # in directory, set active 
133)               my $class;
134)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
135)               #if ($WML_SRC_BASENAME eq $base) {
136)                 $class = 'class="active"';
137)               } else {
138)                 $class = '';
139)               }
140) 
141) 	          $dir = '.' unless defined $dir;
142)               # try to use a translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

144)                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
145)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
146)               } 
147)               # default to english version
148)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
149)               	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
150)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
151)               } else {
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 14 years ago

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