Skip to content

Commit

Permalink
wikiheaders: Sort pages before listing them in README/FrontPage.md.
Browse files Browse the repository at this point in the history
(cherry picked from commit 99c3826)
  • Loading branch information
icculus committed Feb 28, 2023
1 parent 8572e19 commit 0a0dfdb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions build-scripts/wikiheaders.pl
Expand Up @@ -1387,19 +1387,24 @@ sub usage {
}
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);
}
}
Expand Down

0 comments on commit 0a0dfdb

Please sign in to comment.