Skip to content
New issue

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

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

Already on GitHub? # to your account

Breaks on RST XML code blocks #70

Closed
NDevox opened this issue Feb 16, 2021 · 2 comments
Closed

Breaks on RST XML code blocks #70

NDevox opened this issue Feb 16, 2021 · 2 comments
Labels
C: style Relates to docstring format style (e.g., Google, NumPy, Sphinx) P: enhancement Feature that is outside the scope of PEP 257
Milestone

Comments

@NDevox
Copy link

NDevox commented Feb 16, 2021

Hi, thanks for this tool.

I've run across what looks like a bug.

Given the docstring:

    """
    .. code-block:: XML

        <xs:element name="regulation.group" substitutionGroup="abstract.record">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="regulation.group.id" type="RegulationGroupId"/>
                    <xs:element name="validity.start.date" type="Date"/>
                    <xs:element name="validity.end.date" type="Date" minOccurs="0"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    """

Docformatter formats this to:

    """
    .. code-block:: XML.

    <xs:element name="regulation.group" substitutionGroup="abstract.record">
    <xs:complexType>         <xs:sequence>             <xs:element
    name="regulation.group.id" type="RegulationGroupId"/>
    <xs:element name="validity.start.date" type="Date"/>             <xs:element
    name="validity.end.date" type="Date" minOccurs="0"/>         </xs:sequence>
    </xs:complexType> </xs:element>
    """

Which is obviously wrong. I don't see any issues with my documentation (https://www.sphinx-doc.org/en/1.5/markup/code.html#directive-code-block). Is there a suggested fix for this? Or does it need some work.

@weibullguy weibullguy added the P: enhancement Feature that is outside the scope of PEP 257 label Jul 24, 2022
@weibullguy
Copy link
Member

This is another example of docformatter not handling Sphinx directives. See also #58 and #78.

@weibullguy weibullguy added the C: style Relates to docstring format style (e.g., Google, NumPy, Sphinx) label Aug 6, 2022
@weibullguy weibullguy added this to the v2.0.0 milestone Aug 21, 2022
@weibullguy
Copy link
Member

@NDevox With v1.6.2 (and possibly earlier versions), docformatter doesn't touch the code block unless passed the --force-wrap argument. Since docformatter is no longer wrapping the reST code block, I'm closing this issue. Handling Sphinx directives and different docstring syntaxes is still planned for the future.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C: style Relates to docstring format style (e.g., Google, NumPy, Sphinx) P: enhancement Feature that is outside the scope of PEP 257
Projects
None yet
Development

No branches or pull requests

2 participants