bookmark - Public Bookmark Generator (v0.5.1)


bookmark [-help] [-verb] [-index [depth]] [-timestamp [mode]] [-new [day-Newheader] [-fastaccess [value[:value[:...]]]]  [-look mode]  [-Fromfile file] [-stylesheet [cssurl1[,cssurl2[,...]]]] [-dlc [filename]] [-Duplicate [filename]] [-withfiles] [-pif] [-keyword keyword[:keyword[:...]]]  bookmarkfile outputfile


bookmark is a program that is still being evolved. Current version is already stable.


Public Bookmark Generator is a Perl script designed to extract specific data from a netscape user bookmark file. The script works by reading the content of a bookmark file (bookmarkfile), and recreating a html bookmark file (outputfile) with extensions such as index, fast access, timestamp, new links, and removed bookmark tree branches.

An extension to PBM, Dead Link Check (DLC) is available.


To obtain options values and options default values, run bookmark -help


print a description of all the bookmark options.

run the script in verbose mode, printing advanced information on STDERR.

-index [depth]
will generate an index for all bookmark folders up to depth depth.

-timestamp [mode]
will add a time stamp in the header and footer of the generated bookmark file, giving the information on when the Public Bookmark File has been generated. mode specify which time mode to use.

-new [day]
will add a (NEW) entry after each bookmark file and folder that has been added in the last day days.

will print all new links in a condensed list.

-fastaccess [value[:value[:...]]]]
will add a fast access header and footer. values are : separated. values can be Index, Links, or user references. Index and Links are fast access to first depth entries. User references are fast access to entries which description possesses user references. Used without arguments, will just add a fast access entry to New Links, Index, and Links starting point (when possible).

-look mode
change the look of the generated Public Bookmark File.

-Fromfile file
will use file as a template to replace special values by HTML content. Does not replace file, use it to generate outputfile.

Note that when using this option, you can not use the cssurls arguments from the stylesheet option.

Note also that using entries from an HTML template file will replace _PBM_ prefixed predefined values (may be blank values if the value corresponding option is not selected).

-stylesheet [cssurl1[,cssurl2[,...]]]
will generate a style sheet enabled outputfile by replacing some HTML tags by style sheet usable ones.

Uses an optional comma separated list of urls to include in the outputfile HTML header as style sheet definitions files.

-dlc [filename]
store entries for Dead Link Check script into filename (if provided; will use outputfile.dlc otherwise).

-Duplicate [filename]
store a list of duplicate entries into filename (if provided; will use outputfile.Dup otherwise).

output file will include links to file:/.

by default, PBM add a small footer indicating which version of PBM was used to generate this HTML page, as well as a HTML link to the PBM web page. This option tells PBM not to print this ``PBM information Footer''.

-keyword keyword[:keyword[:...]]]
keywords are the entries used by bookmark to cut down bookmark files and folders. Users should add those entries in the description fields of the netscape bookmark file as [keyword]



[ref:] is reserved for user references. [dlc] is reserved for excluding a file/folder from being in the Dead Link Check output file. User References should not start with bm_, fa_ or finish with _idx; those entries are reserved for folder links, fast access and indexes.



Working with keywords requires that the user edit its bookmark (with netscape) and add some Public Bookmark tags. Such tags are put inside [ ] (note that the script prints description fields next to the bookmark, but delete any description inside [ ]).

Recommendation for the use of keywords is that they should be uppercase. Lowercase values may be used by PBM to extend its command range.

Should one have some bookmark Folders and/or Files that are only accessible from an intranet network, on should set the description field for those bookmark entries to [IN] (like INternal) (with properly organized bookmarks, one should be able only to have to set a Folder description field).

Using the same idea, the user possesses some private bookmarks that he does not want anybody to see, he should set those entries descriptions to [PR] (like PRivate).

Finally, the user has a leisure Folder, he can edit the description for this folder with [LE] (like LEisures).

Now, if the user want to generate two different Public Bookmark, one for intranet use (keeping IN, but deleting PR and LE), the other for internet use (keeping LE, but deleting PR and IN), he could generate the first one :

bookmark -keyword PR:LE ~/.netscape/bookmarks.html ~/intranet.html

and the second one :

bookmark -keyword PR:IN ~/.netscape/bookmarks.html ~/internet.html


Public Bookmark Generator also uses the netscape description fields to make it possible to create references to specific entries in the bookmark file. To do so one has to use [ref:userref] to set the entry field of the bookmark File or Folder, where userref is the name of the reference. In case of Folder, if the index option is used, one can make HREFs to both userref and userref_idx (only to userref if the index option is not used). In case of File, an entry is generated (even if the use of it seems improper), that one can access by HREFing to userref.


When using the Fromfile option, PBM will proceed to create the output file by doing a basic search and replace of special _PBM_ prefixed tags. It also defines a simple way to override default variables for some HTML included code.

You do not have to use all the tags in the template file, for all tags recognized are converted if and only if the corresponding tag option is used.

Recognized search and replace tags are :

_PBM_TITLE_ is replaced in the generated web page by the title of your bookmarks (usually ``Bookmarks for ...'').

_PBM_LASTUPDATED_ (timestamp option) is replaced by the time the generated file was created (example : Wed Dec  1 23:16:55 1999 GMT).

_PBM_FASTACCESS_ (fastaccess option) is replaced by the HTML fast access accelerator.

_PBM_NEWHEADER_ and _PBM_NEWHEADERDATE_ (Newheader option) are replaced by the HTML formatted (look dependent) new header and the number of days for which entries are considered ``new''.

_PBM_INDEX_ (index option) is replaced by the HTML formatted (look dependent) index.

_PBM_LINKS_ is replaced by the HTML formatted (look dependent) links.

_PBM_TOOLINFO_ is replaced by the HTML tool information line.

Formatting tags are to be suffixed by a : and finish at the end of the line to be properly recognized.

Recognized formatting tags are :

_PBM_NEW_ (new option) to specify the ``new link'' HTML text (default value : <i>(NEW)</i>).

_PBM_NONEWLINKS_ (Newheader option) to specify the ``no new links added'' text (default value : <H6>No new links added</H6>).

Style sheet

PBM can now replace its HTML output formatting using style sheet friendly tags. Each New Links, Index and Links section is composed of two parts : the enclosing block and the individual lines.

The enclosing block is usually created using <DL> but when using the stylesheet option, will now be generated using <DIV>.

The individual lines are created by the use of <DT> but will be generated using <SPAN> with the stylesheet option.

The stylesheet option uses some cssurls (``,'' separated) optional arguments to specify urls (<HEAD> included entries) to style sheets.

More information on style sheets in the HTML 4.0 are available :


The script was developed to be able to publish one's bookmarks on web pages on a daily basis. To do so, on unices systems, it is possible to do it automatically by using crontab. To run the script at 6:15am on week days :

15 6 * * 1-5 bookmark -i 3 -t -n -N -f Index:Links:AMAL -k IN:PR ~/.netscape/bookmarks.html ~/public_html/bookmark.html

,will run the script with index generation (of depth 3), with timestamp, with new link entries hi-lighted and new links header, with a fast access to first depth indexes and links, as well as to the user reference AMAL (file), erasing bookmark entries that are INternal and PRivate.


It is possible now to extract an output file with the same links that are in the created public bookmark, an process the file using another perl script called deadlinkcheck to check validity of the web pages. A tag for the description field [dlc] does exist to avoid certain links (ex: search engines) folders/files to be added to this file.


You can find the Public Bookmark Generator homepage at : From this homepage, you can also see an example of run. The web page for DLC can be found at :


If you are using PBM to put your bookmarks available to everybody on the internet, please e-mail me ( with the address of the web page were your bookmarks are, so that I can add it to the known users list web page, available at :


For bug reporting please send an e-mail to the author at with [PBM] in the title.


Here are the list of person who helped improve this script, and that the author wish to thank :

Thomas Vogels for providing me with some ideas (and code) to extend the options range (blank and localtime)

Jens Woch for reporting an incompatibility between generated code and ``Kfm''.

Olivier Galibert for directing me to so that I can improve the generated HTML code.

Christophe Laprun for reporting a bug in the non use of news headers.

Olivier Galibert for helping me setting up configure.

Christophe Laprun for his help on the style sheet extension.

The sourceforge team for the fantastic job they are doing providing Open Source Coders such facilities.


Copyright (C) 1998-2001 Martial MICHEL

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

More license information :


 v0.0   : November 1998
 v0.1   : December 11th, 1998
 v0.2   : March 6th, 1999
 v0.2.1 : March 24th, 1999
 v0.2.2 : March 29th, 1999
 v0.3   : April 12th, 1999
 v0.3.1 : June 30th, 1999
 v0.4   : July 18th, 1999
 v0.4.1 : July 23rd, 1999
 v0.4.2 : August 23rd, 1999
 v0.5   : December 7th, 1999
 v0.5.1 : July 26th, 2001


Martial MICHEL (