开发者

Can an index be created for a CHM file?

I am using a CHM file which has no index and that makes searching diffic开发者_如何学Pythonult.

Is it possible to decompile it in some way and recreate with an index?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜