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

system.verbs.builtins.html.data.standardMacros.glossSub

on glossSub (whatGlossEntry, whatText, whatTarget=nil, anchor=nil, class=nil) {
	<<Written by Matt Neuburg, matt@tidbits.com, 
		<<Here's Matt's original posting that went with this script:
			<<Date:        08/17  5:07 PM
			<<Received:    08/17  5:26 PM
			<<From:        Matt Neuburg, matt@tidbits.com
			<<Reply-To:    frontier-central@scripting.com
			<<To:          frontier-central@scripting.com
			<<
			<<Here's a new version of glossSub() I just knocked together. As you know,
			<<glossSub() is a script you're supposed to call from a macro in a Web page
			<<object; it lets you use live link glossary entries, either normal <a>-type
			<<or automatically-generated glossPatch type, in such a way that the live
			<<link emanates from *any* text you desire, not just the text "hard-coded"
			<<into the link.
			<<
			<<This new version has two changes: (1) it decodes glossPatch expressions 
			<<all the way to HTML, and (2) it does targets, which a number of people have
			<<asked me about.
			<<
			<<Hope this proves useful. Share and enjoy (meaning, if there's something
			<<wrong with it, please post a fix!) - m.
		<<Converted to UserLand-style code, 11/19/97 at 2:37:30 PM by DW.
		<<For samples of calls see websites.samples.testNewFeatures.
	
	local (adrPageTable = html.getPageTableAddress ());
	local (s = html.refGlossary (whatGlossEntry));
	
	if string.patternMatch ("[[#glosspatch ", string.lower (s)) == 1 {
		adrPageTable^.renderedText = string.nthField (s, ' ', 1) + " " + whatText + "|" + string.nthField (s, '|', 2) + "|]]";
		html.data.standardmacros.glossaryPatcher ();
		s = adrPageTable^.renderedText}
	else {
		s = string.nthField (s, '>', 1) + ">" + whatText + "<" + string.nthField (s, '<', 3)};
	
	if anchor != nil { //add anchor -- PBS 5/16/98
		if not (anchor beginsWith "#") {
			anchor = "#" + anchor};
		s = string.replace (s, "\">", anchor + "\">")};
	
	if whatTarget != nil {
		s = string.replace (s, ">", " target=\"" + whatTarget + "\">")};
	
	if class != nil {
		s = string.replace (s, "<a ", "<a class=\"" + class + "\" ")};
	return (s)}



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.