From bertius@sympatico.ca Sun Jan 9 20:45:28 2005 From: bert To: gutvol-p@lists.pglaf.org Subject: [gutvol-p] Bookmark (perl) Date: Sun, 09 Jan 2005 23:44:31 -0500 Message-ID: <41E2082F.5070206@sympatico.ca> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4718101912783283717==" --===============4718101912783283717== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This Perl script transforms a txt into html and ads the javscript for=20 bookmarking lines. The script takes one argument as parameter, the name=20 of the txt file (ex.: 8946-8.txt) and outputs a html file (ex.:=20 8946-8.html). This is not a program and so requires a Perl interpretor=20 to be installed. $file =3D $ARGV[0]; open(IN, $file); @lines =3D ; close(IN); $ARGV[0] =3D~ /(.*)\.(.*)/; $file =3D $1 . '.html'; open(OUT, ">$file"); print OUT ''; print OUT ""; print OUT ''; print OUT '
bookmark

'; $i =3D 0; foreach $line (@lines) { if ($line eq "\n") { print OUT '

'; } else { print OUT '' . $line . ''; } } print OUT '

'; close(OUT); --===============4718101912783283717==--