[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: document matrix generation in releases/slink/



Any objection to the following change?
It simply makes sure that the files exist so we don't have
broken links.

+   @cur_dir = split('/', '$(WML_SRC_DIRNAME)');
+   $release = pop @cur_dir;

    foreach $arch (keys %arches) {
        $ctr++;
        my $first = 1;

        foreach $ext (keys %formats) {
+           # assume that an extension doesn't exist if there is no English version.
+           # English-centric, but anyone got a better idea?
+           if (!-f "$(HTMLDIR)/releases/$release/$arch/$file.en.$ext") {
+               next;
+           }
            # alternate the row color
            if ( $ctr % 2 ) {
                print "\n<tr>\n";
            } else {
                print "\n<tr bgcolor=\"$altcolor\">\n";
            }
            # only print the arch name on the first row
            if ( $first == 1 ) {
                print "  <td align=\"left\"><a href=\"$arch/$file\">" . $arches{$arch} . "</a></td>\n";
                $first = 0;
            } else {
                print "  <td>&nbsp;</td>\n";
            }
            print "  <td align=\"left\">" . $formats{$ext} . "</td>\n";
            # permute over languages
            print "  <td>";
            foreach $lang (@langs) {
-               print "<a href=\"./$arch/$file." . $langs{$lang} . ".$ext\">";
-               # sometimes the language name isn't properly defined yet
-               my $workaroundlang = $trans{$CUR_ISO_LANG}{$lang};
-               ( $workaroundlang = $lang ) =~ s/^(.)/\U$1/
-                   unless $workaroundlang;
-               print $workaroundlang . "</a> \n";
+               $file_version = "./$arch/$file." . $langs{$lang} . ".$ext";
+               if (-f "$(HTMLDIR)/releases/$release/$file_version") {
+                   # all languages should be defined in %trans. Add missing entries
+                   # in English if this is not the case
+                   print "<a href=\"$file_version\">" . $trans{$CUR_ISO_LANG}{$lang} . "</a> \n";
+               }
            }
            print "  </td>";
            print "</tr>\n";

        }


Also, is there a reason that "index" is added to some of the directory links
in files under releases/? It is superfluous.

Jay Treacy


Reply to: