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

main
Ryan C. Gordon 2023-02-28 12:26:31 -05:00
parent 7745c9b3ae
commit 99c38268cd
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 9 additions and 4 deletions

View File

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