Converting a web page to Palm doc format
Get txt2pdbdoc, then use the following Perl code to convert a web page to a Palm doc at the command line. Just save the following code as url2palm
, and then type:
url2palm http://www.rcbowen.com/imho/palm/converting.html
url2palm
#!/usr/bin/perl
use LWP::Simple;
use HTML::TokeParser;
@foo = get($ARGV[0]);
open (FOO, ">convert_tmp.html");
print FOO @foo;
close FOO;
$p = HTML::TokeParser->new("convert_tmp.html");
if ($p->get_tag("title")) {
$title = $p->get_trimmed_text;
}
$title =~ s/['"]//g;
$title ||= 'Untitled';
@txt = `html2pdbtxt convert_tmp.html`;
open (FOO, ">convert_tmp.txt");
print FOO @txt;
close FOO;
`txt2pdbdoc \"$title\" convert_tmp.txt convert_tmp.pdb`;
unlink 'convert_tmp.html';
unlink 'convert_tmp.txt';
$title =~ s/\W+/_/g;
rename ('convert_tmp.pdb', "$title.pdb");