aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
authorRandy Dunlap <randy.dunlap@oracle.com>2007-05-08 03:29:51 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:10 -0400
commit3eb014a103701bedfaa11bc321f470e918c71ff7 (patch)
tree7b8c205b80d0f63874849ed4c27a0df49717c27c /scripts/kernel-doc
parent3361c7bebbf207f57f3dd1282cd87e1e37c082ac (diff)
kernel-doc: html mode struct highlights
Johannes Berg reported that struct names are not highlighted (bold, italic, etc.) in html kernel-doc output. (Also not in text-mode output, but I don't see that changing.) This patch adds the following: - highlight struct names in html output mode - highlight environment var. names in html output mode - indent struct fields in the original struct layout Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc21
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index c47eb31d604c..a3e23b10ae97 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -159,7 +159,8 @@ my $warnings = 0;
159my $type_constant = '\%([-_\w]+)'; 159my $type_constant = '\%([-_\w]+)';
160my $type_func = '(\w+)\(\)'; 160my $type_func = '(\w+)\(\)';
161my $type_param = '\@(\w+)'; 161my $type_param = '\@(\w+)';
162my $type_struct = '\&((struct\s*)?[_\w]+)'; 162my $type_struct = '\&((struct\s*)*[_\w]+)';
163my $type_struct_xml = '\\\amp;((struct\s*)*[_\w]+)';
163my $type_env = '(\$\w+)'; 164my $type_env = '(\$\w+)';
164 165
165# Output conversion substitutions. 166# Output conversion substitutions.
@@ -168,7 +169,8 @@ my $type_env = '(\$\w+)';
168# these work fairly well 169# these work fairly well
169my %highlights_html = ( $type_constant, "<i>\$1</i>", 170my %highlights_html = ( $type_constant, "<i>\$1</i>",
170 $type_func, "<b>\$1</b>", 171 $type_func, "<b>\$1</b>",
171 $type_struct, "<i>\$1</i>", 172 $type_struct_xml, "<i>\$1</i>",
173 $type_env, "<b><i>\$1</i></b>",
172 $type_param, "<tt><b>\$1</b></tt>" ); 174 $type_param, "<tt><b>\$1</b></tt>" );
173my $blankline_html = "<p>"; 175my $blankline_html = "<p>";
174 176
@@ -331,7 +333,7 @@ while ($ARGV[0] =~ m/^-(.*)/) {
331# using the s// operator. 333# using the s// operator.
332my $dohighlight = ""; 334my $dohighlight = "";
333foreach my $pattern (keys %highlights) { 335foreach my $pattern (keys %highlights) {
334# print "scanning pattern $pattern ($highlights{$pattern})\n"; 336# print STDERR "scanning pattern:$pattern, highlight:($highlights{$pattern})\n";
335 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n"; 337 $dohighlight .= "\$contents =~ s:$pattern:$highlights{$pattern}:gs;\n";
336} 338}
337 339
@@ -378,8 +380,14 @@ sub output_highlight {
378# confess "output_highlight got called with no args?\n"; 380# confess "output_highlight got called with no args?\n";
379# } 381# }
380 382
383# print STDERR "contents b4:$contents\n";
381 eval $dohighlight; 384 eval $dohighlight;
382 die $@ if $@; 385 die $@ if $@;
386 if ($output_mode eq "html") {
387 $contents =~ s/\\\\//;
388 }
389# print STDERR "contents af:$contents\n";
390
383 foreach $line (split "\n", $contents) { 391 foreach $line (split "\n", $contents) {
384 if ($line eq ""){ 392 if ($line eq ""){
385 print $lineprefix, $blankline; 393 print $lineprefix, $blankline;
@@ -466,11 +474,12 @@ sub output_struct_html(%) {
466 $type = $args{'parametertypes'}{$parameter}; 474 $type = $args{'parametertypes'}{$parameter};
467 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { 475 if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
468 # pointer-to-function 476 # pointer-to-function
469 print " <i>$1</i><b>$parameter</b>) <i>($2)</i>;<br>\n"; 477 print "&nbsp; &nbsp; <i>$1</i><b>$parameter</b>) <i>($2)</i>;<br>\n";
470 } elsif ($type =~ m/^(.*?)\s*(:.*)/) { 478 } elsif ($type =~ m/^(.*?)\s*(:.*)/) {
471 print " <i>$1</i> <b>$parameter</b>$2;<br>\n"; 479 # bitfield
480 print "&nbsp; &nbsp; <i>$1</i> <b>$parameter</b>$2;<br>\n";
472 } else { 481 } else {
473 print " <i>$type</i> <b>$parameter</b>;<br>\n"; 482 print "&nbsp; &nbsp; <i>$type</i> <b>$parameter</b>;<br>\n";
474 } 483 }
475 } 484 }
476 print "};<br>\n"; 485 print "};<br>\n";