summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2016-03-09 17:25:03 +0200
committerJonathan Corbet <corbet@lwn.net>2016-03-09 16:20:58 -0700
commit819f5767a715c0005b8d0703728a39b911610ae1 (patch)
treeb8eaecea3b9e35aa2fd1f4d01693c28a0aa07dcf
parent15560114f4a0df1777813191fff9018893de16ee (diff)
downloadlwn-doc/sphinx.tar.gz
lwn-doc/sphinx.zip
kernel-doc: use rst C domain directives and references for typesdoc/sphinx
First, the headings for structs, enums and typedefs will be similar to functions. Second, this provides a kind of namespace for cross references. Third, and most importantly, the return and parameter types from .. c:function:: definitions will automagically become cross references to the documented types. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rwxr-xr-xscripts/kernel-doc19
1 files changed, 9 insertions, 10 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 5a73231f3abf..aae28dcea313 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -272,9 +272,9 @@ my $blankline_text = "";
my @highlights_rst = (
[$type_constant, "``\$1``"],
[$type_func, "\\:c\\:func\\:`\$1`"],
- [$type_struct_full, "\\:ref\\:`\$1 \$2`"],
- [$type_enum_full, "\\:ref\\:`\$1 \$2`"],
- [$type_struct, "\\:ref\\:`struct \$1`"],
+ [$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
+ [$type_enum_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
+ [$type_struct, "\\:c\\:type\\:`struct \$1 <\$1>`"],
[$type_param, "**\$1**"]
);
my $blankline_rst = "\n";
@@ -1843,10 +1843,9 @@ sub output_enum_rst(%) {
my %args = %{$_[0]};
my ($parameter);
my $count;
-
my $name = "enum " . $args{'enum'};
- print ".. _" . $name . ":\n\n";
- print "**$name**\n\n";
+
+ print "\n\n.. c:type:: " . $name . "\n\n";
print " " . $args{'purpose'} . "\n\n";
print "..\n\n:Constants:\n\n";
@@ -1871,8 +1870,9 @@ sub output_typedef_rst(%) {
my $count;
my $name = "typedef " . $args{'typedef'};
- print "**$name**\n\n";
- print $args{'purpose'} . "\n\n";
+ ### FIXME: should the name below contain "typedef" or not?
+ print "\n\n.. c:type:: " . $name . "\n\n";
+ print " " . $args{'purpose'} . "\n\n";
output_section_rst(@_);
}
@@ -1882,8 +1882,7 @@ sub output_struct_rst(%) {
my ($parameter);
my $name = $args{'type'} . " " . $args{'struct'};
- print ".. _" . $name . ":\n\n";
- print "**$name**\n\n";
+ print "\n\n.. c:type:: " . $name . "\n\n";
print " " . $args{'purpose'} . "\n\n";
print ":Definition:\n\n";