Source Code for user.html.macros.glossTarget
on glossTarget (glossSpec, targetName) {
«glossTarget © 1997 by Philip Suh.
«Terms of Use:
«Permission granted to use and redistribute this script
«only if this documentation and copyright statement are
«included and unmodified. Use of this script is governed
«by the full copyright statement, available from the Script Archive.
«From the filsa.net Frontier Script Archive:
«Full documentation, updates, and other scripts are available from
«http://www.filsa.net/frontier/scripts/
«Docs -- version 2 Sun, Aug 24, 1997 at 11:05:35 AM by PS
«This script *requires* user.html.macros.glossPatcher,
«available from Phil's Script Archive:
«http://www.filsa.net/frontier/scripts/
«
«glossSpec can be
« a regular Frontier glossary reference or
«<a> tag of this form:
«<a href="page.html"> or
«<a href="page.html">My Page</a>
«if glossSpec does not yet exist in a glossary:
«the script returns the glossSpec in quotes.
«targetName
«should be the name of the targeted window
«if it is 'top, blank, parent, self' (one of the special targets)
«the script assumes that you forgot the underscore and adds it for you
«null targetName's return "_self"
«This script will return a <a target="targetName"> tag
local {
glossString;
textToInsert;
ix}; «index
case targetName {
"blank";
"self";
"parent";
"top" {
targetName = "_" + targetName};
"" { «null strings target themselves
targetName = "_self"}};
case true { «analyze glossSpec
string.lower(glossSpec) beginsWith "<a ";
glossSpec beginsWith "[[#glossPatch" {
«we don't process glossSpecs that already are <a> tags
«or glossary patch references
glossString = glossSpec}}
else {
«it's a regular glossary reference, so convert to <a> tag
try {
glossString = html.refGlossary (glossSpec)}
else { «if glossSpec doesn't exist, return it in quotes
window.msg (tryerror);
dialog.notify (tryerror);
return ("\"" + glossSpec + "\"")}};
if glossString beginsWith "[[#glossPatch " { «relative glossary
«turn relative glossaries into regular <a href> tags
glossString = user.html.macros.glossPatcher (glossString)};
textToInsert = " target=\"" + targetName + "\"";
ix = string.patternmatch (">", glossString);
if ix == 0 { « error, couldn't find closing '>' of the <a href> tag
local (errMsg);
errMsg = "<b>[<font color=\"red\"><blink>";
errMsg = errMsg + "glossTarget Macro Error</blink></font>--Couldn't convert ";
errMsg = errMsg + "this glossSpec into a valid targetted <a> tag: ";
errMsg = errMsg + glossSpec + "]</b>";
return (errMsg)};
glossString = string.insert (textToInsert, glossString, ix);
return (glossString)};
Go back to the main page for this script