2002/css-validator/scripts menu.pl,1.1,1.2 menu.tmpl,1.1,1.2

Update of /sources/public/2002/css-validator/scripts
In directory hutz:/tmp/cvs-serv16047/scripts

Modified Files:
	menu.pl menu.tmpl 
Log Message:
automatically generated language selection menus, including the new translations

Index: menu.pl
===================================================================
RCS file: /sources/public/2002/css-validator/scripts/menu.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- menu.pl	8 Jul 2008 15:39:11 -0000	1.1
+++ menu.pl	8 Jul 2008 15:59:57 -0000	1.2
@@ -5,7 +5,7 @@
 my $cwdir = getcwd;
 my $menuline;
 my @langs;
-
+my $replaced = 0;
 open (menu_template, "menu.tmpl") or die("could not open menu template file");
 while ($menuline = <menu_template>) {
      $newmenu .= $menuline; 
@@ -19,22 +19,29 @@
 my $html = "";
 foreach my $filename (@files) {
     foreach my $ext (@langs) {
+        $replaced = 0;
+        $html = '';
         if (open (HTML, "../$filename.$ext")) {
-            $html = '';
-            #print "reading ../$filename.$ext";
+            print "reading ../$filename.$ext\n";
             while ($htmlline = <HTML>) {
                 $html .= $htmlline;
             }
             close(HTML);
+            my $html_orig = $html;
             $html =~ s/(<ul id="lang_choice">.*?<\/ul>)/$newmenu/sgmi;
+            if ($html ne $html_orig) { $replaced = 1;}
             $html =~ s/($filename)/$filename/sgmi;
+            if (!$replaced) {
+                print "did not replace menu in $filename.$ext\n";
+            }
             open (HTML, ">../$filename.$ext");
-            #print "writing to ../$filename.$ext";
+            #print "writing to ../$filename.$ext\n";
+            print "\n";
             print HTML $html;
             close HTML;
         }
         else {
-            die "could not open ../$filename.$ext";
+            warn "could not open ../$filename.$ext";
         }
     }
 }

Index: menu.tmpl
===================================================================
RCS file: /sources/public/2002/css-validator/scripts/menu.tmpl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- menu.tmpl	8 Jul 2008 15:39:11 -0000	1.1
+++ menu.tmpl	8 Jul 2008 15:59:58 -0000	1.2
@@ -90,4 +90,4 @@
          hreflang="zh-cn"
          rel="alternate">简体中文</a>
      </li>
-</ul>
+</ul>
\ No newline at end of file

Received on Tuesday, 8 July 2008 16:00:37 UTC