可以为CHM文件创建索引吗?
我使用的 CHM 文件没有索引,这使得搜索变得困难。
是否可以以某种方式反编译它并使用索引重新创建?
I am using a CHM file which has no index and that makes searching difficult.
Is it possible to decompile it in some way and recreate with an index?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要什么,一种构建执行此操作的工具的方法,或者一个可以轻松为您完成此操作的工具?我没有后者,但我知道一种方法可以做到前者。 (这是一个编程论坛 :-)
以下 delphi/freepascal 程序/脚本从 Latex 2 html 转换器 (tex4ht) 加载多文件 HTML 输出,修复损坏的链接,重建 TOC 并折叠在单独的 (kwd) 文件中将关键字放入索引中。
http://svn.freepascal .org/cgi-bin/viewvc.cgi/trunk/compilelatexchm.pp?view=markup&root=docs
您可以尝试使用以下命令来增强此功能: html 解析例程扫描关键字,手动过滤它们,然后将其反馈给修改后的脚本,从 CHM 解压缩器的输出开始。 (Free Pascal 2.4.4 附带了 CHM 解压工具,这些工具还可以将 CHM 内部文件存储为纯文件,因此您可以在生成中重用它们)
脚本看起来很复杂,但这部分是由于它重写了 HTML代码(主题标题、目录突变、链接修复)。
更新到下面的评论。
CHM 包不生成索引。文档工具(delphicodetodoc 或 fpdoc)必须将相关索引信息传递给 CHM 编译器。作为 XML 或通过调用各种方法构建树。如果你的 html 是由像 delphitodoc 这样的工具生成的,那么尝试使用上述方法自己重建索引是疯狂的。该工具具有更高级别的视图,可以生成更高质量的索引,并且适应它的工作可能会更少。
请注意,我假设您真正指的是索引,而不是自动的全文搜索。
我不知道 delphicodetodoc 是如何工作的(并且由于严格的构建要求,我不会尝试),但这些问题听起来像 delphicodetodoc 在 CHM 生成中并不是那么好。
fpdoc 的设计决定是它不会做源内文档(被认为是混乱的),而且我认为这不会改变。
What do you want, a way to construct a tool to do this, or a tool that does it readily for you? I don't have the latter, but I do know a way to do the former. (and this IS a programming forum :-)
The following delphi/freepascal program/script loads multi-file HTML output from a latex 2 html converter (tex4ht), fixes broken links, reconstructs the TOC and folds in a separate (kwd) file with keywords into the index.
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/compilelatexchm.pp?view=markup&root=docs
You could try to enhance this with a html parsing routine to scan for keywords, filter them manually, and then feed it back to a modified script, starting from the output of a CHM decompressor. (CHM decompression tools come with Free Pascal 2.4.4, these can also store CHM internal files to plain files, so you can reuse them in the generation)
The script looks complex, but this is partially due to the fact that it rewrites the HTML code (topic titles, TOC mutation, links fixing).
Update to comments below.
The CHM package does not generate indexes. The documentation tool (delphicodetodoc or fpdoc) must pass the relevant indexing information to the CHM compiler. Either as XML or by building the tree calling various methods. If your html is generated from a tool like delphitodoc, it is madness to try to reconstruct the index yourself using the above method. The tool has a higher level view that can generate a much more highquality index, and it will probably be less work to adapt that.
Note that I assume you really mean the index, and not the fulltextsearch, that IS automatical.
I don't know how delphicodetodoc works (and due to draconical build requirements I'm not going to try), but the problems sounds like delphicodetodoc isn't that good in CHM generation.
fpdoc has as design decision that it won't do in-source docs (considered messy), and I don't think that is going to change.