[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2ms9c5din.fsf@gmail.com>
Date: Thu, 10 Jul 2025 15:25:20 +0100
From: Donald Hunter <donald.hunter@...il.com>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc: Linux Doc Mailing List <linux-doc@...r.kernel.org>, Jonathan Corbet
<corbet@....net>, "Akira Yokosawa" <akiyks@...il.com>, "Breno Leitao"
<leitao@...ian.org>, "David S. Miller" <davem@...emloft.net>, "Eric
Dumazet" <edumazet@...gle.com>, "Ignacio Encinas Rubio"
<ignacio@...cinas.com>, "Jan Stancek" <jstancek@...hat.com>, "Marco
Elver" <elver@...gle.com>, "Paolo Abeni" <pabeni@...hat.com>, "Randy
Dunlap" <rdunlap@...radead.org>, "Ruben Wauters" <rubenru09@....com>,
"Shuah Khan" <skhan@...uxfoundation.org>, Jakub Kicinski
<kuba@...nel.org>, Simon Horman <horms@...nel.org>,
joel@...lfernandes.org, linux-kernel-mentees@...ts.linux.dev,
linux-kernel@...r.kernel.org, lkmm@...ts.linux.dev,
netdev@...r.kernel.org, peterz@...radead.org, stern@...land.harvard.edu
Subject: Re: [PATCH v9 12/13] docs: parser_yaml.py: add support for line
numbers from the parser
Donald Hunter <donald.hunter@...il.com> writes:
>> # Parse message with RSTParser
>> - for i, line in enumerate(msg.split('\n')):
>> - result.append(line, document.current_source, i)
>> + lineoffset = 0;
>> + for line in msg.split('\n'):
>> + match = self.re_lineno.match(line)
>> + if match:
>> + lineoffset = int(match.group(1))
>> + continue
>> +
>> + result.append(line, document.current_source, lineoffset)
>
> I expect this would need to be source=document.current_source, offset=lineoffset
Ignore that. I see it's not kwargs. It's just the issue below.
>> rst_parser = RSTParser()
>> rst_parser.parse('\n'.join(result), document)
>
> But anyway this discards any line information by just concatenating the
> lines together again.
Looks to me like there's no Parser() API that works with ViewList() so
it would be necessary to directly use the docutils RSTStateMachine() for
this approach to work.
Powered by blists - more mailing lists