Skip to content

Commit

Permalink
Merge pull request #99 from WenjieDu/dev
Browse files Browse the repository at this point in the history
Fix not shown heading `Attributes` in docs, and update the docs
  • Loading branch information
WenjieDu committed May 10, 2023
2 parents 8254deb + 574be2d commit 6e5b32c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/about_us.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ Core Development Team

Wenjie Du
**********
- Initialized the project in 2022
- `Wenjie's Homepage <https://github.com/WenjieDu>`_
- Initialized the project in March 2022
- `GitHub (WenjieDu) <https://github.com/WenjieDu>`_
- `LinkedIn (Wenjie Du) <https://www.linkedin.com/in/wenjie-du>`_

Maciej Skrabski
***************
- Joined as a maintainer in May 2023
- `GitHub (MaciejSkrabski) <https://github.com/MaciejSkrabski>`_
- `LinkedIn (Maciej Skrabski) <https://www.linkedin.com/in/maciej-skrabski-75595525a>`_


All Contributors
""""""""""""""""
Expand Down
36 changes: 36 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import os
import sys

from sphinx.ext.napoleon.docstring import NumpyDocstring

try:
sys.path.insert(0, os.path.abspath(".."))
except IndexError:
Expand Down Expand Up @@ -97,3 +99,37 @@
gtagjs_ids = [
"G-HT18SK09XE", # PyPOTS docs site
]


# the code below is for fixing the display of `Attributes` heading,
# refer to https://github.com/ivadomed/ivadomed/issues/315
# adds extensions to the Napoleon NumpyDocstring class
def parse_keys_section(self, section):
return self._format_fields("Keys", self._consume_fields())


NumpyDocstring._parse_keys_section = parse_keys_section


def parse_attributes_section(self, section):
return self._format_fields("Attributes", self._consume_fields())


NumpyDocstring._parse_attributes_section = parse_attributes_section


def parse_class_attributes_section(self, section):
return self._format_fields("Class Attributes", self._consume_fields())


NumpyDocstring._parse_class_attributes_section = parse_class_attributes_section


def patched_parse(self):
self._sections["keys"] = self._parse_keys_section
self._sections["class attributes"] = self._parse_class_attributes_section
self._unpatched_parse()


NumpyDocstring._unpatched_parse = NumpyDocstring._parse
NumpyDocstring._parse = patched_parse

0 comments on commit 6e5b32c

Please sign in to comment.