646ccefe1c6435e24c0cbf64d56abdcbe8fd6ca0
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.">
hiromipaw Change keywords and descrip...

hiromipaw authored 6 years ago

17)    <meta name="description" content="The Tor Project's free software protects your privacy online. Site blocked? Email [mailto:gettor@torproject.org] for help downloading Tor Browser.">
18)    <meta name="keywords" content="tor, tor project, tor browser, avoid censorship, traffic analysis, anonymous communications, privacy, avoid surveillance, online security, anonymous online, private browsing, anonymity online, online privacy, protect privacy, private mac browser, private windows browser, private android browser, linux browser, anonymity network, tor network, onion router, onion browser">
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">
hiromipaw Fix security policy for ama...

hiromipaw authored 6 years ago

20)    <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://static-na.payments-amazon.com">
Peter Palfrader Move Debian sources.list ge...

Peter Palfrader authored 7 years ago

21) {#meta#}
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)    <title>$(TITLE)</title>
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

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

Nima Fatemi authored 9 years ago

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

28) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

29)    # begin WML to generate css/js paths
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

30)    <ifneq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/$(STYLESHEET)" rel="stylesheet">">
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

31)    <ifeq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/css/master.min.css" rel="stylesheet">">
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

32) 
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

33)    #<link href="css/master.min.css" rel="stylesheet">
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

34)    <!--[if lte IE 8]>
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

35)    <link href="$(DOCROOT)/css/ie8-and-down.min.css" rel="stylesheet">
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

36)    <![endif]-->
37)    <!--[if lte IE 7]>
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

38)    <link href="$(DOCROOT)/css/ie7-and-down.min.css" rel="stylesheet">
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

39)    <![endif]-->
40)    <!--[if IE 6]>
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

41)    <link href="$(DOCROOT)/css/ie6.min.css" rel="stylesheet">
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 9 years ago

42)    <![endif]-->
43)  #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

44)    # end WML to generate css/js paths
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

50)       # navigation menu generation
51)       <div id="nav">
52)         <ul>
53)         <:{
54)             # create a hash and maintain order of keys
55)             my %navigation;
56)             my @keys;
57)             while (@navigation) {
58)               my $key = shift @navigation;
59)               my $val = shift @navigation;
60)               push @keys, $key;
61)               $navigation{$key} = $val;
62)             }
63) 
64)             my $page = $WML_SRC_BASENAME;
65)             my $lang = "$(LANG)";
66) 
67)             for my $key (@keys) {
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

68)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

69) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

70)               # in directory of active link, set class active. This rule should be improved with proper structuring of the links.
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

71)               my $class;
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

72)               if ((index($page, 'contact') ne -1) and (index($base, 'overview') ne -1)) {
73)                 $class = '';
74)               } elsif ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) and (index($key, 'contact') eq -1) or ($WML_SRC_BASENAME eq $base)) {
75)                 $class = 'class="active '.$base.' '.$page.'"';
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

76)               } else {
77)                 $class = '';
78)               }
79) 
80) 	            $dir = '.' unless defined $dir;
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

82)               # translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

84)                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
85)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

86)               }
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

98)               }
99)             }
100)         }:>
101)         </ul>
102)       </div>
103)       <!-- END NAV -->
104)      # end navigation generation
105)       <div id="calltoaction">
106)         <ul>
107)           <:{
108)             my %calltoaction;
109)             my @keys;
110)             while (@calltoaction) {
111)               my $key = shift @calltoaction;
112)               my $val = shift @calltoaction;
113)               push @keys, $key;
114)               $calltoaction{$key} = $val;
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

115)             }
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

116) 
117)             my $page = $WML_SRC_BASENAME;
118)             my $lang = "$(LANG)";
119)             for my $key (@keys) {
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

120)               my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

121) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

122)               # in directory, set active
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

123)               my $class;
124)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
125)               #if ($WML_SRC_BASENAME eq $base) {
126)                 $class = 'class="active"';
127)               } else {
128)                 $class = '';
129)               }
130) 
131) 	          $dir = '.' unless defined $dir;
132)               # try to use a translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

134)                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
135)                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

136)               }
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

142)                 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.";
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

143)               }
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

144)             }