wikiheaders.pl: pull in full sections from headers, fix more whitespace.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
diff --git a/build-scripts/wikiheaders.pl b/build-scripts/wikiheaders.pl
index 59b0935..f332161 100755
--- a/build-scripts/wikiheaders.pl
+++ b/build-scripts/wikiheaders.pl
@@ -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"