%% Some utility HTML functions %%include "string.grg" %% Space characters are not allowed in any part of a URL according to the %% HTML specification - so the following replaces spaces in a string with %% an underscore. %% Although allowed we also remove apostrophes (') as they also seem to %% cause a lot of bother %%equate SUBSTSP(str) "" >> newstr if str <> "" then 0 >> ndx 0 >> nndx STRLEN(str) >> end while ndx <= end DO if str'ndx = 32 then newstr,95`nndx >> newstr else newstr,(str'ndx)`nndx >> newstr endif if str'ndx <> 39 then ++nndx >> nndx endif ++ndx >> ndx endwhile newstr,0`nndx >> newstr endif outputs(newstr) %% Returns str as an HREF anchor construct with text txt %%equate ANCHOR(str,txt) ANCHORS(str,"html",txt) %% Returns str as an HREF anchor construct with suffix suf and text txt %%equate ANCHORS(str,suf,txt) DANCHOR(str+"."+suf,txt) %% Returns str as an HREF anchor construct with text txt and including args %%equate ANCHORARGS(str,txt,args) outputs(""+txt+"") %%equate DANCHOR(str,txt) outputs(""+txt+"") %% Returns str as a URL with http:// prepended, / postpended and txt as the text %%equate LINK(str,txt) outputs(""+txt+"") %%equate MAIL(str,txt) if str <> "" then outputs(""+txt+"") else outputs(txt) endif %%equate MAILTO(str) if str <> "" then outputs(""+str+"") else outputs(str) endif %%end