47a6ab07ff77aca59eb097f458003f233f93519a
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) 
hiromipaw Escaping equals sign in vie...

hiromipaw authored 7 years ago

9) <define-tag viewport whitespace=delete>
10) <meta name="viewport" content="width\=device-width, initial-scale=1">
11) </define-tag>
12) 
13) 
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 10 years ago

14) <!DOCTYPE html>
15)  <html>
16)  <head>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

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

Nima Fatemi authored 10 years ago

18)    <meta charset="utf-8">
19)    <meta http-equiv="X-UA-Compatible" content="IE=edge">
hiromipaw Escaping equals sign in vie...

hiromipaw authored 7 years ago

20)    <viewport>
Nima Fatemi some meta clean up. making...

Nima Fatemi authored 10 years ago

21)    <meta name="author" content="The Tor Project, Inc.">
hiromipaw Change keywords and descrip...

hiromipaw authored 7 years ago

22)    <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.">
23)    <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

24)    <meta property="og:image" content="https://www.torproject.org/images/tor-logo.jpg">
Peter Palfrader Move Debian sources.list ge...

Peter Palfrader authored 7 years ago

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

Sebastian Hahn authored 9 years ago

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

Nima Fatemi authored 10 years ago

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

32) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Nima Fatemi authored 10 years ago

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

hiromipaw authored 7 years ago

35)    <ifeq "$(STYLESHEET)" "" "<link href="$(DOCROOT)/css/master.min.css" rel="stylesheet">">
Arthur Edelstein Bug 23484: 2017 Homepage do...

Arthur Edelstein authored 7 years ago

36)    <ifeq "$(DONATION_BANNER)" "true" "<link href="$(DOCROOT)/css/donation-banner.css" rel="stylesheet">">
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

37) 
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

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

Nima Fatemi authored 10 years ago

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

hiromipaw authored 7 years ago

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

Nima Fatemi authored 10 years ago

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

hiromipaw authored 7 years ago

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

Nima Fatemi authored 10 years ago

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

hiromipaw authored 7 years ago

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

Nima Fatemi authored 10 years ago

47)    <![endif]-->
hiromipaw Escaping equals sign in vie...

hiromipaw authored 7 years ago

48)    #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

50) </head>
51) <body>
Arthur Edelstein Bug 23484: 2017 Homepage do...

Arthur Edelstein authored 7 years ago

52) <!-- Insert donation banner if flag is true -->
53) <ifeq "$(DONATION_BANNER)" "true" "
54)     <div id="banner-wrapper">
55)         <div id="banner-contents-container">
56)             <div id="banner-tagline"><span><noscript>Protecting the Privacy of Millions Every Day</noscript></span></div>
57)             <div id="banner-slogan"><span>Tor: Powering Digital Resistance</span></div>
58)             <a id="banner-donate-button-link"
59)                href="https://www.torproject.org/donate/donate-pdr-hp">
60)                 <div id="banner-donate-button">
61)                     <span>Donate Now!&#160;&#9654;</span>
62)                 </div>
63)             </a>
64)         </div>
65)     </div>
66)     <div id="banner-spacer"></div>
67)     <script src="js/donation_banner.js"></script>
68) 
69) ">
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 14 years ago

70) <div id="wrap">
71)   <div id="header">
Andrew Lewman it's called index, not home

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

73)       # navigation menu generation
74)       <div id="nav">
75)         <ul>
76)         <:{
77)             # create a hash and maintain order of keys
78)             my %navigation;
79)             my @keys;
80)             while (@navigation) {
81)               my $key = shift @navigation;
82)               my $val = shift @navigation;
83)               push @keys, $key;
84)               $navigation{$key} = $val;
85)             }
86) 
87)             my $page = $WML_SRC_BASENAME;
88)             my $lang = "$(LANG)";
89) 
90)             for my $key (@keys) {
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

92) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

99)               } else {
100)                 $class = '';
101)               }
102) 
103) 	            $dir = '.' unless defined $dir;
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

110)               # english version
111)               elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
112)               	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
113)                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $navigation{$key};
114)               }
115)               # full url
116)               elsif ($key =~/^http/) {
117)                 printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
118)               } else {
Andrew Lewman switch to Goldstein's idea...

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

121)               }
122)             }
123)         }:>
124)         </ul>
125)       </div>
126)       <!-- END NAV -->
127)      # end navigation generation
128)       <div id="calltoaction">
129)         <ul>
130)           <:{
131)             my %calltoaction;
132)             my @keys;
133)             while (@calltoaction) {
134)               my $key = shift @calltoaction;
135)               my $val = shift @calltoaction;
136)               push @keys, $key;
137)               $calltoaction{$key} = $val;
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

139) 
140)             my $page = $WML_SRC_BASENAME;
141)             my $lang = "$(LANG)";
142)             for my $key (@keys) {
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

144) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

146)               my $class;
147)               if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
148)               #if ($WML_SRC_BASENAME eq $base) {
149)                 $class = 'class="active"';
150)               } else {
151)                 $class = '';
152)               }
153) 
154) 	          $dir = '.' unless defined $dir;
155)               # try to use a translated version
Andrew Lewman revert the pathing for lang

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

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

hiromipaw authored 7 years ago

167)             }