简体   繁体   English

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

[英]How mark the end of a @ref reference?

I'm using Doxygen to document C++ code, and am writing a substantial amount of Doxygen doc for the code. 我正在使用Doxygen来记录C ++代码,并为代码编写了大量的Doxygen doc。 In one place I'm making a list of groups in the code, and would like it to appear as follows: 在一个地方我在代码中创建一个组列表,并希望它显示如下:

My documentation source looks like this: 我的文档源代码如下:

- @ref CM: the module that controls everything - @ref CM:控制一切的模块
- @ref SM: the module that is the slave of the @CM - @ref SM:作为@CM的奴隶的模块

But, problem: Doxygen seems to be reading the reference name as CM: , not CM , and thus can't find the reference. 但是,问题:Doxygen似乎是将参考名称读为CM: ,而不是CM ,因此无法找到参考。 So, somehow I need to tell Doxygen where the reference name ends. 所以,不知怎的,我需要告诉Doxygen参考名称的结尾。 (For example, if I were using Bash, and wanted to echo a variable string with an "s" as a suffix, I'd use echo "${NOUN}s" .) (例如,如果我使用Bash,并且想要回显一个带有“s”作为后缀的变量字符串,我会使用echo "${NOUN}s" 。)

As a workaround, I could add a space between the name and the subsequent colon, but that makes the resulting doc harder to read and I'd like to avoid it. 作为一种解决方法,我可以在名称和后续冒号之间添加一个空格,但这会使得生成的文档更难以阅读,我想避免它。

Under Special Commands , the Doxygen manual includes the following hopeful-sounding information: 特殊命令下 ,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. 如果使用<sharp>大括号,则参数是单个单词。
  • 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. 如果使用{curly}大括号,则参数将延伸到下一段。 Paragraphs are delimited by a blank line or by a section indicator. 段落由空行或部分指示符分隔。

OK, that's all fine and good, but the documentation doesn't say, and I can't figure out, where those braces are supposed to go. OK,这就是优秀和良好,但文档不说了,我想不通, 这些括号应该去。 Around the argument alone? 只围绕论点? Around the entire command and argument? 围绕整个命令和论点? Neither works, and I can't come up with an alternative that does work. 两者都不起作用,我无法想出一个有效的替代方案。

So, how do I indicate the end of a reference name to Doxygen? 那么,如何指示Doxygen参考名称的结尾? And if braces are the answer, where do they go? 如果支撑是答案,他们会去哪里?

This works for Doxygen version 1.8.11: 这适用于Doxygen版本1.8.11:

\ref name "":

Apparently, the empty string triggers a fall-back to use the name argument before it. 显然,空字符串触发回退以在其之前使用name参数。

The Doxygen documentation you quote is describing the syntax of the Doxygen documentation, not of sources to be parsed by your use of Doxygen. 您引用的Doxygen文档描述了Doxygen文档的语法而不是您使用Doxygen要解析的源代码

In other words, if <sharp> braces are used when describing a command, it takes a single word; 换句话说,如果在描述命令时使用<sharp>大括号,则只需一个单词; and so on. 等等。

Looking at the documentation of @ref : 查看@ref的文档:

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

The name argument is in "sharp braces," and so it's just a single word. name参数是“尖锐的括号”,所以它只是一个单词。 Unfortunately, Doxygen seems to interpret : as part of that word. 不幸的是,Doxygen似乎在解释:作为这个词的一部分。 Your best bet would be to introduce a space: 你最好的选择是引入一个空间:

@ref CM : the ...

You could also try whether a zero-width character would break the word recognition: 您还可以尝试零宽度字符是否会破坏单词识别:

@ref CM&zwnj;: the ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM