42dd7261084a94da969dd809e6945629dfb6ab38
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">">
Sebastian Hahn Add open graph meta tag

Sebastian Hahn authored 9 years ago

36) 
hiromipaw Minify JS and CSS

hiromipaw authored 7 years ago

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

Nima Fatemi authored 10 years ago

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

hiromipaw authored 7 years ago

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

Nima Fatemi authored 10 years ago

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

hiromipaw authored 7 years ago

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

Nima Fatemi authored 10 years ago

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

hiromipaw authored 7 years ago

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

Nima Fatemi authored 10 years ago

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

hiromipaw authored 7 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

49) </head>
50) <body>
51) <div id="wrap">
52)   <div id="header">
Andrew Lewman it's called index, not home

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

73) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

80)               } else {
81)                 $class = '';
82)               }
83) 
84) 	            $dir = '.' unless defined $dir;
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

120) 
121)             my $page = $WML_SRC_BASENAME;
122)             my $lang = "$(LANG)";
123)             for my $key (@keys) {
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

125) 
hiromipaw Fix navigation active tab i...

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

hiromipaw authored 7 years ago

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

Andrew Lewman authored 14 years ago

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

Andrew Lewman authored 14 years ago

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

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

hiromipaw authored 7 years ago

148)             }