【发布时间】:2014-01-31 11:56:00
【问题描述】:
在 Doxygen 中,您使用参考链接:分别定义它们,然后在文本中引用它们。
/**
* This is a documentation. Here I link [std::string] to an external web page.
*
* The next line is the link definition:
*
* [std::string]: http://en.cppreference.com/w/cpp/string/basic_string "std::string documentation"
*/
但是,链接定义似乎只能在文档块中看到。即使在同一页面上的其他文档块上也看不到它。
我想定义一些链接一次,然后在任何地方(在不同的页面上)使用它们。
这可能吗?
编辑(后续问题)
为了实现您的目标,我认为您最好的办法是使用 ALIAS 工具。
我已经设法使用这样的别名进行设置:
ALIASES += std_string="<a href=\"http://en.cppreference.com/w/cpp/string/basic_string\" title=\"std::string documentation\" target=\"_blank\">std::string</a> "
ALIASES += std_vector="<a href=\"http://en.cppreference.com/w/cpp/container/vector\" title=\"std::vector documentation\" target=\"_blank\">std::vector</a> "
并使用它:
@std_string
@std_vector
基本上每个链接都有一个别名。
可以用一个带参数的别名来实现吗?用途是:
@std_ref std::string
@std_ref std::vector
问题是名称(参数)和链接之间需要某种映射:
std::string -> http://en.cppreference.com/w/cpp/string/basic_string
std::vector -> http://en.cppreference.com/w/cpp/container/vector
如果一个参数是链接的不同部分,我知道可以做到这一点,例如:
@std_ref std::string string/basic_string
@std_ref std::vector container/vector
但这很丑陋,容易出错,并且每次都需要检查链接应该是什么。
【问题讨论】:
标签: c++ documentation doxygen