- From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 08 Jul 2008 15:39:13 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/scripts In directory hutz:/tmp/cvs-serv3028/scripts Added Files: menu.pl menu.tmpl Log Message: quick scripts for automated language menu editing into all the static doc files --- NEW FILE: menu.pl --- #!/usr/bin/perl my $newmenu = ""; use Cwd; my $cwdir = getcwd; my $menuline; my @langs; open (menu_template, "menu.tmpl") or die("could not open menu template file"); while ($menuline = <menu_template>) { $newmenu .= $menuline; if ($menuline =~ /xml:lang="(.*)"/){ push @langs, $1; } } my @files = ("manual.html", "about.html", "documentation.html", "DOWNLOAD.html"); my $html = ""; foreach my $filename (@files) { foreach my $ext (@langs) { if (open (HTML, "../$filename.$ext")) { $html = ''; #print "reading ../$filename.$ext"; while ($htmlline = <HTML>) { $html .= $htmlline; } close(HTML); $html =~ s/(<ul id="lang_choice">.*?<\/ul>)/$newmenu/sgmi; $html =~ s/($filename)/$filename/sgmi; open (HTML, ">../$filename.$ext"); #print "writing to ../$filename.$ext"; print HTML $html; close HTML; } else { die "could not open ../$filename.$ext"; } } } --- NEW FILE: menu.tmpl --- <ul id="lang_choice"> <li><a href="$filename.de" lang="de" xml:lang="de" hreflang="de" rel="alternate">Deutsch</a> </li> <li><a href="$filename.en" lang="en" xml:lang="en" hreflang="en" rel="alternate">English</a> </li> <li><a href="$filename.es" lang="es" xml:lang="es" hreflang="es" rel="alternate">Español</a> </li> <li><a href="$filename.fr" lang="fr" xml:lang="fr" hreflang="fr" rel="alternate">Français</a> </li> <li><a href="$filename.ko" lang="ko" xml:lang="ko" hreflang="ko" rel="alternate">한국어</a> </li> <li><a href="$filename.it" lang="it" xml:lang="it" hreflang="it" rel="alternate">Italiano</a> </li> <li><a href="$filename.nl" lang="nl" xml:lang="nl" hreflang="nl" rel="alternate">Nederlands</a> </li> <li><a href="$filename.ja" lang="ja" xml:lang="ja" hreflang="ja" rel="alternate">日本語</a> </li> <li><a href="$filename.pl-PL" lang="pl-PL" xml:lang="pl-PL" hreflang="pl-PL" rel="alternate">Polski</a> </li> <li><a href="$filename.pt-BR" lang="pt-BR" xml:lang="pt-BR" hreflang="pt-BR" rel="alternate">Português</a> </li> <li><a href="$filename.ru" lang="ru" xml:lang="ru" hreflang="ru" rel="alternate">Русский</a> </li> <li><a href="$filename.sv" lang="sv" xml:lang="sv" hreflang="sv" rel="alternate">Svenska</a> </li> <li><a href="$filename.zh-cn" lang="zh-cn" xml:lang="zh-cn" hreflang="zh-cn" rel="alternate">简体中文</a> </li> </ul>
Received on Tuesday, 8 July 2008 15:39:50 UTC