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

system.verbs.builtins.pikeRenderer.drivers.html.internalLink

on internalLink (url, linetext, adrprestring, adrpoststring, flsubs=true, permalinkstring="") {
	<<Changes
		<<5/27/02; 8:08:00 AM by DW
			<<Added permalink string, allow the renderer to tell us what to use for the permalink string.
		<<9/19/01; 11:42:05 AM by DW
			<<Added optional flsubs param. If true we use a smaller graphic for the internal link.
			<<Since these items can be quite long (they're not just headlines) we use string.hashmd5 to generate the label.
			<<http://docserver.userland.com/string/hashMD5
	local (imgurl, imgwidth, imgheight, labelname, linktitle);
	if flsubs {
		imgurl = "http://www.scripting.com/images/leftArrow.gif";
		imgwidth = 11;
		imgheight = 9;
		local (i, labelname = linetext, ch);
		for i = sizeof (labelname) downto 1 {
			ch = labelname [i];
			if (not string.isalpha (ch)) and (not string.isnumeric (ch)) and (ch != ' ') {
				labelname = string.delete (labelname, i, 1)}};
		labelname = string.innerCaseName (labelname);
		linktitle = "Permanent link to '" + linetext + "' in archive.";
		adrpoststring^ = "<a name=\"" + labelname + "\"> </a>" + "<a href=\"" + url + "#" + labelname + "\" title=\"" + linktitle + "\">" + "<img src=\"" + imgurl + "\" height=\"" + imgheight + "\" width=\"" + imgwidth + "\" border=\"0\"></a>" + adrpoststring^}
	else {
		imgurl = "http://www.scripting.com/images/2001/09/20/sharpPermaLink3.gif";
		imgwidth = 6;
		imgheight = 9;
		
		bundle { //set labelname
			if permalinkstring == "" {
				<<According to Jim Roepcke, a label can't begin with a numeric character
					<<http://jim.roepcke.com/2001/09/20#item2805
				labelname = "l" + string.hashmd5 (linetext)}
			else {
				labelname = permalinkstring}};
		linktitle = "Permanent link to this item in archive.";
		adrprestring^ = adrprestring^ + "<a name=\"" + labelname + "\">";
		adrpoststring^ = " <a href=\"" + url + "#" + labelname + "\" title=\"" + linktitle + "\">" + "<img src=\"" + imgurl + "\" height=\"" + imgheight + "\" width=\"" + imgwidth + "\" border=\"0\"></a>" + adrpoststring^}}



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.