Skip to content

Commit 927dc44

Browse files
Docs: Render cell titles
Also put property lists *after* cell description.
1 parent 7216f07 commit 927dc44

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

docs/source/cell/word_binary.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
Binary operators
55
~~~~~~~~~~~~~~~~
66

7-
.. TODO:: display cell titles
8-
97
All binary RTL cells have two input ports ``A`` and ``B`` and one output port
108
``Y``. They also have the following parameters:
119

docs/util/cellref.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,8 @@ def add_directive_header(self, sig: str) -> None:
305305
val = ' '.join(val)
306306
if val:
307307
self.add_line(f' :{attr}: {val}', sourcename)
308-
309-
self.add_line('\n', sourcename)
310308

311-
# fields
312-
field_attrs = ["properties", ]
313-
for field in field_attrs:
314-
attr = getattr(cell, field, [])
315-
for val in attr:
316-
self.add_line(f' :{field} {val}:', sourcename)
309+
self.add_line('\n', sourcename)
317310

318311
if self.options.noindex:
319312
self.add_line(' :noindex:', sourcename)
@@ -331,6 +324,14 @@ def add_content(self, more_content: Any | None) -> None:
331324
for line, src in zip(more_content.data, more_content.items):
332325
self.add_line(line, src[0], src[1])
333326

327+
# fields
328+
self.add_line('\n', sourcename)
329+
field_attrs = ["properties", ]
330+
for field in field_attrs:
331+
attr = getattr(self.object, field, [])
332+
for val in attr:
333+
self.add_line(f':{field} {val}:', sourcename)
334+
334335
def get_object_members(
335336
self,
336337
want_all: bool

docs/util/cmdref.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@ def add_target_and_index(
209209
self.env.docname,
210210
idx,
211211
0))
212+
213+
def transform_content(self, contentnode: addnodes.desc_content) -> None:
214+
# Add the cell title to the body
215+
if 'title' in self.options:
216+
titlenode = nodes.paragraph()
217+
titlenode += nodes.strong()
218+
titlenode[-1] += nodes.Text(self.options['title'])
219+
contentnode.insert(0, titlenode)
212220

213221
class CellSourceNode(TocNode):
214222
"""A custom code block for including cell source."""

0 commit comments

Comments
 (0)