【发布时间】:2012-09-13 11:07:27
【问题描述】:
我终于放弃了微软的 XML 文档格式强加给我的尖括号税(还有什么意义,因为 MSVC 环境仍然对 C++ 项目没有任何花哨的功能) 并将我当前的项目切换为使用带有 Javadoc 样式语法的 Doxygen。
太棒了。内联文档更易于阅读和输入,生成的输出更加有用和通用。特别是,我打开了MULTILINE_CPP_IS_BRIEF 选项,它允许我根据需要编写尽可能长的“简要”描述,然后使用空行将我的“详细信息”文档分成段落。换句话说:
/// Changes the active viewing area of the currently selected region.
///
/// The modification is merely enqueued. This function has no effect until the
/// FlushRegion() function is called.
///
/// Newly-exposed regions will not be repainted automatically. The user must also
/// call the UpdateRegion() function on these regions to cause their contents to
/// be redrawn.
///
/// @param dx The amount, in pixels, to shift the visible region horizontally.
/// @param dy The amount, in pixels, to shift the visible region vertically.
///
/// @remarks
/// Note that this function is reentrant, but not thread-safe!
void ScrollRegion(int dx, int dy);
这正是我想要的输出,同时减少了我必须使用的嘈杂元命令的数量,例如 @brief 和 \details。
当我尝试在“备注”部分添加第二段时出现问题,就像我(隐含地)为“详细信息”部分所做的那样。例如:
/// Changes the active viewing area of the currently selected region.
///
/// The modification is merely enqueued. This function has no effect until the
/// FlushRegion() function is called.
///
/// Newly-exposed regions will not be repainted automatically. The user must also
/// call the UpdateRegion() function on these regions to cause their contents to
/// be redrawn.
///
/// @param dx The amount, in pixels, to shift the visible region horizontally.
/// @param dy The amount, in pixels, to shift the visible region vertically.
///
/// @remarks
/// Note that this function is reentrant, but not thread-safe!
///
/// If thread safety is required, the user must handle locking and unlocking
/// the region manually.
void ScrollRegion(int dx, int dy);
生成的输出不会将 @remarks 部分中的第二段解释为备注的一部分。我可以判断,因为它在 HTML 输出中没有缩进到同一级别,而且它不在 XML 输出中的 <simplesect kind="remark"> 标记下。
我尝试在第二段的开头添加a @par command,但这也没有达到我想要的效果。新段落仍然不是“备注”部分的子项。在 XML 输出中,它被放置在一个新的 <simplesect kind="para"> 标记内,该标记是原始 <simplesect kind="remark"> 标记的兄弟。
在研究这个时,我看到其他人复制了 @remarks 命令:
/// Changes the active viewing area of the currently selected region.
///
/// The modification is merely enqueued. This function has no effect until the
/// FlushRegion() function is called.
///
/// Newly-exposed regions will not be repainted automatically. The user must also
/// call the UpdateRegion() function on these regions to cause their contents to
/// be redrawn.
///
/// @param dx The amount, in pixels, to shift the visible region horizontally.
/// @param dy The amount, in pixels, to shift the visible region vertically.
///
/// @remarks
/// Note that this function is reentrant, but not thread-safe!
/// @remarks
/// If thread safety is required, the user must handle locking and unlocking
/// the region manually.
void ScrollRegion(int dx, int dy);
确实产生了我想要的输出。这两个段落都嵌套在XML输出中<simplesect kind="remark">标签下的<para>标签中,在HTML输出中视觉关系是正确的。但这很丑陋,对我来说似乎是个错误。
是否有一种标准的方法可以做到这一点,我错过了? 当然,我不是第一个想要在我的文档的“备注”部分中包含多个段落的人......而且这个不限于@remarks;例如,@internal 也会发生同样的事情。
我安装了最新版本的 Doxygen (1.8.2),但我非常怀疑这是特定于版本的。
【问题讨论】:
标签: doxygen