python中的doxygen语法 [英] doxygen syntax in python
问题描述
有人可以帮助我弄清楚如何正确注释python代码以被doxygen解析吗?
Can somebody please help me to figure out how to comment python code correctly to get parsed by doxygen?
它会以某种方式忽略标签。输出(HTML)显示标签:
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
推荐答案
Doxygen也有未记录的功能(或错误):它解析Doxygen如果您启动docstring,则使用docstring中的语法带有感叹号:
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
请注意,在Python文档中,您需要使用@而不是start来启动Doxygen命令(反斜杠在文档字符串中用作转义符) )。
Note that in Python docsting, you need to use @ instead of \ to start Doxygen commands (backslash works as an escape character in docstring).
这篇关于python中的doxygen语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!