#!/usr/local/bin/perl -w # Convert dumped printer friendly version of the online drupal user manual # to a chm compilable state. # # Pass filename as arg. use strict; use open IO => ":utf8"; # all files are assumed to be utf8 # get filename from command line my $filename = shift || die "syntax: dump2chm.pl "; # open html dump file open FH, "<$filename" or die "couldn't open $filename"; # open files used by the chm compiler open my $pfile, ">index.hhp" or die "couldn't open index.hhp"; open my $cfile, ">index.hhc" or die "couldn't open index.hhc"; open my $kfile, ">index.hhk" or die "couldn't open index.hhk"; open my $ifile, ">index.html" or die "couldn't open index.html"; # get date (snip from the internets) my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year += 1900; ## $year contains no. of years since 1900, to add 1900 to make Y2K compliant my @mabbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); my $curnode = -1; my $curnesting = 1; # this will be the current node file when we open one my $nfile; # this hash will be used to store info about internal nodes my %nodes; # print headers print $pfile < EOT print $kfile < \n"; --$curnesting; } while ($curnesting < $nesting) { print $cfile "\n"; print $kfile "\n";