4d27a115d6903b46913ad5f9689683d70b23cd54
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) 
Andrew Lewman change the DOCTYPE to non x...

Andrew Lewman authored 13 years ago

9) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
10) <html>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

11) <head>
12)   <title>$(TITLE)</title>
Sebastian Hahn And more self-closing tags...

Sebastian Hahn authored 13 years ago

13)   <link rel="shortcut icon" type="image/x-icon" href="$(IMGROOT)/favicon.ico">
14)   <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)">">
15)   <ifneq "$(REDIRECT_GLOBAL)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT_GLOBAL)">">
Andrew Lewman fix up the missing close ta...

Andrew Lewman authored 13 years ago

16)   <ifeq "$(ANNOUNCE_RSS)" "yes" "<link rel="alternate" title="Tor Project OR-announce" href="http://rss.gmane.org/gmane.network.onion-routing.announce"
Sebastian Hahn And more self-closing tags...

Sebastian Hahn authored 13 years ago

17) type="application/rss+xml">">
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

18) 
19)   # begin WML to generate css/js paths 
Sebastian Hahn And more self-closing tags...

Sebastian Hahn authored 13 years ago

20)   <ifneq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/$(STYLESHEET)">">
21)   <ifeq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/master.css">">
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

22) 
Sebastian Hahn And more self-closing tags...

Sebastian Hahn authored 13 years ago

23)   #<link href="css/master.css" rel="stylesheet" type="text/css">
Andrew Lewman Add cta-buttons.jpg, change...

Andrew Lewman authored 12 years ago

24)   <!--[if lte IE 8]>
25)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie8-and-down.css">
26)   <![endif]-->
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

27)   <!--[if lte IE 7]>
Sebastian Hahn And more self-closing tags...

Sebastian Hahn authored 13 years ago

28)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie7-and-down.css">
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

29)   <![endif]-->
30)   <!--[if IE 6]>
Sebastian Hahn And more self-closing tags...

Sebastian Hahn authored 13 years ago

31)   <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie6.css">
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

32)   <![endif]-->
Andrew Lewman fix the press links so they...

Andrew Lewman authored 13 years ago

33) #  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

34)   # end WML to generate css/js paths 
35) 
Sebastian Hahn And more self-closing tags...

Sebastian Hahn authored 13 years ago

36)   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
37)   <meta name="author" content="The Tor Project, Inc.">
38)   <meta name="keywords" content="anonymity online, tor, tor project, censorship circumvention, traffic analysis, anonymous communications research">
Andrew Lewman first cut of the new, shiny...

Andrew Lewman authored 13 years ago

39) </head>
40) <body>
41) <div id="wrap">
42)   <div id="header">
Andrew Lewman it's called index, not home

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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

Andrew Lewman authored 13 years ago

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