13

Can somebody please help me to figure out how to comment python code correctly to get parsed by doxygen?

Somehow it ignores the tags. The output (HTML) shows the tags:

@brief Creates a new Hello object.
This Hello Object is beeing used to ...

@param name The name of the user.

Both variants I tried do not work:

class Hello:
    """@brief short description...

    longer description
    """
    def __init__(self, name):
    """@brief Creates a new Hello object.

    This Hello Object is beeing used to ...

    @param name The name of the user.
    """
        self.name = name

class Hello:
    """\brief short description...

    longer description
    """
    def __init__(self, name):
    """\brief Creates a new Hello object.

    This Hello Object is beeing used to ...

    \param name The name of the user.
    """
        self.name = name
4
  • I presume your indentation is actually valid? Commented Nov 29, 2010 at 10:36
  • Yes it is. I just corrected it. Commented Nov 29, 2010 at 10:38
  • I am not allowed to choose the tool. I have to use doxygen. But I am not really familiar with it. Commented Nov 29, 2010 at 10:42
  • I read something about input-filters. I am using doxygen version 1.7.2 this should be able to parse python??? Commented Nov 29, 2010 at 10:57

2 Answers 2

19

Doxygen has also undocumented feature (or bug): It parses Doxygen syntax in docstring if you start docstring with an exclamation mark:

class Hello: 
    def __init__(self, name):
    """!@brief Creates a new Hello object.

    This Hello Object is being used to...

    @param name The name of the user.
    """
    self.name = name
        dosomething(12)

    def dosomething(x):         
        dosomethingelse

Note that in Python docsting, you need to use @ instead of \ to start Doxygen commands (backslash works as an escape character in docstring).

Sign up to request clarification or add additional context in comments.

Comments

5

For doxygen to recognize the special commands in Python comments you have to use the following comment form:

class Hello: 
    ## \brief Short description.
    # Longer description. 
    # \param self
    # \param name
    def __init__(self, name):         
        dosomething(12)

    def dosomething(x):         
        dosomethingelse

See http://www.doxygen.nl/manual/docblocks.html#pythonblocks

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.