Monday, November 08, 2010 at 12:02 AM.


local (adrmenu = bookmarksMenu.init ());
local (adr = table.getCursorAddress ());

local (logic, title);

bundle { // if the nodeType defines a getBookmarkLogic script, use that
	local (adrNodeType);
	if (adradrtable: @adrNodeType) {
		if defined (adrNodeType^.getBookmarkLogic) {
			adrNodeType^.getBookmarkLogic (@logic, @title);
			return (bookmarksMenu.addBookmark (@logic, @title))}}};
bundle { // if there's a builtin script for the nodeType at builtinNodeTypes.nodeTypes.[type], use that
	local (type);
	if op.attributes.getOne ("type", @type) {
		if defined (bookmarksMenu.builtinNodeTypes.nodeTypes.[type]) {
			bookmarksMenu.builtinNodeTypes.nodeTypes.[type] (@logic, @title);
			return (bookmarksMenu.addBookmark (@logic, @title))}}};
bundle { // if the node has a URL attribute, bookmark the URL
	local (url);
	if op.attributes.getOne ("url", @url) {
		logic = "bookmarksMenu.openUrl (\"" + url + "\", \"<<title>>\")";
		title = op.getlinetext ();
		return (bookmarksMenu.addBookmark (@logic, @title))}}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.