dbccd8d0185fb363b4f8f043215c8db4bff4df86
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.">
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 9 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 9 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 9 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 9 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 7 years ago

42)    <!--[if !(lt IE 8)]><!-->
43)    <script type="text/javascript">
44)      var banner_config = {
45)        disableDate: true, // If true, the banner shows even if the date is not yet 06/21/2016. Use for testing.
46)        localAssets: true, //
47)        debug: false // Reveals any errors and debug messages. For debugging purposes only.
48)      };
49) 
50)      (function(){
51)        var e = document.createElement('script'); e.type='text/javascript'; e.async = true;
52)        e.src = 'rule-41/widget.min.js';
53)        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s);
54)      })();
55)    </script>
56)    <!--<![endif]-->
57) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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