wikiheaders.pl: pull in full sections from headers, fix more whitespace.

This commit is contained in:
Ryan C. Gordon 2021-07-14 11:58:57 -04:00
parent 17b4a67aa3
commit 8ec9fbdd0c
No known key found for this signature in database
GPG Key ID: FA148B892AB48044

View File

@ -118,7 +118,7 @@ sub wordwrap {
}
$retval .= wordwrap_paragraphs($str); # wrap what's left.
$retval =~ s/\n+$//;
$retval =~ s/\n+\Z//ms;
#print("\n\nWORDWRAP DONE:\n\n$retval\n\n\n");
return $retval;
@ -738,11 +738,16 @@ if ($copy_direction == 1) { # --copy-to-headers
my $subline = $doxygenlines[0];
$subline =~ s/\A\s*//;
last if $subline =~ /\A\\/; # some sort of doxygen command, assume we're past this thing.
last if $subline eq ''; # empty line, this param is done.
shift @doxygenlines; # dump this line from the array; we're using it.
$desc .= " $subline";
if ($subline eq '') { # empty line, make sure it keeps the newline char.
$desc .= "\n";
} else {
$desc .= " $subline";
}
}
$desc =~ s/[\s\n]+\Z//ms;
# We need to know the length of the longest string to make Markdown tables, so we just store these off until everything is parsed.
push @params, $arg;
push @params, $desc;
@ -753,22 +758,30 @@ if ($copy_direction == 1) { # --copy-to-headers
my $subline = $doxygenlines[0];
$subline =~ s/\A\s*//;
last if $subline =~ /\A\\/; # some sort of doxygen command, assume we're past this thing.
last if $subline eq ''; # empty line, this param is done.
shift @doxygenlines; # dump this line from the array; we're using it.
$desc .= wikify($wikitype, " $subline");
if ($subline eq '') { # empty line, make sure it keeps the newline char.
$desc .= "\n";
} else {
$desc .= " $subline";
}
}
$sections{'Return Value'} = wordwrap("$retstr $desc") . "\n";
$desc =~ s/[\s\n]+\Z//ms;
$sections{'Return Value'} = wordwrap("$retstr " . wikify($wikitype, $desc)) . "\n";
} elsif ($l =~ /\A\\since\s+(.*)\Z/) {
my $desc = $1;
while (@doxygenlines) {
my $subline = $doxygenlines[0];
$subline =~ s/\A\s*//;
last if $subline =~ /\A\\/; # some sort of doxygen command, assume we're past this thing.
last if $subline eq ''; # empty line, this param is done.
shift @doxygenlines; # dump this line from the array; we're using it.
$desc .= wikify($wikitype, " $subline");
if ($subline eq '') { # empty line, make sure it keeps the newline char.
$desc .= "\n";
} else {
$desc .= " $subline";
}
}
$sections{'Version'} = wordwrap($desc) . "\n";
$desc =~ s/[\s\n]+\Z//ms;
$sections{'Version'} = wordwrap(wikify($wikitype, $desc)) . "\n";
} elsif ($l =~ /\A\\sa\s+(.*)\Z/) {
my $sa = $1;
$sa =~ s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func"