Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Quick and Dirty index.html generator for CHM files

by hossman (Prior)
on Aug 26, 2009 at 19:07 UTC ( #791422=CUFP: print w/ replies, xml ) Need Help??

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<

Comment on Quick and Dirty index.html generator for CHM files
Download Code
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://791422]
Approved by Tanktalus
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2014-08-23 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (178 votes), past polls