Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.html.data.standardMacros.spacePixels
on spacePixels (ctpixels, orientation="horizontal") {
local (adrPageTable = html.getPageTableAddress ());
local (folder = file.FolderFromPath (adrPageTable^.f));
local (fname = "space.gif");
local (f = folder + fname);
if html.inResponder (adrPageTable) { //support website framework responder
fname = "space.wsf"};
on buildHtml () {
local (s = "");
s = "<img src=\"" + fname + "\" ";
if orientation == "horizontal" {
s = s + "width=" + ctpixels + " height=1"}
else {
s = s + "width=1" + " height=" + ctpixels};
s = s + " alt=\"\">";
return (s)};
bundle { //The user may have specified a spacer gif.
local (spaceGif);
if defined (user.html.prefs.spaceGif) {
spaceGif = user.html.prefs.spaceGif};
if defined (adrPageTable^.spaceGif) {
spaceGif = adrPageTable^.spaceGif};
if spaceGif != nil { //user has specified an alternate gif
if spaceGif contains ".gif" or spaceGif beginsWith "http://" {
<<It's hard-coded.
fname = spaceGif;
return (buildHtml ())}
else { //call imageRef
local (height = 1, width = 1);
if orientation != "horizontal" {
height = ctpixels}
else {
width = ctpixels};
return (html.data.standardMacros.imageRef (spaceGif, "", width:width, height:height))}}};
bundle { //write default space.gif to disk
<<This is optimized for file and ftp -- don't write if the file already exists on disk.
local (fileWriter, preview = false);
try {preview = adrPageTable^.preview};
fileWriter = adrPageTable^.fileWriter;
on writeSpaceGif () {
html.writeFile (f, @html.data.images.space, 'GIFf', html.getPref ("imgFileCreator", adrPageTable), clock.now (), adrPageTable)};
<<file.writeWholeFile (f, html.data.images.space, 'GIFf', html.getPref ("imgFileCreator", adrPageTable), clock.now ())
if string.lower (fileWriter) == "file" {
if not (file.exists (f)) {
writeSpaceGif ()}}
else { //not file or preview -- could be writing anywhere
writeSpaceGif ()}};
return (buildHtml ())}
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.