Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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<

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://791422]
Approved by Tanktalus
Front-paged by Arunbear
[1nickt]: ugh, I stuck my head in the bass bin for 30 seconds on a dare at Ted Nugent at Hammersmith Odeon. Yes, I am 40% deaf now.
[johngg]: My daughter is incredibly jealous of my wife who got to see The Clash at Brixton many years ago. They went to see The Vaccines there recently.
[1nickt]: But the bands are even louder! I saw Spearhead (Michael Franti) at an outdoor show and had to walk a mile away to not feel pain in my chest! Babies were crying ... I asked the sound engineer why it was necessary to have the bass so loud and he laughed...
[Discipulus]: but the best i attended live was Mano Negra Patchanka at Forte Prenestino .. in 1990
[Corion]: Hmmm - Mano Negra or at least Manu Chao seem to put on a good live show. At least the one live CD I have from Manu Chao sounds good ;)
Discipulus feels the same jealousity of the johngg's daughter
[1nickt]: choroba I agree
[choroba]: Playing in a punk rock band for 20 years... my hearing is quite bad
[Corion]: I still have hopes to turn my godson and his two siblings into a punk band ;)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2017-03-24 12:19 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (301 votes). Check out past polls.