JakubAndrysek / MkDoxy

📖 Automatically generates API documentation for your project based on Doxygen comments and code snippets in your markdown files.
https://mkdoxy.kubaandrysek.cz/
MIT License
60 stars 16 forks source link

Template parameter declarations repeated #81

Closed taehyounpark closed 3 months ago

taehyounpark commented 7 months ago

As seen here, the declaration of a template parameter class delayed<Bkr> receives a repeated declaration template <typename Bkr typename Bkr>

The xml output from Doxygen does not contain this, so I'm not sure what (if anything) can be done from the user-side to "guide" this prevent this, or if it would need a fix. Thank you in advance!

bsadri commented 6 months ago

I have the same problem.

r-braun commented 3 months ago

I also have this problem and after some testing I noticed that it only happens with simple template paramters (Constrained or variadic parameters work correctly).

I think this is a result of doxygen generating different xml structures for them (maybe a doxygen bug?).

Take the following c++ code for example:

template <typename TypeName, class Class, std::integral Integral, class... Variadic>
struct TemplateTest {};

The templateparamlist generated by doxygen (tested with Version 1.9.4 and 1.10.0) looks as follows:

<templateparamlist>
    <param>
        <type>typename TypeName</type>
    </param>
    <param>
        <type>class Class</type>
    </param>
    <param>
        <type>std::integral</type>
        <declname>Integral</declname>
        <defname>Integral</defname>
    </param>
    <param>
        <type>class...</type>
        <declname>Variadic</declname>
        <defname>Variadic</defname>
    </param>
</templateparamlist>

As you can see, in the case of typename/class the whole declaration is inside type. But for the constrained or variadic case, the declaration is split into type and declname/defname.

taehyounpark commented 3 months ago

@r-braun I was looking into whether this is an issue with other doc generators, and nested/variadic templates are generally very finicky with the majority of them. Even a seemingly widely-used workflow like readthedocs+sphinx gets it wrong. What does work, is m.css. I am not nearly familiar enough with Doxygen's XML structure to know what's going on, but there does seem to be some extra handling based on type vs. declname tags in their source code. It would seem that if this is really what doxygen intends, it does need some massaging by downstream clients.

r-braun commented 3 months ago

@taehyounpark That's the impression I got as well and from what I've seen in the source code here, there's already some massaging done. I created a PR (#95) that fixes the issue for all of my use cases, but I'm also no doxygen specialist so I can't guarantee there aren't some edge cases left.

JakubAndrysek commented 3 months ago

image