Doxygen可以生成可折叠的代码部分,如rdoc吗? [英] Can Doxygen generate collapsable code sections like rdoc?

查看:219
本文介绍了Doxygen可以生成可折叠的代码部分,如rdoc吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Doxygen为C ++项目创建内部文档。我有Doxygen包括方法的源,等等,但这使得页面类型难以扫描。我希望它的行为像rdoc,并将源代码隐藏在默认情况下折叠的块中。



我以为HTML_DYNAMIC_SECTIONS可能会让我这样做,但唉,更改日志表示该选项仅影响图表和图表。



也许我可以通过编辑LAYOUT_FILE来执行?



无论如何,聪明的人,Doxygen可以生成可折叠的代码段吗?如果是这样,那么如何完成?

解决方案

如果包括方法的来源等。 ..]使页面难以扫描,为什么不只是链接 SOURCE_BROWSER = YES )而不是包括 a href =http://www.stack.nl/~dimitri/doxygen/config.html#cfg_inline_sources =nofollow noreferrer> INLINE_SOURCES = YES )?这将使页面更容易扫描并加快加载,并且源仍然可以访问(以牺牲一个源页面加载为代价)。取决于你实际需要多长时间访问源代码,我猜想。



那就是说,是一种生成可折叠代码段的方式(您将不得不修改源代码并重新编译Doxygen):




  • Doxygen HTML输出中的可折叠部分标有两个嵌套的< div> s 像这样:

     < div class =dynheader>< div class =dynsection> 
    [collapsible section]
    < / div>< / div>


  • 包含的代码段标记如下:< div class =fragment>< pre class =fragment> ...< / pre>< / div>


  • 因此,要使包含的代码段可折叠,您必须使用




    • 修改生成的代码 < div class =fragment>< pre class =fragment> ...< / pre>< / div> 以生成 < div class =dynheader>< div class =dynsection> ...< / div>< / div> (并且可能调整一些css) / li>
    • 更改 javascript initDynSections()功能扫描和折叠可折叠部分到r将< div class =fragment>< pre class =fragment> 识别为其中之一。




执行(或进入 SOURCE_BROWSER route :))作为读者的练习。祝你好运!



哦,如果你应该使用补丁成功,那么如果你可以提交它到dimitri,以便他可以将它包含在将来的版本中。谢谢!


I am creating internal documentation for a C++ project using Doxygen. I am having Doxygen include the source for methods, etc, but this makes the page kind of hard to scan. I'd like it to behave like rdoc and hide the source in a block that is collapsed by default.

I thought that HTML_DYNAMIC_SECTIONS might let me do this, but alas, the changelog says that option only affects diagrams and graphs.

Maybe I could do it by editing the LAYOUT_FILE?

Anyhow, smart people, can Doxygen generate collapsable code sections? And if so, how's it done?

解决方案

if includ[ing] the source for methods, etc, [...] makes the page kind of hard to scan, why don't you just link to it (SOURCE_BROWSER = YES) instead of including it (INLINE_SOURCES = YES)? this would make the pages easier to scan and faster to load, and the source would still be accessible (at the expense of one more source page load). depends on how often you actually need to access the source, i guess.

that being said, there is a way to generate collapsible code sections (you will have to modify the source and recompile Doxygen, though):

  • collapsible sections in Doxygen's HTML output are marked with two nested <div>s like so:

    <div class="dynheader"><div class="dynsection">
    [collapsible section]
    </div></div>
    

  • included code sections are marked like so: <div class="fragment"><pre class="fragment">...</pre></div>

  • thus, to make the included code sections collapsible, you have to either

    • modify the code that generates the <div class="fragment"><pre class="fragment">...</pre></div> to generate <div class="dynheader"><div class="dynsection">...</div></div> (and probably adjust some css), or
    • change the javascript initDynSections() function that scans and collapses the collapsible sections to recognize <div class="fragment"><pre class="fragment"> as one of them.

the implementation (or going the SOURCE_BROWSER route :)) is left as an exercise for the reader. good luck!

oh, and if you should succeed with a patch, it would be great if you could submit it to dimitri so that he can include it in a future version. thanks!

这篇关于Doxygen可以生成可折叠的代码部分,如rdoc吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆