From 927dc445ddd99feb7373eb046e365f48897ff38d 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 b0287f2d1..47a847ee4 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 71e8eecd1..58e65c2ea 100644 --- a/docs/util/cellref.py +++ b/docs/util/cellref.py @@ -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 diff --git a/docs/util/cmdref.py b/docs/util/cmdref.py index c177fdfa6..a31b08e0d 100644 --- a/docs/util/cmdref.py +++ b/docs/util/cmdref.py @@ -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."""