Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

doxygen syntax in python

Tags:

python

doxygen

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
like image 888
Mark Avatar asked Nov 29 '10 10:11

Mark


People also ask

Can we use Doxygen for Python?

Normally, Doxygen supports different programming languages such as C, C++, IDL, C#, Java, Objective C, VHDL, Python, D, PHP and Fortran. Once you select your programming language to be used in Doxygen, create a conf file. That is configuration file.

What is Doxygen Python?

Doxygen is a popular tool for generating documentation from annotated C++ sources; it also supports other popular programming languages such as C#, PHP, Java, and Python. Visit the Doxygen website to learn more about the system, and consult the Doxygen Manual for the full information.

How do I enter a code on Doxygen?

You can put example source code in a special path defined in the doxygen config under EXAMPLE_PATH , and then insert examples with the @example tag. Doxygen will then generate an extra page containing the source of the example. It will also set a link to it from the class documentation containing the example tag.


1 Answers

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).

like image 122
wenzeslaus Avatar answered Oct 23 '22 14:10

wenzeslaus