Doxygen:HTML 太大

发布于 2024-12-05 00:26:49 字数 297 浏览 1 评论 0原文

我有一个非常大的班级,有很多文档。 Doxygen 用于生成 HTML 文档,但对于此类,HTML 文件很大~12 MB,这对我来说太大了。

发生这种情况是因为 Doxygen 在一个文件中列出了该类的所有文档,但在这种情况下,最好将类函数文档拆分在不同的页面中,以便拥有一个合理的页面。

我想问的是:这个问题有什么解决办法吗?

也许有一个特殊的选项/技巧?或者... 也许我可以禁用此类的“正常”文档,并将类函数文档复制到组织更好的页面中?在这种情况下,我应该 @copydoc 这些函数,不是吗?

你有什么建议?

I have a very large class, which is very documented. Doxygen is used for producing the HTML documentation, but for this class the HTML file is big ~12 MB, which is too much for my taste.

This happens becuase Doxygen list all documentation of the class in one file, but in this case it's desiderable to split class functions documentation in separate pages, in order to have a reasonable page.

What I'm asking: is there any solution to this?

Maybe is there a special option/trick for this? Or...
Maybe I can disable "normal" documentation for this class, and copy the class function documentation in a better organized page? In this case I shall @copydoc those functions, isn't?

What is you advice?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不甘平庸 2024-12-12 00:26:49

这是可能的!

有一个配置键:'SEPARATE_MEMBER_PAGES=YES'。这将为每个班级成员创建一个不同的页面。

下一个问题是 Doxygen 生成的文件数量(文件系统噩梦),但这可以通过设置“CREATE_SUBDIRS=YES”来解决:至少将这些稀疏文件放入目录中,以便使它们易于管理。


几天后...


不。问题仍然存在...不,比以往更糟糕:每个单独的班级成员页面在左侧列出了所有班级成员:4K 成员页面,1 MB每个都... 4 GB?我的天啊。

因此,我决定从生成的 HTML 中删除该表格列表(如此广泛)。幸运的是,该部分对于所有生成的文件都是统一的。我制作了一个实用程序来实现这一目标。这是最有用的代码片段(使用HtmlAgilityPack):

HtmlAgilityPack.HtmlNode divNode = htmlDoc.DocumentNode.SelectSingleNode("//body/div[@class='contents']/table/tr/td/div[@class='navtab']");

if (divNode != null) {
    divNode.ParentNode.RemoveChild(divNode, false);

    Console.WriteLine("Queued {0}", htmlPath);

    lock (sReducedHtmlPathsLock) {
        sReducedHtmlPaths.Add(htmlPath, htmlDoc);
        sReducedHtmlPathsSemaphore.Release();
    }
}

当然,我构建了一个多线程程序,它在单独的线程上加载一堆 HTML 文件,并将它们写入单独的线程中(否则需要太长时间) 。

结果:从 4 GB 变为 60 MB!

您对结果感到好奇吗:请参阅此文档页面中的链接页面。

It is possible!

There is a configuration key: 'SEPARATE_MEMBER_PAGES=YES'. This will create a different page for each class member.

The next problem is the number of files that Doxygen generates (a filesystem nightmare), but this is solvable by setting 'CREATE_SUBDIRS=YES': at least this sparse files into directories, so make them manageable.


After few days...


No. The problem still exists... no, it is worse than ever: each separate class member page list all class member on the left: 4K member pages, for 1 MB each make... 4 GB? OMG.

So, I decided to remove that table listing (so much expansive) from the resulted HTML. Fortunately this section is uniform on all generated files. I made an utility program to achieve this. Here is the most usefull code snippet (using HtmlAgilityPack):

HtmlAgilityPack.HtmlNode divNode = htmlDoc.DocumentNode.SelectSingleNode("//body/div[@class='contents']/table/tr/td/div[@class='navtab']");

if (divNode != null) {
    divNode.ParentNode.RemoveChild(divNode, false);

    Console.WriteLine("Queued {0}", htmlPath);

    lock (sReducedHtmlPathsLock) {
        sReducedHtmlPaths.Add(htmlPath, htmlDoc);
        sReducedHtmlPathsSemaphore.Release();
    }
}

Of course I build a multithread program which load a bunch of HTML files on separate threads and write them in separate threads too (otherwise it take too long).

The result: passed from 4 GB to 60 MB!

Are you curious about the result: see the linked pages from this documentation page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文