Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.html.data.standardMacros.bodyTag
on bodyTag (pagetable=nil) { // Build a body tag, with background image and text atts. <<Call this macro from your pageheader attribute to automatically build your body tag. <<Example of a #pageHeader outline. <<<html> <<<head> <<<title> <<{title} <<</title> <<</head> <<{bodyTag ()} <<Monday, January 05, 1998 at 4:17:30 PM by PBS <<Changes 4/6/98: <<Added support for onload and onunload parameters. <<Use #onload and #onunload directives. local (htmltext, bgref, oneatt); local (attslist = {"bgcolor", "alink", "vlink", "link", "text", "topmargin", "leftmargin", "marginheight", "marginwidth", "onload", "onunload"}); if pagetable == nil { pagetable = html.getPageTableAddress ()}; on add (s) { htmltext = htmltext + s}; <<Add background image. bgref = html.data.standardMacros.bgImageRef (pagetable:pagetable); if bgref != "" { add (" " + bgref)}; <<Add bgcolor, link, alink, vlink, text, topmargin, and leftmargin attributes. for oneatt in attslist { if defined (pagetable^.[oneatt]) { local (s = pagetable^.[oneatt]); if {"alink", "bgcolor", "text", "link", "vlink"} contains oneatt { if s beginsWith "#" { s = string.popLeading (s, '#')}; if s contains "," { local (r = string.nthField (s, ',', 1)); local (g = string.nthField (s, ',', 2)); local (b = string.nthField (s, ',', 3)); s = ""; on pushhex (gun) { local (hexs = string.hex (gun)); hexs = string.delete (hexs, 1, 2); <<pop off 0x <<hexs = string.mid (hexs, 1, 2) <<keep 2 most significant digits <<JimC - above was wrong - this works for 255 based colors hexs = string.mid (hexs, string.length(hexs)-1, 2); <<keep 2 most significant digits s = s + hexs}; pushhex (r); pushhex (g); pushhex (b)} else { if not (s beginsWith "0") { <<leave number values alone try {s = evaluate (s)}}}; s = "#" + s}; add (" " + oneatt+ "=\"" + s + "\"")}}; return ("<body" + htmltext + ">")}; bodyTag (@websites.["#data"])
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.