Linux Documentation
 help / color / mirror / Atom feed
From: Anna-Maria Behnsen <anna-maria@linutronix.de>
To: Matthew Wilcox <willy@infradead.org>, Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Subject: Re: Help required - kernel-doc, code block and backslash
Date: Tue, 16 Jan 2024 10:53:55 +0100	[thread overview]
Message-ID: <87o7dlsix8.fsf@somnus> (raw)
In-Reply-To: <ZaWSkvm8qsXgBVEP@casper.infradead.org>

Matthew Wilcox <willy@infradead.org> writes:

> On Mon, Jan 15, 2024 at 12:38:38PM -0700, Jonathan Corbet wrote:
>> Anna-Maria Behnsen <anna-maria@linutronix.de> writes:
>> 
>> > Hi,
>> >
>> > I'll try to integrate some documentation which is already written in
>> > code comments into the kernel documentation.
>> >
>> > There I face the problem with a backslash at the end of a line in a
>> > 'code block' and this ends up in removing the newline.
>> 
>> Yes, kernel-doc does that...looking at the history, that behavior was
>> added in 2012 (commit 65478428443) because otherwise multi-line macros
>> are not handled properly.
>> 
>> Fixing this properly is not going to be all that easy; the code reading
>> the source file is well before any sort of parsing, so it has no idea of
>> whether it's in a comment or not.
>> 
>> A really ugly workaround... put something relatively inconspicuous, like
>> "     .", after the backslash, and at least your formatting won't be
>> mangled.
>
> Well ... if we're into "ugly workaround" territory, we could use '^ *'
> as a marker for "we're in a comment, ignore the backslash".  My skills
> in this area are terrible, so would something like this work?
>
> while (!/^ \*/ && s/\\\s*$//) {

Thanks! A smoke test looks good (except of required clenaup of some
comments which use backslashes). But I'll have a deeper look at it to
verify it completely.

Thanks,

	Anna-Maria



  reply	other threads:[~2024-01-16  9:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 18:36 Help required - kernel-doc, code block and backslash Anna-Maria Behnsen
2024-01-15 19:38 ` Jonathan Corbet
2024-01-15 20:16   ` Matthew Wilcox
2024-01-16  9:53     ` Anna-Maria Behnsen [this message]
2024-01-15 20:35   ` Vegard Nossum
2024-01-16 16:55   ` Anna-Maria Behnsen
2024-01-16 18:28     ` Jonathan Corbet
2024-01-17 11:19       ` Anna-Maria Behnsen
2024-01-17 15:22         ` Jonathan Corbet

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=87o7dlsix8.fsf@somnus \
    --to=anna-maria@linutronix.de \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox