http://qs321.pair.com?node_id=791422

My wife had some large digital books she downloaded as CHM files and wanted to read in a less cumbersome format. I used extract_chmlib to generate a directory of all the HTML files and images, but the table of contents information was in a bastard-step-child of an html file with a *.hhc" extension. This was a quick and dirty strict that massaged it into an index.html file she could open in her browser

I have no idea if all CHM files contain the same kinds of table of contents files, but if they do, this might be usefull...

#!/usr/bin/perl while (my $line = <>) { $line =~ s{<OBJECT type="text/site[^"]*">}{}g; $line =~ s{</OBJECT>}{}g; $line =~ s{<param name="ImageNumber" value="\d*">}{}g; $line =~ s{<param name="Name" value="([^"]*)">}{$1}g; $line =~ s{<param name="Local" value="">}{...}g; $line =~ s{<param name="Local" value="([^"]*)">}{ <a href="$1">##< +/a>}g; $line =~ s{<param name="[^"]*" value="[^"]*">}{}g; print $line; }

Edit: Fixed the horrendously confusing spelling mistake in the Title<

Replies are listed 'Best First'.
Re: Quci and Dirty index.html generator for CHM files
by james2vegas (Chaplain) on Aug 26, 2009 at 19:13 UTC
    AFAIK, they do, its part of the stuff that the help compiler uses to 'compile' the help file into a chm.

      I assume they all have to have "hhc" files in them, and that those files need to be HTML ... i just wasnt' sure if they were all based on the same <object type="text/site...> tags inside of standard ul/li structures, or if there were other html structures used

        This documentation seems failrly accurate. There may be something useful in the Crystal Space 3D code as it relies on Perl to help build their chm documentation, as mentioned here