From b61fa2b7bcdc7b503f0deaa6eb6e8eb027b83c77 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Mon, 11 Mar 2024 15:17:09 -0700 Subject: [PATCH 1/6] fix nesting code for links Signed-off-by: Jade Abraham --- sphinxcontrib/chapeldomain/__init__.py | 27 +++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sphinxcontrib/chapeldomain/__init__.py b/sphinxcontrib/chapeldomain/__init__.py index c3924f1..b02e2bc 100644 --- a/sphinxcontrib/chapeldomain/__init__.py +++ b/sphinxcontrib/chapeldomain/__init__.py @@ -422,19 +422,6 @@ def add_target_and_index(self, name_cls, sig, signode): self.indexnode['entries'].append(('single', indextext, fullname, '', None)) - def before_content(self): - """Called before parsing content. Set flag to help with class scoping. - """ - self.clsname_set = False - - def after_content(self): - """Called after parsing content. If any classes were added to the env - temp_data, make sure they are removed. - """ - if self.clsname_set: - self.env.temp_data.pop('chpl:class', None) - - class ChapelModule(Directive): """Directive to make description of a new module.""" @@ -596,7 +583,19 @@ def before_content(self): ChapelObject.before_content(self) if self.names: self.env.temp_data['chpl:class'] = self.names[0][0] - self.clsname_set = True + if not hasattr(self, 'clsname_set'): + self.clsname_set = 0 + self.clsname_set += 1 + + def after_content(self): + """Called after parsing content. Pop the class name from the class name""" + if self.clsname_set > 0: + val = self.env.temp_data.pop('chpl:class', None) + if val: + elms = val.split('.')[:-1] + self.env.temp_data['chpl:class'] ='.'.join(elms) + self.clsname_set -= 1 + class ChapelModuleLevel(ChapelObject): From e9bc8f5c9556b482cfb8bcba510e5670244c424c Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Mon, 11 Mar 2024 15:19:42 -0700 Subject: [PATCH 2/6] add nested test Signed-off-by: Jade Abraham --- doc-test/index.rst | 1 + doc-test/nested.rst | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 doc-test/nested.rst diff --git a/doc-test/index.rst b/doc-test/index.rst index 67da5ba..7b5f6b4 100644 --- a/doc-test/index.rst +++ b/doc-test/index.rst @@ -21,6 +21,7 @@ Module 'Foo' Containers foo cpp_test + nested **Does it work???** diff --git a/doc-test/nested.rst b/doc-test/nested.rst new file mode 100644 index 0000000..141fd8a --- /dev/null +++ b/doc-test/nested.rst @@ -0,0 +1,19 @@ +.. default-domain:: chpl + +.. module:: MyMod + +.. record:: TopLevel + + .. method:: proc foo + + .. record:: Inner + + .. method:: proc bar + + .. method:: proc baz + +.. record:: TopLevel2 + + .. record:: Inner + + .. method:: proc bar From ddc229b212dc0a91304736b265666e3d8cd0d2c1 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Mon, 11 Mar 2024 15:22:23 -0700 Subject: [PATCH 3/6] fix line length Signed-off-by: Jade Abraham --- sphinxcontrib/chapeldomain/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sphinxcontrib/chapeldomain/__init__.py b/sphinxcontrib/chapeldomain/__init__.py index b02e2bc..3abd5a7 100644 --- a/sphinxcontrib/chapeldomain/__init__.py +++ b/sphinxcontrib/chapeldomain/__init__.py @@ -588,7 +588,9 @@ def before_content(self): self.clsname_set += 1 def after_content(self): - """Called after parsing content. Pop the class name from the class name""" + """Called after parsing content. Pop the class name from the class + name + """ if self.clsname_set > 0: val = self.env.temp_data.pop('chpl:class', None) if val: From 360c6483e31b479b4e847b83724a348ecb3b4fd5 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Mon, 11 Mar 2024 15:25:04 -0700 Subject: [PATCH 4/6] fix lint checks Signed-off-by: Jade Abraham --- sphinxcontrib/chapeldomain/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinxcontrib/chapeldomain/__init__.py b/sphinxcontrib/chapeldomain/__init__.py index 3abd5a7..dde698c 100644 --- a/sphinxcontrib/chapeldomain/__init__.py +++ b/sphinxcontrib/chapeldomain/__init__.py @@ -422,6 +422,7 @@ def add_target_and_index(self, name_cls, sig, signode): self.indexnode['entries'].append(('single', indextext, fullname, '', None)) + class ChapelModule(Directive): """Directive to make description of a new module.""" @@ -595,11 +596,10 @@ def after_content(self): val = self.env.temp_data.pop('chpl:class', None) if val: elms = val.split('.')[:-1] - self.env.temp_data['chpl:class'] ='.'.join(elms) + self.env.temp_data['chpl:class'] = '.'.join(elms) self.clsname_set -= 1 - class ChapelModuleLevel(ChapelObject): """Chapel module level functions, types, and variables (i.e. data directives) descriptions. From 712978afae796cfd46579289d4a4c09f97098c51 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Mon, 11 Mar 2024 15:30:09 -0700 Subject: [PATCH 5/6] add header to docs Signed-off-by: Jade Abraham --- doc-test/nested.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc-test/nested.rst b/doc-test/nested.rst index 141fd8a..ed50c49 100644 --- a/doc-test/nested.rst +++ b/doc-test/nested.rst @@ -1,5 +1,8 @@ .. default-domain:: chpl +Module: MyMod +============== + .. module:: MyMod .. record:: TopLevel From f5b4ae48bb4ac3b804ec31e357612999e5f55fb2 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Mon, 11 Mar 2024 15:36:08 -0700 Subject: [PATCH 6/6] fix doc comment Signed-off-by: Jade Abraham --- sphinxcontrib/chapeldomain/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinxcontrib/chapeldomain/__init__.py b/sphinxcontrib/chapeldomain/__init__.py index dde698c..bc8e632 100644 --- a/sphinxcontrib/chapeldomain/__init__.py +++ b/sphinxcontrib/chapeldomain/__init__.py @@ -589,8 +589,8 @@ def before_content(self): self.clsname_set += 1 def after_content(self): - """Called after parsing content. Pop the class name from the class - name + """Called after parsing content. Pop the class name from the longer + class name """ if self.clsname_set > 0: val = self.env.temp_data.pop('chpl:class', None)