From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Cc: corbet@lwn.net
Subject: [PATCH 4/5] kernel-doc: make member highlighting available in all backends
Date: Mon, 2 Jan 2017 16:22:26 +0100 [thread overview]
Message-ID: <20170102152227.9446-5-pbonzini@redhat.com> (raw)
In-Reply-To: <20170102152227.9446-1-pbonzini@redhat.com>
Note that, in order to produce the correct Docbook markup, the "." or "->"
must be separated from the member name in the regex's captured fields. For
consistency, this change is applied to $type_member and $type_member_func
too, not just to $type_member_xml.
List mode only prints the struct name, to avoid any undesired change in
the operation of docproc.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/kernel-doc | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index e5b5daa147ea..88c3290b6056 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -199,12 +199,12 @@ EOF
# 'funcname()' - function
# '$ENVVAR' - environmental variable
# '&struct_name' - name of a structure (up to two words including 'struct')
+# '&struct_name.member' - name of a structure member
# '@parameter' - name of a parameter
# '%CONST' - name of a constant.
## init lots of data
-
my $errors = 0;
my $warnings = 0;
my $anon_struct_union = 0;
@@ -221,7 +221,8 @@ my $type_enum_full = '\&(enum)\s*([_\w]+)';
my $type_struct_full = '\&(struct)\s*([_\w]+)';
my $type_typedef_full = '\&(typedef)\s*([_\w]+)';
my $type_union_full = '\&(union)\s*([_\w]+)';
-my $type_member = '\&([_\w]+)((\.|->)[_\w]+)';
+my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
+my $type_member_xml = '\&([_\w]+)(\.|-\>)([_\w]+)';
my $type_member_func = $type_member . '\(\)';
# Output conversion substitutions.
@@ -233,7 +234,8 @@ my @highlights_html = (
[$type_func, "<b>\$1</b>"],
[$type_struct_xml, "<i>\$1</i>"],
[$type_env, "<b><i>\$1</i></b>"],
- [$type_param, "<tt><b>\$1</b></tt>"]
+ [$type_param, "<tt><b>\$1</b></tt>"],
+ [$type_member_xml, "<tt><i>\$1</i>\$2\$3</tt>"]
);
my $local_lt = "\\\\\\\\lt:";
my $local_gt = "\\\\\\\\gt:";
@@ -245,7 +247,8 @@ my @highlights_html5 = (
[$type_func, "<span class=\"func\">\$1</span>"],
[$type_struct_xml, "<span class=\"struct\">\$1</span>"],
[$type_env, "<span class=\"env\">\$1</span>"],
- [$type_param, "<span class=\"param\">\$1</span>]"]
+ [$type_param, "<span class=\"param\">\$1</span>]"],
+ [$type_member_xml, "<span class=\"literal\"><span class=\"struct\">\$1</span>\$2<span class=\"member\">\$3</span></span>"]
);
my $blankline_html5 = $local_lt . "br /" . $local_gt;
@@ -256,7 +259,8 @@ my @highlights_xml = (
[$type_struct_xml, "<structname>\$1</structname>"],
[$type_param, "<parameter>\$1</parameter>"],
[$type_func, "<function>\$1</function>"],
- [$type_env, "<envar>\$1</envar>"]
+ [$type_env, "<envar>\$1</envar>"],
+ [$type_member_xml, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"]
);
my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n";
@@ -266,7 +270,8 @@ my @highlights_gnome = (
[$type_func, "<function>\$1</function>"],
[$type_struct, "<structname>\$1</structname>"],
[$type_env, "<envar>\$1</envar>"],
- [$type_param, "<parameter>\$1</parameter>" ]
+ [$type_param, "<parameter>\$1</parameter>" ],
+ [$type_member, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"]
);
my $blankline_gnome = "</para><para>\n";
@@ -275,7 +280,8 @@ my @highlights_man = (
[$type_constant, "\$1"],
[$type_func, "\\\\fB\$1\\\\fP"],
[$type_struct, "\\\\fI\$1\\\\fP"],
- [$type_param, "\\\\fI\$1\\\\fP"]
+ [$type_param, "\\\\fI\$1\\\\fP"],
+ [$type_member, "\\\\fI\$1\$2\$3\\\\fP"]
);
my $blankline_man = "";
@@ -284,7 +290,8 @@ my @highlights_text = (
[$type_constant, "\$1"],
[$type_func, "\$1"],
[$type_struct, "\$1"],
- [$type_param, "\$1"]
+ [$type_param, "\$1"],
+ [$type_member, "\$1\$2\$3"]
);
my $blankline_text = "";
@@ -292,8 +299,8 @@ my $blankline_text = "";
my @highlights_rst = (
[$type_constant, "``\$1``"],
# Note: need to escape () to avoid func matching later
- [$type_member_func, "\\:c\\:type\\:`\$1\$2\\\\(\\\\) <\$1>`"],
- [$type_member, "\\:c\\:type\\:`\$1\$2 <\$1>`"],
+ [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"],
+ [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"],
[$type_fp_param, "**\$1\\\\(\\\\)**"],
[$type_func, "\\:c\\:func\\:`\$1()`"],
[$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
@@ -311,7 +318,8 @@ my @highlights_list = (
[$type_constant, "\$1"],
[$type_func, "\$1"],
[$type_struct, "\$1"],
- [$type_param, "\$1"]
+ [$type_param, "\$1"],
+ [$type_member, "\$1"]
);
my $blankline_list = "";
--
2.9.3
next prev parent reply other threads:[~2017-01-02 15:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 15:22 [PATCH 0/5] kernel-doc tweaks and cleanup of rST vs. non-rST backends Paolo Bonzini
2017-01-02 15:22 ` [PATCH 1/5] kernel-doc: cleanup parameter type in function-typed arguments Paolo Bonzini
2017-01-02 15:22 ` [PATCH 2/5] kernel-doc: strip attributes even if they have an argument Paolo Bonzini
2017-01-02 15:22 ` [PATCH 3/5] kernel-doc: include parameter type in docbook output Paolo Bonzini
2017-01-02 15:22 ` Paolo Bonzini [this message]
2017-01-02 15:22 ` [PATCH 5/5] kernel-doc: make highlights more homogenous for the various backends Paolo Bonzini
2017-01-03 9:57 ` [PATCH 0/5] kernel-doc tweaks and cleanup of rST vs. non-rST backends Jani Nikula
2017-01-04 15:13 ` Paolo Bonzini
2017-01-04 15:40 ` Jani Nikula
2017-01-04 22:06 ` Jonathan Corbet
2017-01-23 13:42 ` Markus Heiser
2017-01-23 13:58 ` Paolo Bonzini
2017-01-23 14:38 ` Markus Heiser
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=20170102152227.9446-5-pbonzini@redhat.com \
--to=pbonzini@redhat.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
Powered by JetHome