[lkml]   [2020]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v3 0/1] Compactly make code examples into literal blocks
On Thu, 26 Mar 2020, wrote:
> From: Peter Lister <>
> [ A couple of typos corrected. Thanks, Matthew ]
> In a previous patch, I fixed a couple of doc build warnings due to a
> section heading "Example:" which didn't have the intended effect of
> inserting a heading and literal quoting the following code snippet. I
> added an explicit double colon to fix warnings and produce nice ReST.
> Jon suggested that I could have used a minimal form "Example::".
> Unfortunately not - kernel-doc munges the output so that the formatted
> output ends up as a stray colon and no literal block.
> Looking around in the source tree, it seems that parameter definitions
> can be more complex than the original authors of kernel-doc allowed
> for. Return values often need lists and examples often should be
> literal blocks. Many comments in the source are "ASCII formatted" but
> kernel-doc can make a mess of them and generate doc build warnings
> along the way.
> It seems useful to support some terse idioms which serve as compact
> source annotation and also generate well formed ReST.
> Here is a first try to let a heading directly introduce a literal
> block - the "Example::" form for code snippets and an update to
> platform.c to use it, just as Jon suggested.

IMHO the real problem is kernel-doc doing too much preprocessing on the
input, preventing us from doing what would be the sensible thing in
rst. The more we try to fix the problem by adding more kernel-doc
processing, the further we dig ourselves into this hole.

If kernel-doc didn't have its own notion of section headers, such as
"example:", we wouldn't have this problem to begin with. We could just
use the usual rst construct; "example::" followed by an indented block.

I'm not going to stand in the way of the patch, but I'm telling you,
this is going to get harder, not easier, on this path.


Jani Nikula, Intel Open Source Graphics Center

 \ /
  Last update: 2020-03-27 12:29    [W:0.080 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site