【问题标题】:how to hide parts of doxygen comments to doxygen?如何将部分 doxygen 评论隐藏到 doxygen?
【发布时间】:2015-03-10 04:17:58
【问题描述】:

假设您有一个相当复杂的 README,您希望 Doxygen 处理以生成文档的主页,类似于

/*! 
    \mainpage Welcome to this code

    \section S1 Introduction
    Some stuff to explain why you coded all this

    \section S2 Examples
    Many examples of how the code can be used
    !!! some line which you wouldn't write in a documentation

    \section S3 Some other stuff
*/

并且您希望 doxygen 忽略以 !!! 开头的行但是您不想删除该行,因为您计划稍后对其进行编辑。

好吧,你怎么能这样做?

编辑:以下内容:

/*! 
    \mainpage Welcome to this code

    \section S1 Introduction
    Some stuff to explain why you coded all this

    \section S2 Examples
    Many examples of how the code can be used
    \cond NEVER
    !!! some line which you wouldn't write in a documentation
    \endcond

    \section S3 Some other stuff
*/

未能将S3 部分放在主页中...

【问题讨论】:

  • 你看过\internal和\cond
  • 我尝试\cond NEVER !!! some line which you wouldn't write in a documentation \endcond,但它破坏了整个页面,因此不会添加\section S3 Some other stuff。我会检查\internal
  • 我刚刚检查了\internal !!! some line which you wouldn't write in a documentation \endinternal 并且它有效,所以谢谢@albert。猜猜我会回答吗?

标签: doxygen


【解决方案1】:

以下内容:

/*! 
    \mainpage Welcome to this code

    \section S1 Introduction
    Some stuff to explain why you coded all this

    \section S2 Examples
    Many examples of how the code can be used
    \internal
    !!! some line which you wouldn't write in a documentation
    \endinternal

    \section S3 Some other stuff
*/

实现了预期的目标,前提是您的 doxyfile 设置正确(INTERNAL_DOCS 标记设置为 NO )。我知道@albert 的小费。

【讨论】:

  • 一个小补充。从文档中: \cond 开始一个以相应的 \endcond 命令结尾的条件部分,该命令通常在另一个注释块中找到。对于注释块中的条件部分,应使用 \if ... \endif 块
【解决方案2】:

来自手册中的HTML commands section:

最后,要将不可见的 cmets 放入注释块中,可以使用 HTML 样式的 cmets:

/*! <!-- This is a comment with a comment block --> Visible text */

【讨论】:

  • 请注意,这只是将 cmets 隐藏在浏览器中,而将它们留在 html 源中
猜你喜欢
  • 2015-06-04
  • 2012-06-26
  • 1970-01-01
  • 2011-06-22
  • 2012-09-07
  • 2012-11-18
  • 2013-07-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多