Skip to content

napoleon_use_param should also affect "other parameters" section #5560

Closed

Description

@anntzer

Subject: napoleon_use_param should also affect "other parameters" section

Problem

Currently, napoleon always renders the Other parameters section as if napoleon_use_param was False, see source

    def _parse_other_parameters_section(self, section):
        # type: (unicode) -> List[unicode]
        return self._format_fields(_('Other Parameters'), self._consume_fields())

    def _parse_parameters_section(self, section):
        # type: (unicode) -> List[unicode]
        fields = self._consume_fields()
        if self._config.napoleon_use_param:
            return self._format_docutils_params(fields)
        else:
            return self._format_fields(_('Parameters'), fields)

whereas it would make sense that this section should follow the same formatting rules as the Parameters section.

Procedure to reproduce the problem

In [5]: print(str(sphinx.ext.napoleon.NumpyDocstring("""\ 
   ...: Parameters 
   ...: ---------- 
   ...: x : int 
   ...:  
   ...: Other parameters 
   ...: ---------------- 
   ...: y: float 
   ...: """)))                                                                                                                                                                                      
:param x:
:type x: int

:Other Parameters: **y** (*float*)

Note the difference in rendering.

Error logs / results

See above.

Expected results

:param x:
:type x: int

:Other Parameters:  // Or some other kind of heading.
:param: y
:type y: float

Alternatively another separate config value could be introduced, but that seems a bit overkill.

Reproducible project / your project

N/A

Environment info

  • OS: Linux
  • Python version: 3.7
  • Sphinx version: 1.8.1

Activity

  1. added
    type:enhancement
    on Jan 20, 2021
  2. added this to the 4.0.0 milestone on Jan 20, 2021
  3. added 2 commits that reference this issue on Jan 20, 2021
    73db152
    424510e
  4. added a commit that references this issue on Mar 11, 2021
    3134085
  5. locked as resolved and limited conversation to collaborators on Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

extensions:napoleontype:enhancement

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions