84d2b92b982a2fe5b3ebd5ea2866c5cceb16c149
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 
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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