自定义 Doxygen html 输出
我们有一个必须遵循的函数头格式。它基本上看起来像这样
/**
* Name: blah
*
* Parameters:
* int foo
* bool bar
*
* .....
我们正在尝试使用 doxygen 生成一些文档,但一个问题是,当我们将代码更改为:
/**
* Name: blah
*
* Parameters:
* \param int foo
* \param bool bar
*
* .....
当 Doxygen 生成 html 注释时,它会添加参数标题。我们需要第 4 行,因此这会创建包含 2 行参数的文档,第一行来自第 4 行,第二行来自 Doxygen 自动插入。
我希望我能做的是要么让 Doxygen 忽略第 4 行,要么添加让它不插入它自己的“参数:”标题。有人知道这是否可能吗?
We have a function header format that we have to follow. It basically looks like this
/**
* Name: blah
*
* Parameters:
* int foo
* bool bar
*
* .....
We are attempting to generate some documents with doxygen, but one issue is that when we change he code to:
/**
* Name: blah
*
* Parameters:
* \param int foo
* \param bool bar
*
* .....
When Doxygen generates the html comments, it adds the Parameters title. We are required to have line 4, so this creates documents with 2 lines that say Parameters, the first is from line 4 and the second Doxygen auto inserts.
What I'm hoping I can do is either have Doxygen ignore line 4 or add have it not insert it's own "Parameters:" title. Anyone know if this is possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单的解决方案是完全删除“Parameters:”文本;它完全是多余的,因为 Doxygen 标记非常清楚地表明它们是参数!
就此而言,“名称:”标签也是完全多余的,它迫使您将名称放在注释和代码中。你为什么需要那个?它的名字就在代码中。这是一个不必要的注释维护难题,Doxygen 将在代码中使用名称,而不是生成的文档中注释中的名称。
如果您必须尝试将现有格式与 Doxygen 兼容格式混合,那么使用 C++/C99 行注释而不是块注释会更容易;大多数 C 编译器都支持它们:
注意
\param;
不是正确的 Doxygen 语法;它是\param; <描述>
。 Doxygen 从代码中获取类型;再次在注释中指定类型完全是多余的,并且是另一个维护难题。我强烈建议您完全使用 Doxygen 和维护友好的功能样板。我使用以下基本形式(就其价值而言):
显然,无论您使用 /// 还是 //! \ 或@ 是一个偏好问题。
The simple solution is to remove the "Parameters:" text altogether; it is entirely redundant since the Doxygen mark-up makes it perfectly clear that they are parameters!
For that matter the "Name:" label is entirely redundant too, and forces you to place the name in both the comment and the code. Why would you need that? It's name is right there in the code. It is an unnecessary comment maintenance headache, and Doxygen will use teh name in the code not the name in the comment in the generated documentation.
If you must attempt to mix your existing format with a Doxygen compatible format it would be easier to use C++/C99 line comments rather than block comments; most C compilers support them:
Note
\param <type> <name>
is not correct Doxygen syntax; it is\param <name> <description>
. Doxygen gets the type from the code; again specifying the type in the comment is entirely redundant, and another maintenance headache.I would strongly suggest that you employ a more Doxygen and maintenance friendly function boiler-plate altogether. I use the following basic form (for what its worth):
Obviously whether you use /// or //! and \ or @ is a matter of preference.