From: Jani Nikula <jani.nikula@intel.com>
To: Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Cc: jani.nikula@intel.com
Subject: [PATCH 3/9] kernel-doc: use rst C domain directives and references for types
Date: Thu, 12 May 2016 16:15:38 +0300 [thread overview]
Message-ID: <35f8fa5e55e14dec18e9e035cd2bf43ba65a0f8c.1463058396.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1463058396.git.jani.nikula@intel.com>
In-Reply-To: <cover.1463058396.git.jani.nikula@intel.com>
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>
---
scripts/kernel-doc | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 0ad1fb0e3031..2fc8fad5195e 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -275,9 +275,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";
@@ -1835,10 +1835,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";
@@ -1863,8 +1862,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(@_);
}
@@ -1874,8 +1874,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";
--
2.1.4
next prev parent reply other threads:[~2016-05-12 13:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 13:15 [PATCH 0/9] kernel-doc/docproc prep work for reStructuredText Jani Nikula
2016-05-12 13:15 ` [PATCH 1/9] kernel-doc: rewrite usage description, remove duplicated comments Jani Nikula
2016-05-12 13:15 ` [PATCH 2/9] kernel-doc: produce RestructuredText output Jani Nikula
2016-05-12 13:15 ` Jani Nikula [this message]
2016-05-12 13:15 ` [PATCH 4/9] docproc: add variables for subcommand and filename Jani Nikula
2016-05-12 13:15 ` [PATCH 5/9] docproc: reduce unnecessary indentation Jani Nikula
2016-05-12 13:15 ` [PATCH 6/9] docproc: abstract docproc directive detection Jani Nikula
2016-05-12 13:15 ` [PATCH 7/9] docproc: abstract terminating lines at first space Jani Nikula
2016-05-12 13:15 ` [PATCH 8/9] docproc: add support for reStructuredText format via --rst option Jani Nikula
2016-05-12 13:15 ` [PATCH 9/9] docproc: print a comment about autogeneration for rst output Jani Nikula
2016-05-14 16:01 ` [PATCH 0/9] kernel-doc/docproc prep work for reStructuredText Jonathan Corbet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35f8fa5e55e14dec18e9e035cd2bf43ba65a0f8c.1463058396.git.jani.nikula@intel.com \
--to=jani.nikula@intel.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®