[XML-SIG] opera bookmark converter
Alexandertje
a.kellett@lancaster.ac.uk
Wed, 4 Apr 2001 23:30:02 +0100
--G4iJoqBmSsgzjUCe
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Included is a perl script to convert from opera bookmark files into
konqueror/xbel bookmarks.
btw, unlike the one to kde-cvs@ this version actually works ;)
thanks,
Alex
--G4iJoqBmSsgzjUCe
Content-Type: application/x-perl
Content-Disposition: attachment; filename="opera2xbel.pl"
#!/usr/bin/perl
use HTML::Entities;
print "<!DOCTYPE BOOKMARKS ><xbel folded=\"no\" OPEN=\"1\" hide_nsbk=\"yes\" >\n";
while (<>) {
if (/^\#/) {
chomp;
$type = $_;
$entry=();
ENTRY: while(<>) {
chomp;
last ENTRY if /^$/;
next ENTRY unless /^[ \t](URL|NAME)=(.*)/;
$entry{$1} = $2;
}
if ($type eq "#URL") {
print " <bookmark icon=\"www\" href=\"" . encode_entities($entry{"URL"}) . "\" >\n";
print " <title>" . $entry{"NAME"} . "</title>\n";
print " </bookmark>\n";
} elsif ($type eq "#FOLDER") {
print "<folder folded=\"yes\" toolbar=\"no\" >\n";
print " <title>" . $entry{"NAME"} . "</title>\n";
}
} elsif (/^\-$/) {
print "</folder>\n";
}
}
print "</xbel>\n"
--G4iJoqBmSsgzjUCe--