|
From: creedon <icr...@us...> - 2005-07-08 04:31:45
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7501 Modified Files: refGlossary Log Message: check user table glossary now processes macros, defined s local for check the hierarchy for glossary tables Index: refGlossary =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/html/refGlossary,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** refGlossary 26 Mar 2005 19:42:59 -0000 1.1.1.1 --- refGlossary 8 Jul 2005 04:31:37 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.html.refGlossary ! on refGlossary (name) { Ç10/19/98; 6:51:19 AM by DW ÇWhen generating a link to an object by its name (see the last case) we now won't generate links to tables. ÇIt was always generating an incorrect link in previous versions, so this can't break websites. ÇChanges: Ç03/28/00; 2:16:58 PM by PBS ÇAdded the refGlossary callback. If an script in the page table named refGlossaryCallback exists, call it when the glossary item is found. The callback script takes the address of the glossary entry that was found and the address of a variable in which to place text. If the callback returns true, the text it placed in glossaryText is returned, otherwise the normal expansion takes place. local (adrPageTable = html.getPageTableAddress ()); local (adrObject = adrPageTable^.adrObject); local (adrParent = parentOf (adrObject^)); on foundIt (adr) { //new in 5.0 if defined (adrPageTable^.refGlossaryCallback) { local (glossaryText); if adrPageTable^.refGlossaryCallback^ (adr, @glossaryText) { return (glossaryText)}}; case typeOf (adr^) { scriptType { //new in 5.0, glossary items can be scripts return (adr^ ())}; tableType { //new in 5.0, convert a table (prettier to look at) to a glossPatch local (s = "[[#glossPatch ", path = adr^.path); if html.inResponder (adrPageTable) { path = string.popSuffix (path) + ".wsf"}; s = s + adr^.linetext + "|"; s = s + path + "|]]"; return (s)}} else { local (s = string (adr^)); if (s beginsWith "{") and (s endsWith "}") { return (html.processMacros (s, false, adrPageTable))} else { if html.inResponder (adrPageTable) and string (adr^) beginsWith "[[#glossPatch " { ÇSubstitute .wsf extension. local (path = string.popSuffix (string.nthField (s, '|', 2)) + ".wsf"); s = string.nthField (s, '|', 1) + "|" + path + "|]]"; return (s)} else { return (s)}}}}; if defined (adrPageTable^.glossary) { //look in the default glossary local (adrElement = @adrPageTable^.glossary^ [name]); if defined (adrElement^) { return (foundIt (adrElement))}}; try { //check the hierarchy for glossary tables local (nomad = adrParent, newNomad, found = false); on glossLookup (glossName) { if (defined (nomad^.[glossName])) { //the table has a glossary local (adrElement = @nomad^.[glossName].[name]); if defined (adrElement^) { //it defines the term found = true; return (foundIt (adrElement))}}}; loop { s = glossLookup ("glossary"); if found { return (s)}; s = glossLookup ("#glossary"); if found { return (s)}; newNomad = parentOf (nomad^); if newNomad == "" { break}; nomad = newNomad}}; try { //check the user table glossary return (string (user.html.glossary [name]))}; if not (name beginsWith "#") { try { //look for objects at the same level with the name local (normalizedName = html.normalizeName (name, adrPageTable)); local (ext = html.getPref ("fileExtension", adrPageTable)); local (adr = @adrParent^.[normalizedName]); if defined (adr^) { if typeof (adr^) != tabletype { return ("<a href=\"" + normalizedName + ext + "\">" + name + "</a>")}}; adr = adrParent^.[name]; if defined (adr^) { if typeof (adr^) != tabletype { return ("<a href=\"" + normalizedName + ext + "\">" + name + "</a>")}}}}; scriptError ("There is no glossary entry named \"" + name + "\"")} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:system.verbs.builtins.html.refGlossary ! on refGlossary (name) { ÇChanges Ç7/7/05; 8:04:45 PM by TAC Çcheck user table glossary now processes macros Çdefined s local for check the hierarchy for glossary tables Ç03/28/00; 2:16:58 PM by PBS ÇAdded the refGlossary callback. If an script in the page table named refGlossaryCallback exists, call it when the glossary item is found. The callback script takes the address of the glossary entry that was found and the address of a variable in which to place text. If the callback returns true, the text it placed in glossaryText is returned, otherwise the normal expansion takes place. Ç10/19/98; 6:51:19 AM by DW ÇWhen generating a link to an object by its name (see the last case) we now won't generate links to tables. It was always generating an incorrect link in previous versions, so this can't break websites. local (adrPageTable = html.getPageTableAddress ()); local (adrObject = adrPageTable^.adrObject); local (adrParent = parentOf (adrObject^)); on foundIt (adr) { //new in 5.0 if defined (adrPageTable^.refGlossaryCallback) { local (glossaryText); if adrPageTable^.refGlossaryCallback^ (adr, @glossaryText) { return (glossaryText)}}; case typeOf (adr^) { scriptType { //new in 5.0, glossary items can be scripts return (adr^ ())}; tableType { //new in 5.0, convert a table (prettier to look at) to a glossPatch local (s = "[[#glossPatch ", path = adr^.path); if html.inResponder (adrPageTable) { path = string.popSuffix (path) + ".wsf"}; s = s + adr^.linetext + "|"; s = s + path + "|]]"; return (s)}} else { local (s = string (adr^)); if (s beginsWith "{") and (s endsWith "}") { return (html.processMacros (s, false, adrPageTable))} else { if html.inResponder (adrPageTable) and string (adr^) beginsWith "[[#glossPatch " { ÇSubstitute .wsf extension. local (path = string.popSuffix (string.nthField (s, '|', 2)) + ".wsf"); s = string.nthField (s, '|', 1) + "|" + path + "|]]"; return (s)} else { return (s)}}}}; if defined (adrPageTable^.glossary) { //look in the default glossary local (adrElement = @adrPageTable^.glossary^ [name]); if defined (adrElement^) { return (foundIt (adrElement))}}; try { //check the hierarchy for glossary tables local (nomad = adrParent, newNomad, found = false, s); // 7/7/05; 8:05:14 PM by TAC - added s as local on glossLookup (glossName) { if (defined (nomad^.[glossName])) { //the table has a glossary local (adrElement = @nomad^.[glossName].[name]); if defined (adrElement^) { //it defines the term found = true; return (foundIt (adrElement))}}}; loop { s = glossLookup ("glossary"); if found { return (s)}; s = glossLookup ("#glossary"); if found { return (s)}; newNomad = parentOf (nomad^); if newNomad == "" { break}; nomad = newNomad}}; try { //check the user table glossary local (adrElement = @user.html.glossary [name]); if defined (adrElement^) { return (foundIt (adrElement))}}; if not (name beginsWith "#") { try { //look for objects at the same level with the name local (normalizedName = html.normalizeName (name, adrPageTable)); local (ext = html.getPref ("fileExtension", adrPageTable)); local (adr = @adrParent^.[normalizedName]); if defined (adr^) { if typeof (adr^) != tabletype { return ("<a href=\"" + normalizedName + ext + "\">" + name + "</a>")}}; adr = adrParent^.[name]; if defined (adr^) { if typeof (adr^) != tabletype { return ("<a href=\"" + normalizedName + ext + "\">" + name + "</a>")}}}}; scriptError ("There is no glossary entry named \"" + name + "\"")} \ No newline at end of file |