#!/usr/bin/perl # # bookmarks.pl version 1E-23 # # by Tom Rathborne - tomr@aceldama.com - http://www.aceldama.com/~tomr/ # # I'm to lazy to stick a license message in here. Do what you want with it. # # Usage: bookmarks.pl ~/.netscape/bookmarks.html > processed-bookmarks.html # # This script transforms a Netscape Navigator 4 bookmarks file into a # somewhat more valid HTML file, with all the bookmark metadata stripped # out. It doesn't handle descriptions. It does what I want, on my # bookmarks file, so please don't gripe if it doesn't work for you. # # You can see the output of this script on my bookmarks file at: # http://www.aceldama.com/~tomr/resources.html # # To make a named-anchor table-of-contents, make your top-level headings # end in ' - xxx' where 'xxx' is the name you would like to assign to # that heading. It requires that xxx =~ /[a-z]{3}/. By specifying a # three-letter mnemonic (rather than a number or something based on the # name of the category), you can ensure that people's bookmarks to your # named anchors do not become stale. # # If you want it to stop partway through your bookmarks file, you *must* # have a *top-level* bookmark named '- fin -' to say where. Otherwise, # it'll do your entire bookmarks file. # ### You'll probably want to customize these things: $html_head = `cat ~/www/_dev_/resources/head.html`; # what to print first $html_tail = `cat ~/www/_dev_/resources/tail.html`; # what to print last # Dates are in YYYY MM DD format because it makes the most sense to computers. $last_check = '1997.06.03'; # when all bookmarks were supposedly last verified $hr = '
//o; s/^<\/DL>
/<\/ul>/o; s/DL>/ul>/o; s/DT>/li>/o; s/
//o; s/ ALIASOF="[0-9]+"//o; s/ ALIASID="[0-9]+"//o; s/ ADD_DATE="[0-9]+"//o; s/ LAST_VISIT="[0-9]+"//o; s/ LAST_MODIFIED="[0-9]+"//o; s/ FOLDED//o; s/ NEWITEMHEADER//o; s/®/\®/go; s/ & / \& /go; s/