Docs: Render cell titles

Also put property lists *after* cell description.
This commit is contained in:
Krystine Sherwin 2024-09-16 14:11:01 +12:00
parent 7216f07691
commit 927dc445dd
No known key found for this signature in database
3 changed files with 17 additions and 10 deletions

View File

@ -4,8 +4,6 @@
Binary operators
~~~~~~~~~~~~~~~~
.. TODO:: display cell titles
All binary RTL cells have two input ports ``A`` and ``B`` and one output port
``Y``. They also have the following parameters:

View File

@ -305,15 +305,8 @@ class YosysCellDocumenter(YosysCellGroupDocumenter):
val = ' '.join(val)
if val:
self.add_line(f' :{attr}: {val}', sourcename)
self.add_line('\n', sourcename)
# fields
field_attrs = ["properties", ]
for field in field_attrs:
attr = getattr(cell, field, [])
for val in attr:
self.add_line(f' :{field} {val}:', sourcename)
self.add_line('\n', sourcename)
if self.options.noindex:
self.add_line(' :noindex:', sourcename)
@ -331,6 +324,14 @@ class YosysCellDocumenter(YosysCellGroupDocumenter):
for line, src in zip(more_content.data, more_content.items):
self.add_line(line, src[0], src[1])
# fields
self.add_line('\n', sourcename)
field_attrs = ["properties", ]
for field in field_attrs:
attr = getattr(self.object, field, [])
for val in attr:
self.add_line(f':{field} {val}:', sourcename)
def get_object_members(
self,
want_all: bool

View File

@ -209,6 +209,14 @@ class CellNode(TocNode):
self.env.docname,
idx,
0))
def transform_content(self, contentnode: addnodes.desc_content) -> None:
# Add the cell title to the body
if 'title' in self.options:
titlenode = nodes.paragraph()
titlenode += nodes.strong()
titlenode[-1] += nodes.Text(self.options['title'])
contentnode.insert(0, titlenode)
class CellSourceNode(TocNode):
"""A custom code block for including cell source."""