Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix links for nested types #90

Merged
merged 6 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc-test/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Module 'Foo'
Containers
foo
cpp_test
nested

**Does it work???**

Expand Down
22 changes: 22 additions & 0 deletions doc-test/nested.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. default-domain:: chpl

Module: MyMod
==============

.. module:: MyMod

.. record:: TopLevel

.. method:: proc foo

.. record:: Inner

.. method:: proc bar

.. method:: proc baz

.. record:: TopLevel2

.. record:: Inner

.. method:: proc bar
27 changes: 14 additions & 13 deletions sphinxcontrib/chapeldomain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,18 +422,6 @@
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."""
Expand Down Expand Up @@ -596,7 +584,20 @@
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

Check warning on line 589 in sphinxcontrib/chapeldomain/__init__.py

View check run for this annotation

Codecov / codecov/patch

sphinxcontrib/chapeldomain/__init__.py#L587-L589

Added lines #L587 - L589 were not covered by tests

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

Check warning on line 600 in sphinxcontrib/chapeldomain/__init__.py

View check run for this annotation

Codecov / codecov/patch

sphinxcontrib/chapeldomain/__init__.py#L595-L600

Added lines #L595 - L600 were not covered by tests


class ChapelModuleLevel(ChapelObject):
Expand Down
Loading