scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

epubtohtml.pl (568B)


      1 #!/usr/bin/perl -w
      2 
      3 # General use: unzip your file, head over to the directory where the *.html
      4 # files exist and just execute the script. You'll find a nice "Previous/Next
      5 # Page" link at the bottom of each page
      6 
      7 use strict;
      8 use 5.012;
      9 use Cwd;
     10 
     11 my $dir = getcwd;
     12 my $filenames;
     13 my @filenames = glob "$dir/*.html";
     14 
     15 my $i = 0;
     16 
     17 for ($i = 0; $i < $#filenames; $i++) {
     18   open my $fh, '>>', $filenames[$i] or die "Cound not open $filenames[$i]: $!";
     19   print $fh "<a href=\"$filenames[$i-1]\">Previous Page</a> <a href=\"$filenames[$i+1]\">Next Page</a>";
     20   close $fh;
     21 }