Skip to content

HTML5/Latex/Text writers: Trailing comma in multi-line signatures #12902

@Level3Manatee

Description

@Level3Manatee

Describe the bug

Multi-line signatures have a comma separator even for the last parameter when outputting HTML5 (edit: and LaTeX and Text).

The offender seems to be writers/html5.py#L232

 if opt_param_left_at_level or is_required and (is_last_group or next_is_required):

which I think should be

if opt_param_left_at_level or is_required and (not is_last_group or next_is_required):

Edit: Nm, that would break the closing dd

How to Reproduce

.. cpp:function:: Foo(int bar, float baz)

with maximum_signature_line_length = 1
outputs

Foo(
    int bar,
    float baz,
)

Environment Information

Sphinx 8.0.2

Sphinx extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions