我应该如何使用带有选项作为第一个参数的 Doxygen 命令?

How should I use Doxygen commands with an option as first argument?

我在理解某些将选项作为第一个参数(使用 HTML 输出)的 Doxygen 命令时遇到了一些问题。 在这里,它是关于 \include 命令的,但我相信答案(如果有的话)将适用于其他命令。

manual 说:

You can add option {lineno} to enable line numbers for the included code if desired.

You can add option {doc} to treat the file as documentation rather than code.

我无法让它工作。 这个:

\include doc path/to/my/file

工作正常。但是文件内容被认为是代码(这是完全正常的),它实际上包含一些生成的内容,我想将其格式化为文档。

我试过这些(是的,请不要笑):

\include doc path/to/my/file
\include [doc] path/to/my/file
\include {doc} path/to/my/file
\include {[doc]} path/to/my/file
\include [{doc}] path/to/my/file

但是 none 这些作品。 它与 lineno 选项的行为相同。

为了完整起见,我不得不提到手册提供了一些关于符号的信息 here:

Some commands have one or more arguments. Each argument has a certain range:

If braces are used the argument is a single word.

If (round) braces are used the argument extends until the end of the line on which the command was found.

If {curly} braces are used the argument extends until the next paragraph. Paragraphs are delimited by a blank line or by a section indicator.

但我不明白这与上面引用的 \include 命令手册有什么关系。

有人知道吗?

Doxygen 版本:1.8.11(Ubuntu 16.04 的最新版本)。

首先要区分不同版本的doxygen。在 1.8.11 版本中没有选项,例如\include 命令,它们在 1.8.15 版本中引入。

语法例如\include 命令在 1.8.15:

\include[{lineno,doc}]

在较新的版本中是这样写的:

\include['{'option'}']

重写是因为它不是很清楚。这里(新版本,但此语法对 1.8.15 也有效)方括号([])表示可选性 '{''}' 信号大括号是强制性的。本例中的选项可以是 linenodoc。此外,您在 \include 和大括号之后看不到 space,这不应该存在,大括号是命令的一部分。如果出现 space,它将被视为命令的结尾,而 { 将是参数的开始。

如果 \include 文件名 xx.h 我们可以有:

\include xx.h

\include{lineno} xx.h

\include{dox} xx.h

这是关于选项的,另一个引用是关于命令的参数。