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<