linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Jani Nikula <jani.nikula@intel.com>,
	Markus Heiser <markus.heiser@darmarit.de>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Grant Likely <grant.likely@secretlab.ca>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Keith Packard <keithp@keithp.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-doc@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>
Subject: [PATCH v2 19/38] kernel-doc/rst: highlight function/struct/enum purpose lines too
Date: Sat,  4 Jun 2016 14:37:20 +0300	[thread overview]
Message-ID: <c099ff6989baf286da8eaed5c7b3d18ae60ea2e7.1465031816.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1465031816.git.jani.nikula@intel.com>
In-Reply-To: <cover.1465031816.git.jani.nikula@intel.com>

Let the user use @foo, &bar, %baz, etc. in the first kernel-doc purpose
line too.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 scripts/kernel-doc | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 8f9eac509377..76bad55c031e 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1805,6 +1805,7 @@ sub output_highlight_rst {
 sub output_function_rst(%) {
     my %args = %{$_[0]};
     my ($parameter, $section);
+    my $oldprefix = $lineprefix;
     my $start;
 
     print ".. c:function:: ";
@@ -1829,9 +1830,13 @@ sub output_function_rst(%) {
 	    print $type . " " . $parameter;
 	}
     }
-    print ")\n\n    " . $args{'purpose'} . "\n\n";
+    print ")\n\n";
+    $lineprefix = "   ";
+    output_highlight_rst($args{'purpose'});
+    print "\n";
 
     print ":Parameters:\n\n";
+    $lineprefix = "        ";
     foreach $parameter (@{$args{'parameterlist'}}) {
 	my $parameter_name = $parameter;
 	#$parameter_name =~ s/\[.*//;
@@ -1844,15 +1849,14 @@ sub output_function_rst(%) {
 	}
 	if (defined($args{'parameterdescs'}{$parameter_name}) &&
 	    $args{'parameterdescs'}{$parameter_name} ne $undescribed) {
-	    my $oldprefix = $lineprefix;
-	    $lineprefix = "        ";
 	    output_highlight_rst($args{'parameterdescs'}{$parameter_name});
-	    $lineprefix = $oldprefix;
 	} else {
 	    print "\n        _undescribed_\n";
 	}
 	print "\n";
     }
+
+    $lineprefix = $oldprefix;
     output_section_rst(@_);
 }
 
@@ -1874,14 +1878,16 @@ sub output_section_rst(%) {
 sub output_enum_rst(%) {
     my %args = %{$_[0]};
     my ($parameter);
+    my $oldprefix = $lineprefix;
     my $count;
     my $name = "enum " . $args{'enum'};
 
     print "\n\n.. c:type:: " . $name . "\n\n";
-    print "    " . $args{'purpose'} . "\n\n";
+    $lineprefix = "   ";
+    output_highlight_rst($args{'purpose'});
+    print "\n";
 
     print "..\n\n:Constants:\n\n";
-    my $oldprefix = $lineprefix;
     $lineprefix = "    ";
     foreach $parameter (@{$args{'parameterlist'}}) {
 	print "  `$parameter`\n";
@@ -1892,6 +1898,7 @@ sub output_enum_rst(%) {
 	}
 	print "\n";
     }
+
     $lineprefix = $oldprefix;
     output_section_rst(@_);
 }
@@ -1899,23 +1906,29 @@ sub output_enum_rst(%) {
 sub output_typedef_rst(%) {
     my %args = %{$_[0]};
     my ($parameter);
-    my $count;
+    my $oldprefix = $lineprefix;
     my $name = "typedef " . $args{'typedef'};
 
     ### FIXME: should the name below contain "typedef" or not?
     print "\n\n.. c:type:: " . $name . "\n\n";
-    print "    " . $args{'purpose'} . "\n\n";
+    $lineprefix = "   ";
+    output_highlight_rst($args{'purpose'});
+    print "\n";
 
+    $lineprefix = $oldprefix;
     output_section_rst(@_);
 }
 
 sub output_struct_rst(%) {
     my %args = %{$_[0]};
     my ($parameter);
+    my $oldprefix = $lineprefix;
     my $name = $args{'type'} . " " . $args{'struct'};
 
     print "\n\n.. c:type:: " . $name . "\n\n";
-    print "    " . $args{'purpose'} . "\n\n";
+    $lineprefix = "   ";
+    output_highlight_rst($args{'purpose'});
+    print "\n";
 
     print ":Definition:\n\n";
     print " ::\n\n";
@@ -1944,6 +1957,7 @@ sub output_struct_rst(%) {
     print "  };\n\n";
 
     print ":Members:\n\n";
+    $lineprefix = "        ";
     foreach $parameter (@{$args{'parameterlist'}}) {
 	($parameter =~ /^#/) && next;
 
@@ -1953,13 +1967,12 @@ sub output_struct_rst(%) {
 	($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
 	$type = $args{'parametertypes'}{$parameter};
 	print "      `$type $parameter`" . "\n";
-	my $oldprefix = $lineprefix;
-	$lineprefix = "        ";
 	output_highlight_rst($args{'parameterdescs'}{$parameter_name});
-	$lineprefix = $oldprefix;
 	print "\n";
     }
     print "\n";
+
+    $lineprefix = $oldprefix;
     output_section_rst(@_);
 }
 
-- 
2.1.4

  parent reply	other threads:[~2016-06-04 11:44 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-04 11:37 [PATCH v2 00/38] Documentation/sphinx Jani Nikula
2016-06-04 11:37 ` [PATCH v2 01/38] kernel-doc/rst: fix use of uninitialized value Jani Nikula
2016-06-04 11:37 ` [PATCH v2 02/38] kernel-doc: support printing exported and non-exported symbols Jani Nikula
2016-06-04 11:37 ` [PATCH v2 03/38] Documentation/sphinx: add basic working Sphinx configuration and build Jani Nikula
2016-06-04 11:37 ` [PATCH v2 04/38] Documentation: add .gitignore Jani Nikula
2016-06-04 11:37 ` [PATCH v2 05/38] Documentation/sphinx: add Sphinx kernel-doc directive extension Jani Nikula
2016-06-04 11:37 ` [PATCH v2 06/38] Documentation/sphinx: configure the kernel-doc extension Jani Nikula
2016-06-04 11:37 ` [PATCH v2 07/38] Documentation/sphinx: set version and release properly Jani Nikula
2016-06-04 11:37 ` [PATCH v2 08/38] sphinx: cheesy script to convert .tmpl files Jani Nikula
2016-06-04 11:37 ` [PATCH v2 09/38] sphinx: update docbook->rst conversion script match C domain spec Jani Nikula
2016-06-04 11:37 ` [PATCH v2 10/38] Documentation/sphinx: nicer referencing of struct in docbook->rst conversion Jani Nikula
2016-06-04 11:37 ` [PATCH v2 11/38] kernel-doc: add names for states and substates Jani Nikula
2016-06-04 11:37 ` [PATCH v2 12/38] kernel-doc: add names for output selection Jani Nikula
2016-06-04 11:37 ` [PATCH v2 13/38] kernel-doc/rst: do not output DOC: section titles for requested ones Jani Nikula
2016-06-04 11:37 ` [PATCH v2 14/38] kernel-doc/rst: reference functions according to C domain spec Jani Nikula
2016-06-04 11:37 ` [PATCH v2 15/38] kernel-doc/rst: &foo references are more universal than structs Jani Nikula
2016-06-04 11:37 ` [PATCH v2 16/38] kernel-doc/rst: add support for &union foo and &typedef foo references Jani Nikula
2016-06-04 11:37 ` [PATCH v2 17/38] kernel-doc/rst: add support for struct/union/enum member references Jani Nikula
2016-06-04 11:37 ` [PATCH v2 18/38] kernel-doc/rst: drop redundant unescape in highlighting Jani Nikula
2016-06-04 11:37 ` Jani Nikula [this message]
2016-06-04 11:37 ` [PATCH v2 20/38] kernel-doc: do not regard $, %, or & prefixes as special in section names Jani Nikula
2016-06-04 11:37 ` [PATCH v2 21/38] kernel-doc: fix wrong code indentation Jani Nikula
2016-06-04 11:37 ` [PATCH v2 22/38] kernel-doc/rst: blank lines in output are not needed Jani Nikula
2016-06-04 11:37 ` [PATCH v2 23/38] kernel-doc: strip leading blank lines from inline doc comments Jani Nikula
2016-06-04 11:37 ` [PATCH v2 24/38] kernel-doc/rst: change the output layout Jani Nikula
2016-06-04 11:37 ` [PATCH v2 25/38] kernel-doc: improve handling of whitespace on the first line param description Jani Nikula
2016-06-04 11:37 ` [PATCH v2 26/38] kernel-doc: strip leading whitespace from continued param descs Jani Nikula
2016-06-04 11:37 ` [PATCH v2 27/38] kernel-doc/rst: use *undescribed* instead of _undescribed_ Jani Nikula
2016-06-04 11:37 ` [PATCH v2 28/38] kernel-doc/rst: remove fixme comment Jani Nikula
2016-06-04 11:37 ` [PATCH v2 29/38] kernel-doc: limit the "section header:" detection to a select few Jani Nikula
2016-06-09 15:03   ` Jonathan Corbet
2016-06-09 16:39     ` Jani Nikula
2016-06-04 11:37 ` [PATCH v2 30/38] kernel-doc: concatenate contents of colliding sections Jani Nikula
2016-06-04 11:37 ` [PATCH v2 31/38] kernel-doc: reset contents and section harder Jani Nikula
2016-06-04 11:37 ` [PATCH v2 32/38] Documentation/sphinx: fix kernel-doc extension on python3 Jani Nikula
2016-06-04 11:37 ` [PATCH v2 33/38] doc/sphinx: Pass right filename as source Jani Nikula
2016-06-04 11:37 ` [PATCH v2 34/38] scripts/kernel-doc: Remove duplicated DOC: start handling Jani Nikula
2016-06-04 11:37 ` [PATCH v2 35/38] doc/sphinx: Stop touching state_machine internals Jani Nikula
2016-06-04 11:37 ` [PATCH v2 36/38] scripts/kernel-doc: Also give functions symbolic names Jani Nikula
2016-06-04 11:37 ` [PATCH v2 37/38] scripts/kernel-doc: Add option to inject line numbers Jani Nikula
2016-06-04 11:37 ` [PATCH v2 38/38] doc/sphinx: Track line-number of starting blocks Jani Nikula
2016-06-04 12:15 ` [PATCH v2 00/38] Documentation/sphinx Daniel Vetter
2016-06-09 19:55 ` Jonathan Corbet
2016-06-10 18:17   ` Daniel Vetter
2016-06-10 20:41     ` Dave Airlie
2016-06-14  8:15       ` Daniel Vetter
2016-06-14 19:23         ` 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=c099ff6989baf286da8eaed5c7b3d18ae60ea2e7.1465031816.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=corbet@lwn.net \
    --cc=daniel.vetter@ffwll.ch \
    --cc=grant.likely@secretlab.ca \
    --cc=hverkuil@xs4all.nl \
    --cc=keithp@keithp.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus.heiser@darmarit.de \
    --cc=mchehab@osg.samsung.com \
    /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;
as well as URLs for NNTP newsgroup(s).