diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2017-01-02 10:22:26 -0500 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2017-01-04 17:08:03 -0500 |
commit | 5267dd354bcd267f76d0f97193fe8a93899f8986 (patch) | |
tree | ed36e1e60a5cffd9c7a4ccc2f16bf6826e0e7393 | |
parent | fc6d7af89fa968c378d4437d7905ccd76efa6af4 (diff) |
kernel-doc: make member highlighting available in all backends
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>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rwxr-xr-x | scripts/kernel-doc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 5476cf4f4673..d5e9f765b4fc 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -199,12 +199,12 @@ EOF | |||
199 | # 'funcname()' - function | 199 | # 'funcname()' - function |
200 | # '$ENVVAR' - environmental variable | 200 | # '$ENVVAR' - environmental variable |
201 | # '&struct_name' - name of a structure (up to two words including 'struct') | 201 | # '&struct_name' - name of a structure (up to two words including 'struct') |
202 | # '&struct_name.member' - name of a structure member | ||
202 | # '@parameter' - name of a parameter | 203 | # '@parameter' - name of a parameter |
203 | # '%CONST' - name of a constant. | 204 | # '%CONST' - name of a constant. |
204 | 205 | ||
205 | ## init lots of data | 206 | ## init lots of data |
206 | 207 | ||
207 | |||
208 | my $errors = 0; | 208 | my $errors = 0; |
209 | my $warnings = 0; | 209 | my $warnings = 0; |
210 | my $anon_struct_union = 0; | 210 | my $anon_struct_union = 0; |
@@ -221,7 +221,8 @@ my $type_enum_full = '\&(enum)\s*([_\w]+)'; | |||
221 | my $type_struct_full = '\&(struct)\s*([_\w]+)'; | 221 | my $type_struct_full = '\&(struct)\s*([_\w]+)'; |
222 | my $type_typedef_full = '\&(typedef)\s*([_\w]+)'; | 222 | my $type_typedef_full = '\&(typedef)\s*([_\w]+)'; |
223 | my $type_union_full = '\&(union)\s*([_\w]+)'; | 223 | my $type_union_full = '\&(union)\s*([_\w]+)'; |
224 | my $type_member = '\&([_\w]+)((\.|->)[_\w]+)'; | 224 | my $type_member = '\&([_\w]+)(\.|->)([_\w]+)'; |
225 | my $type_member_xml = '\&([_\w]+)(\.|-\>)([_\w]+)'; | ||
225 | my $type_member_func = $type_member . '\(\)'; | 226 | my $type_member_func = $type_member . '\(\)'; |
226 | 227 | ||
227 | # Output conversion substitutions. | 228 | # Output conversion substitutions. |
@@ -233,7 +234,8 @@ my @highlights_html = ( | |||
233 | [$type_func, "<b>\$1</b>"], | 234 | [$type_func, "<b>\$1</b>"], |
234 | [$type_struct_xml, "<i>\$1</i>"], | 235 | [$type_struct_xml, "<i>\$1</i>"], |
235 | [$type_env, "<b><i>\$1</i></b>"], | 236 | [$type_env, "<b><i>\$1</i></b>"], |
236 | [$type_param, "<tt><b>\$1</b></tt>"] | 237 | [$type_param, "<tt><b>\$1</b></tt>"], |
238 | [$type_member_xml, "<tt><i>\$1</i>\$2\$3</tt>"] | ||
237 | ); | 239 | ); |
238 | my $local_lt = "\\\\\\\\lt:"; | 240 | my $local_lt = "\\\\\\\\lt:"; |
239 | my $local_gt = "\\\\\\\\gt:"; | 241 | my $local_gt = "\\\\\\\\gt:"; |
@@ -245,7 +247,8 @@ my @highlights_html5 = ( | |||
245 | [$type_func, "<span class=\"func\">\$1</span>"], | 247 | [$type_func, "<span class=\"func\">\$1</span>"], |
246 | [$type_struct_xml, "<span class=\"struct\">\$1</span>"], | 248 | [$type_struct_xml, "<span class=\"struct\">\$1</span>"], |
247 | [$type_env, "<span class=\"env\">\$1</span>"], | 249 | [$type_env, "<span class=\"env\">\$1</span>"], |
248 | [$type_param, "<span class=\"param\">\$1</span>]"] | 250 | [$type_param, "<span class=\"param\">\$1</span>]"], |
251 | [$type_member_xml, "<span class=\"literal\"><span class=\"struct\">\$1</span>\$2<span class=\"member\">\$3</span></span>"] | ||
249 | ); | 252 | ); |
250 | my $blankline_html5 = $local_lt . "br /" . $local_gt; | 253 | my $blankline_html5 = $local_lt . "br /" . $local_gt; |
251 | 254 | ||
@@ -256,7 +259,8 @@ my @highlights_xml = ( | |||
256 | [$type_struct_xml, "<structname>\$1</structname>"], | 259 | [$type_struct_xml, "<structname>\$1</structname>"], |
257 | [$type_param, "<parameter>\$1</parameter>"], | 260 | [$type_param, "<parameter>\$1</parameter>"], |
258 | [$type_func, "<function>\$1</function>"], | 261 | [$type_func, "<function>\$1</function>"], |
259 | [$type_env, "<envar>\$1</envar>"] | 262 | [$type_env, "<envar>\$1</envar>"], |
263 | [$type_member_xml, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"] | ||
260 | ); | 264 | ); |
261 | my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n"; | 265 | my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n"; |
262 | 266 | ||
@@ -266,7 +270,8 @@ my @highlights_gnome = ( | |||
266 | [$type_func, "<function>\$1</function>"], | 270 | [$type_func, "<function>\$1</function>"], |
267 | [$type_struct, "<structname>\$1</structname>"], | 271 | [$type_struct, "<structname>\$1</structname>"], |
268 | [$type_env, "<envar>\$1</envar>"], | 272 | [$type_env, "<envar>\$1</envar>"], |
269 | [$type_param, "<parameter>\$1</parameter>" ] | 273 | [$type_param, "<parameter>\$1</parameter>" ], |
274 | [$type_member, "<literal><structname>\$1</structname>\$2<structfield>\$3</structfield></literal>"] | ||
270 | ); | 275 | ); |
271 | my $blankline_gnome = "</para><para>\n"; | 276 | my $blankline_gnome = "</para><para>\n"; |
272 | 277 | ||
@@ -275,7 +280,8 @@ my @highlights_man = ( | |||
275 | [$type_constant, "\$1"], | 280 | [$type_constant, "\$1"], |
276 | [$type_func, "\\\\fB\$1\\\\fP"], | 281 | [$type_func, "\\\\fB\$1\\\\fP"], |
277 | [$type_struct, "\\\\fI\$1\\\\fP"], | 282 | [$type_struct, "\\\\fI\$1\\\\fP"], |
278 | [$type_param, "\\\\fI\$1\\\\fP"] | 283 | [$type_param, "\\\\fI\$1\\\\fP"], |
284 | [$type_member, "\\\\fI\$1\$2\$3\\\\fP"] | ||
279 | ); | 285 | ); |
280 | my $blankline_man = ""; | 286 | my $blankline_man = ""; |
281 | 287 | ||
@@ -284,7 +290,8 @@ my @highlights_text = ( | |||
284 | [$type_constant, "\$1"], | 290 | [$type_constant, "\$1"], |
285 | [$type_func, "\$1"], | 291 | [$type_func, "\$1"], |
286 | [$type_struct, "\$1"], | 292 | [$type_struct, "\$1"], |
287 | [$type_param, "\$1"] | 293 | [$type_param, "\$1"], |
294 | [$type_member, "\$1\$2\$3"] | ||
288 | ); | 295 | ); |
289 | my $blankline_text = ""; | 296 | my $blankline_text = ""; |
290 | 297 | ||
@@ -292,8 +299,8 @@ my $blankline_text = ""; | |||
292 | my @highlights_rst = ( | 299 | my @highlights_rst = ( |
293 | [$type_constant, "``\$1``"], | 300 | [$type_constant, "``\$1``"], |
294 | # Note: need to escape () to avoid func matching later | 301 | # Note: need to escape () to avoid func matching later |
295 | [$type_member_func, "\\:c\\:type\\:`\$1\$2\\\\(\\\\) <\$1>`"], | 302 | [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], |
296 | [$type_member, "\\:c\\:type\\:`\$1\$2 <\$1>`"], | 303 | [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], |
297 | [$type_fp_param, "**\$1\\\\(\\\\)**"], | 304 | [$type_fp_param, "**\$1\\\\(\\\\)**"], |
298 | [$type_func, "\\:c\\:func\\:`\$1()`"], | 305 | [$type_func, "\\:c\\:func\\:`\$1()`"], |
299 | [$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"], | 306 | [$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"], |
@@ -311,7 +318,8 @@ my @highlights_list = ( | |||
311 | [$type_constant, "\$1"], | 318 | [$type_constant, "\$1"], |
312 | [$type_func, "\$1"], | 319 | [$type_func, "\$1"], |
313 | [$type_struct, "\$1"], | 320 | [$type_struct, "\$1"], |
314 | [$type_param, "\$1"] | 321 | [$type_param, "\$1"], |
322 | [$type_member, "\$1"] | ||
315 | ); | 323 | ); |
316 | my $blankline_list = ""; | 324 | my $blankline_list = ""; |
317 | 325 | ||