Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.html.data.standardMacros.cSourceFile
on cSourceFile (f) { <<an html macro includes a C source file with clean formatting
local (s = string (file.readwholefile (f)));
s = string.popleading (s, cr);
s = string.replaceall (s, "<", "<");
s = string.replaceall (s, tab + cr, cr);
s = string.replaceall (s, "\r\r\r\r", "\r \r \r \r");
s = string.replaceall (s, "\r\r\r", "\r \r \r");
s = string.replaceall (s, "\r\r", "\r \r");
local (header = "<table>\r");
header = header + "<tr><td><b><code>File:</b></td><td><code>" + file.filefrompath (f) + "</td>\r";
header = header + "<tr><td><b><code>Created:</b></td><td><code>" + file.created (f) + "</td>\r";
header = header + "<tr><td><b><code>Modified: </b></td><td><code>" + file.modified (f) + "</td>\r";
header = header + "</table>\r";
return (header + "<pre>\r" + s + "</pre>\r")}
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.