d9ff005e442c56e4ddfd41c07060cdd816c5d45d
Peter Palfrader Move website to wml

Peter Palfrader authored 18 years ago

1) #! /usr/bin/wml
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

2) <: use strict; :>
Peter Palfrader also use "use warnings"

Peter Palfrader authored 18 years ago

3) <: use warnings; :>
4) #use "perl-globals.wmi"
5) #use "links.wmi"
6) #use "versions.wmi"
7) #use "navigation.wmi"
Peter Palfrader Move website to wml

Peter Palfrader authored 18 years ago

8) 
9) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
10) <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
11) <head>
12)   <title>Tor: $(TITLE)</title>
13)   <meta name="Author" content="Roger Dingledine" />
14)   <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
15)   <link rel="stylesheet" type="text/css" href="stylesheet.css" />
16)   <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
17)   <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT).html" />">
18) </head>
19) 
20) <body>
21) 
22) <div class="center">
23) <table class="banner" border="0" cellpadding="0" cellspacing="0">
24)     <tr>
25)         <td class="banner-left"></td>
26)         <td class="banner-middle">
Peter Palfrader also use "use warnings"

Peter Palfrader authored 18 years ago

27) 	<:{
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

28) 	    my %navigation;
29) 	    my @keys;
Peter Palfrader Move website to wml

Peter Palfrader authored 18 years ago

30) 	    while (@navigation) {
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

31) 	      my $key = shift @navigation;
32) 	      my $val = shift @navigation;
Peter Palfrader Move website to wml

Peter Palfrader authored 18 years ago

33) 	      push @keys, $key;
34) 	      $navigation{$key} = $val;
35) 	    }
36) 
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

37) 	    for my $key (@keys) {
38) 	      my $page = $WML_SRC_FILENAME;
Peter Palfrader Move website to wml

Peter Palfrader authored 18 years ago

39) 	      $page =~ s/\.wml//;
40) 	      if ($page ne $key) {
Roger Dingledine bugfix on the website: the...

Roger Dingledine authored 18 years ago

41) 	        if (-e "$(LANG)/$key.wml") {
42) 	          printf '<a href="%s.html.$(LANG)">%s</a>'."\n",
43) 	                 $key, $navigation{$key};
44) 	        } else {
45) 	          printf '<a href="%s.html">%s</a>'."\n",
46) 	                 $key, $navigation{$key};
47) 	        }
48) 	      } else {
49) 	       printf '<a class="current">%s</a>'."\n", $navigation{$key};
50) 	      }
51) 	    }
Peter Palfrader also use "use warnings"

Peter Palfrader authored 18 years ago

52) 	}:>
Peter Palfrader Move website to wml

Peter Palfrader authored 18 years ago

53)         </td>
54)         <td class="banner-right">
Peter Palfrader also use "use warnings"

Peter Palfrader authored 18 years ago

55) 	<:{
Peter Palfrader Make translation status mor...

Peter Palfrader authored 18 years ago

56) 	  my $page = $WML_SRC_FILENAME;
Peter Palfrader Move website to wml

Peter Palfrader authored 18 years ago

57) 	  $page =~ s/\.wml//;
Peter Palfrader Add translation-status page

Peter Palfrader authored 18 years ago

58) 	  for my $dir (sort {$LANGUAGES{$a} cmp $LANGUAGES{$b}} @LANGUAGES) {
Peter Palfrader Revert side effect from usi...

Peter Palfrader authored 18 years ago

59) 	    next if $dir eq '$(LANG)';
Peter Palfrader Apparently foo.html.en work...

Peter Palfrader authored 18 years ago

60) 	    printf('<a href="%s.html.%s"><img src="$(IMGROOT)/%s.png" alt="%s" /></a>', $page, $dir, $dir, $LANGUAGES{$dir}) if (-e "$dir/$WML_SRC_FILENAME");
Peter Palfrader Move website to wml

Peter Palfrader authored 18 years ago

61) 	  };
Peter Palfrader also use "use warnings"

Peter Palfrader authored 18 years ago

62) 	}:>