Skip to content

Commit 2c97a48

Browse files
committed
wikiheaders: READMEs go in the base dir of the wiki now.
Reference PR #12529. (and several other issues.)
1 parent 92a5417 commit 2c97a48

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

build-scripts/wikiheaders.pl

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
my $bugreporturl = 'https://github.com/libsdl-org/sdlwiki/issues/new';
4444
my $srcpath = undef;
4545
my $wikipath = undef;
46-
my $wikireadmesubdir = 'README';
4746
my $warn_about_missing = 0;
4847
my $copy_direction = 0;
4948
my $optionsfname = undef;
@@ -1033,7 +1032,6 @@ sub generate_quickref {
10331032
my $incpath = "$srcpath";
10341033
$incpath .= "/$incsubdir" if $incsubdir ne '';
10351034

1036-
my $wikireadmepath = "$wikipath/$wikireadmesubdir";
10371035
my $readmepath = undef;
10381036
if (defined $readmesubdir) {
10391037
$readmepath = "$srcpath/$readmesubdir";
@@ -2082,18 +2080,15 @@ sub generate_quickref {
20822080
}
20832081

20842082
if (defined $readmepath) {
2085-
if ( -d $wikireadmepath ) {
2086-
mkdir($readmepath); # just in case
2087-
opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
2088-
while (readdir(DH)) {
2089-
my $dent = $_;
2090-
if ($dent =~ /\A(.*?)\.md\Z/) { # we only bridge Markdown files here.
2091-
next if $1 eq 'FrontPage';
2092-
filecopy("$wikireadmepath/$dent", "$readmepath/README-$dent", "\n");
2093-
}
2083+
mkdir($readmepath); # just in case
2084+
opendir(DH, $wikipath) or die("Can't opendir '$wikipath': $!\n");
2085+
while (readdir(DH)) {
2086+
my $dent = $_;
2087+
if ($dent =~ /\AREADME\-.*?\.md\Z/) { # we only bridge Markdown files here that start with "README-".
2088+
filecopy("$wikipath/$dent", "$readmepath/$dent", "\n");
20942089
}
2095-
closedir(DH);
20962090
}
2091+
closedir(DH);
20972092
}
20982093

20992094
} elsif ($copy_direction == -1) { # --copy-to-wiki
@@ -2698,31 +2693,27 @@ sub generate_quickref {
26982693
# Write out READMEs...
26992694
if (defined $readmepath) {
27002695
if ( -d $readmepath ) {
2701-
mkdir($wikireadmepath); # just in case
2696+
mkdir($wikipath); # just in case
27022697
opendir(DH, $readmepath) or die("Can't opendir '$readmepath': $!\n");
27032698
while (my $d = readdir(DH)) {
27042699
my $dent = $d;
2705-
if ($dent =~ /\AREADME\-(.*?\.md)\Z/) { # we only bridge Markdown files here.
2706-
my $wikifname = $1;
2707-
next if $wikifname eq 'FrontPage.md';
2708-
filecopy("$readmepath/$dent", "$wikireadmepath/$wikifname", "\n");
2700+
if ($dent =~ /\AREADME\-.*?\.md\Z/) { # we only bridge Markdown files here that start with "README-".
2701+
filecopy("$readmepath/$dent", "$wikipath/$dent", "\n");
27092702
}
27102703
}
27112704
closedir(DH);
27122705

27132706
my @pages = ();
2714-
opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
2707+
opendir(DH, $wikipath) or die("Can't opendir '$wikipath': $!\n");
27152708
while (my $d = readdir(DH)) {
27162709
my $dent = $d;
2717-
if ($dent =~ /\A(.*?)\.(mediawiki|md)\Z/) {
2718-
my $wikiname = $1;
2719-
next if $wikiname eq 'FrontPage';
2720-
push @pages, $wikiname;
2710+
if ($dent =~ /\AREADME\-.*?\.md\Z/) {
2711+
push @pages, $dent;
27212712
}
27222713
}
27232714
closedir(DH);
27242715

2725-
open(FH, '>', "$wikireadmepath/FrontPage.md") or die("Can't open '$wikireadmepath/FrontPage.md': $!\n");
2716+
open(FH, '>', "$wikipath/README.md") or die("Can't open '$wikipath/README.md': $!\n");
27262717
print FH "# All READMEs available here\n\n";
27272718
foreach (sort @pages) {
27282719
my $wikiname = $_;

0 commit comments

Comments
 (0)