如何标记@ref 引用的结尾?

How mark the end of a @ref reference?

我正在使用 Doxygen 来记录 C++ 代码,并且正在为代码编写大量的 Doxygen 文档。在一个地方,我在代码中制作了一个组列表,并希望它显示如下:

我的文档来源如下所示:

- @ref CM: the module that controls everything
- @ref SM: the module that is the slave of the @CM

但是,问题:Doxygen 似乎将参考名称读取为 CM:,而不是 CM,因此无法找到参考。所以,我需要以某种方式告诉 Doxygen 引用名称结束的位置。 (例如,如果我使用 Bash,并且想要回显一个带有 "s" 作为后缀的可变字符串,我会使用 echo "${NOUN}s"。)

作为解决方法,我可以在名称和后续冒号之间添加一个 space,但这会使生成的文档更难阅读,我想避免它。

Special Commands 下,Doxygen 手册包含以下听起来充满希望的信息:

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

  • If <sharp> 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.

好的,这一切都很好,但文档没有说明,而且我无法弄清楚, 那些大括号应该放在哪里。独自围绕争论?围绕整个命令和论点?两者都不起作用,而且我想不出一个可行的替代方案。

那么,如何指示 Doxygen 引用名称的结尾?如果牙套是答案,它们去哪儿了?

您引用的 Doxygen 文档描述的是 Doxygen 文档的语法, 而不是 sources 的语法,您使用 Doxygen 会对其进行解析.

换句话说,如果在描述命令时使用大括号,则它需要一个单词;等等。

正在查看 @ref 的文档:

\ref <name> ["(text)"]

name 参数在 "sharp braces," 中,所以它只是一个单词。不幸的是,Doxygen 似乎将 : 解释为该词的一部分。你最好的选择是引入一个 space:

@ref CM : the ...

您也可以试试零宽字符是否会破坏单词识别:

@ref CM&zwnj;: the ...

这适用于 Doxygen 版本 1.8.11:

\ref name "":

显然,空字符串会触发回退以使用它之前的名称参数。