From: Jani Nikula <jani.nikula@intel.com>
To: Jonathan Corbet <corbet@lwn.net>, linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Jani Nikula <jani.nikula@intel.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [RFC 04/10] kernel-doc: add support for printing DOC: comments with escaped names
Date: Tue, 26 Jan 2016 14:08:49 +0200 [thread overview]
Message-ID: <bd0b873fdc5f13f67c2bf24f53757c1ff418d63d.1453809420.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1453809420.git.jani.nikula@intel.com>
In-Reply-To: <cover.1453809420.git.jani.nikula@intel.com>
-function supports printing named DOC: sections, but spaces and braces
and quotes etc. are allowed in section titles. This is tricky to handle
in scripts, let alone Makefiles.
Add a new -doc parameter for dumping doc sections (to not convolute
-function more than it already is), with support for "escaped" names
with everything non-alphanumeric repaced with underscores, in addition
to verbatim names.
For example, all these three now do the same thing:
$ scripts/kernel-doc -function "Panel Self Refresh (PSR/SRD)" drivers/gpu/drm/i915/intel_psr.c
$ scripts/kernel-doc -doc "Panel Self Refresh (PSR/SRD)" drivers/gpu/drm/i915/intel_psr.c
$ scripts/kernel-doc -doc "Panel_Self_Refresh__PSR_SRD_" drivers/gpu/drm/i915/intel_psr.c
Use of -function for extracting DOC: sections should probably be
deprecated, but keep it around for backward compatibility.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
scripts/kernel-doc | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index ee2ac9137a43..0e410daa92a9 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -71,6 +71,9 @@ Output selection (mutually exclusive):
-nofunction NAME Do NOT output documentation for the given function(s);
only output documentation for the other functions and
DOC: sections. May be specified multiple times.
+ -doc NAME Only output documentation for the given DOC: section
+ titles. NAME is matched both as-is and with all
+ non-alphanumeric characters replaced with underscores.
Output selection modifiers:
-no-doc-sections Do not output DOC: sections.
@@ -457,6 +460,10 @@ while ($ARGV[0] =~ m/^-(.*)/) {
} elsif ($cmd eq "-internal") { # only non-exported symbols
$function_only = 4;
%function_table = ()
+ } elsif ($cmd eq "-doc") { # to only output specific doc sections
+ $function_only = 5;
+ $function = shift @ARGV;
+ $function_table{$function} = 1;
} elsif ($cmd eq "-v") {
$verbose = 1;
} elsif (($cmd eq "-h") || ($cmd eq "--help")) {
@@ -520,14 +527,20 @@ sub dump_doc_section {
my $file = shift;
my $name = shift;
my $contents = join "\n", @_;
+ my $escaped_name = $name;
if ($no_doc_sections) {
return;
}
+ $escaped_name =~ s/[^a-zA-Z0-9]/_/g;
+
if (($function_only == 0) ||
( $function_only == 1 && defined($function_table{$name})) ||
- ( $function_only == 2 && !defined($function_table{$name})))
+ ( $function_only == 2 && !defined($function_table{$name})) ||
+ ( $function_only == 5 &&
+ (defined($function_table{$name}) ||
+ defined($function_table{$escaped_name}))))
{
dump_section($file, $name, $contents);
output_blockhead({'sectionlist' => \@sectionlist,
--
2.1.4
next prev parent reply other threads:[~2016-01-26 12:11 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-25 23:28 [RFC] A first shot at asciidoc-based formatted docs Jonathan Corbet
2016-01-25 23:28 ` [PATCH 1/4] kernel-doc: add support for asciidoc output Jonathan Corbet
2016-01-25 23:28 ` [PATCH 2/4] docproc: handle asciidoc templates Jonathan Corbet
2016-01-25 23:28 ` [PATCH 3/4] Docs: Makefile tweaks for " Jonathan Corbet
2016-01-25 23:28 ` [PATCH 4/4] Docs: add a sample asciidoc template Jonathan Corbet
2016-01-26 12:08 ` [RFC] A first shot at asciidoc-based formatted docs Jani Nikula
2016-01-26 12:08 ` [RFC 01/10] kernel-doc: rewrite usage description, remove duplicated comments Jani Nikula
2016-01-26 12:08 ` [RFC 02/10] kernel-doc: add support for asciidoc output Jani Nikula
2016-01-26 12:08 ` [RFC 03/10] kernel-doc: support printing exported and non-exported symbols Jani Nikula
2016-01-26 12:08 ` Jani Nikula [this message]
2016-01-26 12:08 ` [RFC 05/10] scripts: add asciidoc-includes to extract includes from asciidoc Jani Nikula
2016-01-26 12:08 ` [RFC 06/10] scripts: add a kernel-doc helper for special invocation Jani Nikula
2016-01-26 12:08 ` [RFC 07/10] scripts: add tool for generating asciidoc dependencies and rules Jani Nikula
2016-01-26 12:08 ` [RFC 08/10] scripts: add a crude converter from DocBook tmpl to asciidoc Jani Nikula
2016-01-26 12:08 ` [RFC 09/10] Documentation: convert gpu.tmpl to gpu.txt Jani Nikula
2016-01-26 12:08 ` [RFC 10/10] Documentation: build asciidoc documentation Jani Nikula
2016-01-26 12:17 ` [RFC] A first shot at asciidoc-based formatted docs Daniel Vetter
2016-01-26 12:38 ` Jani Nikula
2016-01-26 14:48 ` Jonathan Corbet
2016-01-26 14:52 ` Jonathan Corbet
2016-02-10 0:09 ` Jonathan Corbet
2016-02-10 8:07 ` Daniel Vetter
2016-02-10 14:03 ` Jani Nikula
2016-02-10 16:12 ` Jani Nikula
2016-02-10 20:56 ` Jonathan Corbet
2016-02-11 15:18 ` Keith Packard
2016-02-10 20:45 ` Jonathan Corbet
2016-02-10 23:01 ` Keith Packard
2016-02-11 13:44 ` Jani Nikula
2016-02-11 15:21 ` Keith Packard
2016-02-13 3:20 ` Keith Packard
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=bd0b873fdc5f13f67c2bf24f53757c1ff418d63d.1453809420.git.jani.nikula@intel.com \
--to=jani.nikula@intel.com \
--cc=corbet@lwn.net \
--cc=daniel.vetter@ffwll.ch \
--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®