我想要使用doxygen记录包含函数的Fortran模块。
我的问题是,我找不到一种方法将函数体包含在函数文档中。只有一个到位置的链接,而不是实际的源代码。
目前,我的源代码看起来像这样:
!> @brief Get a starting time.
!> @details Get an object with time information.
!> @return returns the time with high precision
FUNCTION get_start_time() RESULT(stime)
TYPE (time) :: stime
CALL SYSTEM_CLOCK(stime%count, stime%rate, stime%max)
END FUNCTION
我的doxygen配置(SOURCES部分)如下:
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
我也尝试使用@code
和@endcode
标记源代码,但这也不起作用。
我该怎么做才能直接将源代码放到文档中呢?
第一次编辑:我尝试了@cheeseminer的解决方案。所以上面的代码现在看起来像:
!> @brief Get a starting time.
!> @details Get an object with time information.
!> @return returns the time with high precision
!> @par Code
!> @snippet folder/file.F90 get_start_time
!! [get_start_time]
FUNCTION get_start_time() RESULT(stime)
TYPE (time) :: stime
CALL SYSTEM_CLOCK(stime%count, stime%rate, stime%max)
END FUNCTION
!! [get_start_time]
不幸的是,块标识命令(前面带有!!
)出现在文档和/或完整源代码中。 在Fortran中正确的方法是什么?
或者是否有更好的方法来解决我的初始问题?
第二次编辑:我找到了一个隐藏块标识的解决方法。 我将它们包裹在@internal
命令中。
!> @internal [get_start_time]
第三次编辑:我现在正在使用@Michael的建议,将块ID作为HTML注释包含在内。
!> <!-- [get_start_time] -->
第四次编辑:我发布了一个关于别名的后续问题。
@internal
并使用!>
来获取!> [get_start_time]
,我在文档中得到了文本 "[get_start_time]"(两次),这并不理想。@internal
隐藏了这些出现。 - StefanSTRIP_CODE_COMMENTS
剥离。 - Stefan!> <!-- [get_start_time] !>
- Michael