docconvert icon indicating copy to clipboard operation
docconvert copied to clipboard

Handle multiple C{type} in an epytext docstring

Open AWhetter opened this issue 5 years ago • 7 comments

Reading the following docstring

"""
Blah

:Parameters:
    arg1 :C{string} or C{int}
        Does something
"""

results in the following Google docstring

"""Blah

Args:
    arg1 (string} or C{int): Does something
"""

It looks like something is greedily looking for C{} but it needs to be more conservative.

AWhetter avatar Jul 08 '20 18:07 AWhetter

Damn, I didn't even know this was a thing we supported. I thought we only stripped backticks ` I'll do some digging.

cbillingham avatar Jul 11 '20 15:07 cbillingham

Maybe we don't and it's a fluke that it works this way. I'm pretty sure it's made up syntax. I've never been able to find anything else using it. I remember us talking about implementing support for it but I don't remember deciding one way or the other. I'd be happy saying we don't support it, but then it feels like we should be keeping the outer C{ and } instead of stripping it?

AWhetter avatar Jul 12 '20 01:07 AWhetter

Hmmm I'm actually not able to reproduce this.

Here's what I get when I tested. It reads as the RestParser and writing with GoogleWriter produces:

"""Blah

Args:
    arg1 (C{string} or C{int}): Does something
"""

I wonder if your version is custom and has this added as an additional feature? I vaguely remember maybe you or Andy adding this in? I wonder if we decided to not include that in the open source release?

cbillingham avatar Jul 15 '20 00:07 cbillingham

I can't reproduce either, even on the original docstring that I saw the issue on... So I'm happy to close this

I did however find that the C{type} syntax comes from epytext (http://epydoc.sourceforge.net/manual-epytext.html#basic-inline-markup).

AWhetter avatar Jul 15 '20 16:07 AWhetter

Huh funky. I'm cool to support converting that syntax as a feature request if you think its useful.

cbillingham avatar Jul 15 '20 17:07 cbillingham

It's part of epytext and it's used a lot in our codebases. It would be useful for docconvert to support their conversion.

AWhetter avatar Jul 15 '20 17:07 AWhetter

I've reopened this is as the feature request to convert I{text} to *text*, B{text} to **text**, C{type} to ``type``, and M{text} to :math:`text` . We could also consider stripping C{} totally in type fields.

AWhetter avatar Jul 23 '20 04:07 AWhetter

Probably way way too late for you to benefit from this, but finally added support for this

cbillingham avatar Oct 13 '24 23:10 cbillingham