File: addLink.sit.hqx
Modified: 7/13/97; 12:37:40 AM
Size: 2K
Attachments: None

The addLink macro lets you add a glossary entry to the page that will turn itself into normal (unlinked) text if the glossary entry refers to the current page. This is for navigation bars, although presumably it has other uses I haven't thought of.

It's called like this:
addLink ( whatText, whatGlossEntry=nil )
Where whatText is the text you want to appear in the link, and whatGlossEntry is the name of the glossary entry to link to, if that's different than whatText.

Here is the source code:

on addLink ( whatText, whatGlossEntry=nil )
     «First parameter is the text for the link, second is the glossary entry to link to.
          «Cribbed from NewsPage suite and Brent Deverman's useDimLink.
          «Sun, Jul 13, 1997 at 12:37:40 AM by KGH
     local (s)
     if whatGlossEntry == nil  « no specific target was given, so whatText must be a valid glossary entry
          whatGlossEntry = whatText
     if == whatGlossEntry  « return an unlinked word if the page name is the current page
          s = whatText
     else  « otherwise, put a glossPatch reference in, replaceing the original link text if desired
               s = html.refglossary ( whatGlossEntry )
               s = string.replace ( s, whatGlossEntry, whatText )
               s = whatText
     return ( s )

Site scripted with Userland Frontier
This page was last built on Sat, Aug 8, 1998 using the Sysop Suite (V1.0f1) on a PowerWave running Frontier.