Re: [PATCH v5 10/15] docs: sphinx: add a parser for yaml files for Netlink specs

Mauro Carvalho Chehab <[email protected]>
Newsgroups dev.linux.lists.lkmm,dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>
Em Tue, 17 Jun 2025 18:23:22 +0100
Donald Hunter <[email protected]> escreveu:

> On Tue, 17 Jun 2025 at 17:00, Mauro Carvalho Chehab
> <[email protected]> wrote:
> > >
> > > (2) is cleaner and faster, but (1) is easier to implement on an
> > > already-existing code.  
> >
> > The logic below implements (1). This seems to be the easiest way for
> > pyyaml. I will submit as 2 separate patches at the end of the next
> > version.
> >
> > Please notice that I didn't check yet for the "quality" of the
> > line numbers. Some tweaks could be needed later on.  
> 
> Thanks for working on this. I suppose we might be able to work on an
> evolution from (1) to (2) in a followup piece of work?

Yes, it shouldn't be hard for you to migrate to (2) in the future. 

Currently, the parser is stateless, but, as there's now a class,
IMO the best would be to store the lines as an array of tuples
inside the YnlDocGenerator class, like this:

	self.lines = [
		(line_number1, message_string1),
		(line_number2, message_string2),
		(line_number3, message_string3),
		(line_number4, message_string4),
		...
	]

This way, the parse_yaml_file() method would just return self.lines.

Thanks,
Mauro
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.