linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: "linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>
Subject: Re: excess bolding in html
Date: Fri, 30 Oct 2020 08:37:48 +0100	[thread overview]
Message-ID: <20201030083748.4db9848b@coco.lan> (raw)
In-Reply-To: <31362b3b-469f-1f74-d929-b6faa7ae4e30@infradead.org>

Hi Randy,

Em Thu, 29 Oct 2020 20:17:34 -0700
Randy Dunlap <rdunlap@infradead.org> escreveu:

> Hi,
> 
> I have noticed a few cases of excess bolding in generated html (seen in both
> Firefox and Opera web browsers).
> 
> (1) https://www.kernel.org/doc/html/latest/kernel-hacking/locking.html#futex-api-reference
> 
> In the description of struct hrtimer_sleeper * futex_setup_timer:
> 
> Both the Return line and the next following line are all bold, while the third (final)
> line is not bold (as expected):
> 
> Return
> 
> Initialized hrtimer_sleeper structure or NULL if no timeout
>     value given 

The problem is related to the indentation of "value given".

With ReST, this causes the first line to be print in bold.

The reason for that is that a common practice to describe
arguments on texts is to use this:

	foo
		Does foo things
	bar
		Does bar things

Without this feature at ReST, the above would need to be:

	**foo**

	Does foo things

	**bar**

	Does bar things

Which is more polluted with symbols, on text mode.

-

Just changing the kernel-doc markup at kernel/futex.c:

	/**
	 * futex_setup_timer - set up the sleeping hrtimer.
	 * @time:	ptr to the given timeout value
	 * @timeout:	the hrtimer_sleeper structure to be set up
	 * @flags:	futex flags
	 * @range_ns:	optional range in ns
	 *
	 * Return: Initialized hrtimer_sleeper structure or NULL if no timeout
	 *	   value given
	 */

To:

...
	 * Return:
	 *
	 * Initialized hrtimer_sleeper structure or NULL if no timeout
	 * value given 
	 */

Should fix it.



> 
> (2) https://www.kernel.org/doc/html/latest/filesystems/api-summary.html
> 
> In the description of int seq_open():
> 
> Both the Note line and the following line are all bold, while the final line
> is not bold (as expected):
> 
> Note
> 
> seq_open() will allocate a struct seq_file and store its
>     pointer in file->private_data. This pointer should not be modified. 
> 
> 
> 
> I looked at scripts/kernel-doc briefly but did not see where this is
> happening, so if anyone out there wants a small project to fix,
> please go for it.

We can't make kernel-doc ignore alignments, as otherwise other
things will break, as several kernel-doc markups use indents
for some things (like supporting literal-blocks).

So, such kind of fixes need to be done at the kernel-doc markups.

In this very specific case, though, I guess, some regex could
be used to convert things like:

	* Foo: some multiline
	*      description

into something like:

	* Foo:
	*
	*      some multiline
	*      description

or:

	* Foo:
	*
	* some multiline
	* description

kernel-doc uses this regex to match "Return":

	my $doc_sect = $doc_com .
	    '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)';

I guess something could be added after this:

    if (/$doc_sect/i) { # case insensitive for supported section names
        $newsection = $1;
        $newcontents = $2;


in order do to the replacement. Maybe something like this (untested):

    if (/$doc_sect/i) { # case insensitive for supported section names
        $newsection = $1;
        $newcontents = $2;

	my $spaces = $newsection;
	$spaces =~ s/\S/ /;

	$newcontents = $spaces . $newcontents;

Would do the trick.

Thanks,
Mauro

  reply	other threads:[~2020-10-30  7:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30  3:17 excess bolding in html Randy Dunlap
2020-10-30  7:37 ` Mauro Carvalho Chehab [this message]
2020-10-30 11:31   ` Matthew Wilcox
2020-10-30 12:28     ` Markus Heiser
2020-10-30 12:53       ` Matthew Wilcox
2020-10-30 14:00         ` Mauro Carvalho Chehab
2020-10-30 14:19           ` [PATCH RFC] scripts: kernel-doc: better handle spaces after section markups Mauro Carvalho Chehab
2020-10-30 17:30           ` excess bolding in html Randy Dunlap

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=20201030083748.4db9848b@coco.lan \
    --to=mchehab@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=rdunlap@infradead.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;
as well as URLs for NNTP newsgroup(s).