From 340259bf0de1f7418d8b1e302c82e939a2227b33 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:11:01 +1200 Subject: [PATCH] Docs: Render cell titles Also put property lists *after* cell description. --- docs/source/cell/word_binary.rst | 2 -- docs/util/cellref.py | 17 +++++++++-------- docs/util/cmdref.py | 8 ++++++++ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/source/cell/word_binary.rst b/docs/source/cell/word_binary.rst index b0287f2d1cd..47a847ee446 100644 --- a/docs/source/cell/word_binary.rst +++ b/docs/source/cell/word_binary.rst @@ -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: diff --git a/docs/util/cellref.py b/docs/util/cellref.py index 71e8eecd1c8..58e65c2eaea 100644 --- a/docs/util/cellref.py +++ b/docs/util/cellref.py @@ -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) @@ -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 diff --git a/docs/util/cmdref.py b/docs/util/cmdref.py index c177fdfa6b0..a31b08e0d51 100644 --- a/docs/util/cmdref.py +++ b/docs/util/cmdref.py @@ -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."""