docs: kdoc: Centralize handling of the item section list

The section list always comes directly from the under-construction entry
and is used uniformly.  Formalize section handling in the KdocItem class,
and have output_declaration() load the sections directly from the entry,
eliminating a lot of duplicated, verbose parameters.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
Jonathan Corbet
2025-07-01 16:47:59 -06:00
parent 8d9d122915
commit 8d7338752d
3 changed files with 25 additions and 40 deletions

View File

@@ -9,6 +9,8 @@ class KdocItem:
self.name = name
self.type = type
self.declaration_start_line = start_line
self.sections = {}
self.sections_start_lines = {}
#
# Just save everything else into our own dict so that the output
# side can grab it directly as before. As we move things into more
@@ -24,3 +26,10 @@ class KdocItem:
def __getitem__(self, key):
return self.get(key)
#
# Tracking of section information.
#
def set_sections(self, sections, start_lines):
self.sections = sections
self.section_start_lines = start_lines