mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[PATCH] kernel-doc: fix some odd spacing issues
- in man and text mode output, if the function return type is empty (like it is for macros), don't print the return type and a following space; this fixes an output malalignment; - in the function short description, strip leading, trailing, and multiple embedded spaces (to one space); this makes function name/description output spacing consistent; - fix a comment typo; Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
6e8c818829
commit
a21217daae
1 changed files with 20 additions and 4 deletions
|
@ -365,7 +365,7 @@ sub dump_section {
|
||||||
# parameterlist => @list of parameters
|
# parameterlist => @list of parameters
|
||||||
# parameterdescs => %parameter descriptions
|
# parameterdescs => %parameter descriptions
|
||||||
# sectionlist => @list of sections
|
# sectionlist => @list of sections
|
||||||
# sections => %descriont descriptions
|
# sections => %section descriptions
|
||||||
#
|
#
|
||||||
|
|
||||||
sub output_highlight {
|
sub output_highlight {
|
||||||
|
@ -953,7 +953,11 @@ sub output_function_man(%) {
|
||||||
print $args{'function'}." \\- ".$args{'purpose'}."\n";
|
print $args{'function'}." \\- ".$args{'purpose'}."\n";
|
||||||
|
|
||||||
print ".SH SYNOPSIS\n";
|
print ".SH SYNOPSIS\n";
|
||||||
print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n";
|
if ($args{'functiontype'} ne "") {
|
||||||
|
print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n";
|
||||||
|
} else {
|
||||||
|
print ".B \"".$args{'function'}."\n";
|
||||||
|
}
|
||||||
$count = 0;
|
$count = 0;
|
||||||
my $parenth = "(";
|
my $parenth = "(";
|
||||||
my $post = ",";
|
my $post = ",";
|
||||||
|
@ -1118,13 +1122,19 @@ sub output_intro_man(%) {
|
||||||
sub output_function_text(%) {
|
sub output_function_text(%) {
|
||||||
my %args = %{$_[0]};
|
my %args = %{$_[0]};
|
||||||
my ($parameter, $section);
|
my ($parameter, $section);
|
||||||
|
my $start;
|
||||||
|
|
||||||
print "Name:\n\n";
|
print "Name:\n\n";
|
||||||
print $args{'function'}." - ".$args{'purpose'}."\n";
|
print $args{'function'}." - ".$args{'purpose'}."\n";
|
||||||
|
|
||||||
print "\nSynopsis:\n\n";
|
print "\nSynopsis:\n\n";
|
||||||
my $start=$args{'functiontype'}." ".$args{'function'}." (";
|
if ($args{'functiontype'} ne "") {
|
||||||
|
$start = $args{'functiontype'}." ".$args{'function'}." (";
|
||||||
|
} else {
|
||||||
|
$start = $args{'function'}." (";
|
||||||
|
}
|
||||||
print $start;
|
print $start;
|
||||||
|
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
foreach my $parameter (@{$args{'parameterlist'}}) {
|
foreach my $parameter (@{$args{'parameterlist'}}) {
|
||||||
$type = $args{'parametertypes'}{$parameter};
|
$type = $args{'parametertypes'}{$parameter};
|
||||||
|
@ -1710,6 +1720,7 @@ sub process_file($) {
|
||||||
my $file;
|
my $file;
|
||||||
my $identifier;
|
my $identifier;
|
||||||
my $func;
|
my $func;
|
||||||
|
my $descr;
|
||||||
my $initial_section_counter = $section_counter;
|
my $initial_section_counter = $section_counter;
|
||||||
|
|
||||||
if (defined($ENV{'SRCTREE'})) {
|
if (defined($ENV{'SRCTREE'})) {
|
||||||
|
@ -1753,7 +1764,12 @@ sub process_file($) {
|
||||||
|
|
||||||
$state = 2;
|
$state = 2;
|
||||||
if (/-(.*)/) {
|
if (/-(.*)/) {
|
||||||
$declaration_purpose = xml_escape($1);
|
# strip leading/trailing/multiple spaces #RDD:T:
|
||||||
|
$descr= $1;
|
||||||
|
$descr =~ s/^\s*//;
|
||||||
|
$descr =~ s/\s*$//;
|
||||||
|
$descr =~ s/\s+/ /;
|
||||||
|
$declaration_purpose = xml_escape($descr);
|
||||||
} else {
|
} else {
|
||||||
$declaration_purpose = "";
|
$declaration_purpose = "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue