Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

doxygen parameter direction not in latex output #269

Closed
f-b-e opened this issue Jul 4, 2016 · 10 comments · Fixed by #428
Closed

doxygen parameter direction not in latex output #269

f-b-e opened this issue Jul 4, 2016 · 10 comments · Fixed by #428
Assignees
Labels
code Source code enhancement Improvements, additions (also cosmetics)

Comments

@f-b-e
Copy link

f-b-e commented Jul 4, 2016

Function parameter directions are not in the latex output.
Example:

/**
*  @param[out] dst Destination pointer.
*  @param[in] src Source pointer
*/

It would be great to have in or/and out present in the Latex output.
Thx

@michaeljones
Copy link
Collaborator

Thanks for raising this. Sorry for the silence. We don't have a huge amount of development time on this project but we'd be very happy to help & review code if you get a chance to look into this.

@t-b
Copy link
Contributor

t-b commented Sep 30, 2016

The issue is output independent.

A fix would probably read the direction attribute of the parameter from the XML.

<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="in">a</parametername>
</parameternamelist>
<parameterdescription>
<para>

From a coarse look into the code it looks like a fix would touch docParaTypeSub.buildChildren.

@f-b-e
Copy link
Author

f-b-e commented Sep 30, 2016

Hi, thanks for the support.
I do it with a hack. I decorate the render function like this:

from breathe.renderer.compound import DocParamNameSubRenderer
def render_direction(render_func):
    """render decorator which adds parameter direction"""
    def render(self):
        nodes = render_func(self)
        if self.data_object.direction:
            nodes.append(self.node_factory.Text(
                " [{direction}]".format(direction=self.data_object.direction)))
        return nodes
    return render
DocParamNameSubRenderer.render = render_direction(DocParamNameSubRenderer.render)

@vermeeren
Copy link
Collaborator

vermeeren commented Jun 2, 2018

The current version of Sphinx (1.7.5) + Breathe (4.9.0) may have solved this.

In the case it did not I think your hack could be merged if tidied up a bit and put in the appropriate place. If you could check if it's still a problem and if so submit a PR I would really appreciate it!

Edit: because this issue only happens for LaTeX, perhaps the issue is actually in Sphinx? Might need some investigation.

@vermeeren vermeeren self-assigned this Jun 2, 2018
@vermeeren vermeeren added enhancement Improvements, additions (also cosmetics) code Source code labels Jun 2, 2018
@t-b
Copy link
Contributor

t-b commented Jun 3, 2018

@melvinvermeeren @f-b-e

This is unfortunately not yet solved witht the latest versions. I'm looking at the HTML output.

I've created a test repo here -> https://github.com/t-b/breathe-doxygen-filter-test, just execute run.sh and then xdg-open source/html/output/file/test_8cpp.html.
I've used breathe 4.9.0, sphinx 1.7.5 and doxygen master from today.

@vermeeren
Copy link
Collaborator

In that case the next step is to implement reading the XML tag and then render it properly. Thank you for the test project, it will be useful when implementing this.

As this is tagged as enhancement right now I cannot say when this will happen. For me personally the bugs have higher priority. And although I intend to maintain Breathe for a long time I am not certain if I can contribute to actual development enough to resolve all open issues since there so many of them.

Though with the code snippet above and the relative simplicity of the issue hopefully it will not be too long.

@fjolliton
Copy link

With Sphinx 1.8.4 and Breathe 4.12.0 we use the following workaround (for HTML):

def patch_breathe():
    from breathe.parser.compoundsuper import docParamName, Node, MixedContainer
    orig = docParamName.buildChildren
    def buildChildren(self, child_, nodename_):
        orig(self, child_, nodename_)
        if child_.nodeType == Node.TEXT_NODE:
            d = child_.parentNode.attributes.get('direction')
            if d is not None:
                self.content_.insert(0, self.mixedclass_(MixedContainer.CategoryText,
                                                         MixedContainer.TypeNone,
                                                         '', f'[{d.value}] '))
    docParamName.buildChildren = buildChildren

patch_breathe()

@t-b
Copy link
Contributor

t-b commented Apr 11, 2019

@fjolliton Does that break anything? It looks like this could just be fixed in breathe like that or?

@fjolliton
Copy link

@t-b This is just extending the generation of the text for the parameter, so it is unlikely to break anything I think. But obviously this can break as soon as Breathe update its implementation. Patching Breathe would be better of course, but I don't have time to provide a PR regarding this.

@t-b
Copy link
Contributor

t-b commented Apr 11, 2019

@fjolliton Thanks. I gave that a shot. I would like to use that without the hack myself ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Source code enhancement Improvements, additions (also cosmetics)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants