From: Jani Nikula <jani.nikula@linux.intel.com>
To: Matthew Wilcox <willy@infradead.org>,
Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel-doc: Let backtick and backslash escape percent sign
Date: Mon, 08 Apr 2019 12:58:17 +0300 [thread overview]
Message-ID: <87sgusizt2.fsf@intel.com> (raw)
In-Reply-To: <20190405231024.GR22763@bombadil.infradead.org>
On Fri, 05 Apr 2019, Matthew Wilcox <willy@infradead.org> wrote:
> On Fri, Apr 05, 2019 at 02:18:20PM -0700, Sean Christopherson wrote:
>> There are a handful of instances where kernel doc comments want an
>> actual '%' in the final output, e.g. vsnprintf() wants to display "%n"
>> and "%p" to document format specifiers, and assembly functions that use
>> a custom call ABI may want to document their register usage, e.g. %eax.
>>
>> Because kernel-doc unconditionally interprets '%' followed by a word
>> character as a constant definition, i.e. %CONST, it's impossible to get
>> an actual '%\w' when kernel-doc is used to translate comments into rst
>> format. Treat backtick and backlash as escaping '%', the former to
>> handle '%' in a ``LITERAL``, and the latter to allow '%' when using
>> standard formatting.
>>
>> An alternative option would be to define a fancier set of rules for
>> interpreting '%' so that explicit escaping would not be required. For
>> example, require "%CONST" to be preceded by a recognized set of
>> characters, e.g. whitespace, opening parenthesis, etc... But the list
>> of recognized characters is quite large even in the current code base,
>> and using '\' to escape is more common and intuitive, i.e. most people
>> will naturally try doing "\%..." to get the desired formatting, whereas
>> losing %CONST formatting because of an unrecognized character is likely
>> to cause confusion.
>
> Would it make sense to have %% turn into % rather than forcing quotation
> marks?
The problem is not limited to % though.
I see two long-term solutions to the problem:
1) Define proper escaping and quoting rules for kernel-doc to pass
through stuff as-is to Sphinx. This may be difficult to implement
because, well, see kernel-doc source.
2) Figure out how to do the kernel-doc references and highlights in the
Sphinx extension after all the reStructuredText processing.
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2019-04-08 9:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-05 21:18 [PATCH] kernel-doc: Let backtick and backslash escape percent sign Sean Christopherson
2019-04-05 23:10 ` Matthew Wilcox
2019-04-08 9:58 ` Jani Nikula [this message]
2019-04-08 22:03 ` Jonathan Corbet
2019-04-09 14:39 ` Sean Christopherson
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=87sgusizt2.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sean.j.christopherson@intel.com \
--cc=willy@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.