eb1684b4c4f19b93152e3ad11cec64e28db53fff
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">
Peter Palfrader Move Debian sources.list ge...

Peter Palfrader authored 7 years ago

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

Sebastian Hahn authored 9 years ago

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

Nima Fatemi authored 9 years ago

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

27) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Nima Fatemi authored 9 years ago

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

hiromipaw authored 6 years ago

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

Sebastian Hahn authored 9 years ago

31) 
hiromipaw Minify JS and CSS

hiromipaw authored 6 years ago

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

Nima Fatemi authored 9 years ago

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

hiromipaw authored 6 years ago

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

Nima Fatemi authored 9 years ago

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

hiromipaw authored 6 years ago

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

Nima Fatemi authored 9 years ago

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

hiromipaw authored 6 years ago

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

Nima Fatemi authored 9 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

68) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

69)               # 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

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

120) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

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

hiromipaw authored 7 years ago

143)             }