wikiheaders: Sort pages before listing them in README/FrontPage.md.

(cherry picked from commit 99c38268cd1325bb64739217adbeebaae7ae6a84)
This commit is contained in:
Ryan C. Gordon 2023-02-28 12:26:31 -05:00
parent 8572e19327
commit 0a0dfdb2f9
No known key found for this signature in database
GPG key ID: FA148B892AB48044

View file

@ -1387,19 +1387,24 @@ if ($copy_direction == 1) { # --copy-to-headers
} }
closedir(DH); closedir(DH);
open(FH, '>', "$wikireadmepath/FrontPage.md") or die("Can't open '$wikireadmepath/FrontPage.md': $!\n"); my @pages = ();
print FH "# All READMEs available here\n\n";
opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n"); opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
while (readdir(DH)) { while (readdir(DH)) {
my $dent = $_; my $dent = $_;
if ($dent =~ /\A(.*?)\.(mediawiki|md)\Z/) { if ($dent =~ /\A(.*?)\.(mediawiki|md)\Z/) {
my $wikiname = $1; my $wikiname = $1;
next if $wikiname eq 'FrontPage'; next if $wikiname eq 'FrontPage';
print FH "- [$wikiname]($wikiname)\n"; push @pages, $wikiname;
} }
} }
closedir(DH); closedir(DH);
open(FH, '>', "$wikireadmepath/FrontPage.md") or die("Can't open '$wikireadmepath/FrontPage.md': $!\n");
print FH "# All READMEs available here\n\n";
foreach (sort @pages) {
my $wikiname = $_;
print FH "- [$wikiname]($wikiname)\n";
}
close(FH); close(FH);
} }
} }