Skip to content

Commit

Permalink
Docs: Render cell titles
Browse files Browse the repository at this point in the history
Also put property lists *after* cell description.
  • Loading branch information
KrystalDelusion committed Sep 16, 2024
1 parent bc4ff8e commit 340259b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 0 additions & 2 deletions docs/source/cell/word_binary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
17 changes: 9 additions & 8 deletions docs/util/cellref.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,8 @@ def add_directive_header(self, sig: str) -> None:
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)
Expand All @@ -331,6 +324,14 @@ def add_content(self, more_content: Any | None) -> None:
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
Expand Down
8 changes: 8 additions & 0 deletions docs/util/cmdref.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ def add_target_and_index(
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."""
Expand Down

0 comments on commit 340259b

Please sign in to comment.