Wednesday, February 16, 2011 at 12:00 AM.


on buildOnePage (adrpage, adruser=nil) {
		<<11/9/10; 8:12:50 AM by DW
			<<Replace calls to file.writewholefile with river2Suite.static.writeFile.
		<<5/4/10; 10:14:21 AM by DW
			<<Call river2Suite.static.setupPagetable to set up the pagetable.
		<<3/26/10; 8:29:38 AM by DW
			<<New optional parameter, adruser, if not nil, we render the static page for that user. Also fixed bug with searchArgs, it was initialized as a table, it's supposed to be a string.
		<<3/17/10; 7:48:28 PM by DW
	local (adrdata = river2suite.init (), pagetable, htmltext);
	river2Suite.static.setupPagetable (adruser, @pagetable, ".html");
	<<bundle //old code, factored 5/4/10 by DW
		<<new (tabletype, @pagetable)
		<<pagetable.path = ""
		<<pagetable.client = "staticbuild" //must be defined
		<<bundle //set searchArgs, 3/26/10 by DW
			<<if adruser == nil
				<<pagetable.searchargs = ""
				<<pagetable.searchargs = "user=" + string.urlencode (nameof (adruser^))
		<<new (tabletype, @pagetable.river2)
		<<pagetable.river2.flStaticBuild = true
		<<bundle //set pagetable.river2.staticFname, 3/26/10 by DW
			<<if adruser == nil
				<<pagetable.river2.staticFname = nameof (adrpage^) + ".html"
				<<pagetable.river2.staticFname = nameof (adruser^) + ".html"
		<<pagetable.method = "GET"
	htmltext = html.buildObject (adrpage, @pagetable);
	<<scratchpad.bopparams = pagetable
	river2Suite.static.writeFile (pagetable.river2.staticFname, htmltext, adruser);
	river2Suite.loadImage ("title.gif", @pagetable);
	river2Suite.loadImage ("linkToFeedContents.gif", @pagetable);
	if defined (pagetable.river2images) {
		local (imgfolder = "images" + file.getpathchar (), adrintable);
		for adrintable in @pagetable.river2images {
			local (adrimage = adrintable^);
			river2Suite.static.writeFile (imgfolder + nameof (adrintable^), adrimage^, adruser)}};
		<<scratchpad.river2images = pagetable.river2images
	adrdata^.stats.static.whenLastPageBuild = ()};
bundle { //test code
	buildOnePage (@river2Website.index, @config.river2.users.wikiriver)}

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.