File:addLink.sit.hqxServer:www.orange-road.comModified:7/13/97; 12:37:40 AMSize:2KOwner:khagler@orange-road.com 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 html.data.page.title == 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 try s = html.refglossary ( whatGlossEntry ) s = string.replace ( s, whatGlossEntry, whatText ) else s = whatText return ( s )