Monday, November 08, 2010 at 12:05 AM.

system.verbs.builtins.radio.webServer.pageFilter

on pageFilter (pta) {
	<<Changes
		<<11/5/02; 1:23:58 AM by JES
			<<Reversed the last change.
		<<10/28/02; 7:37:19 PM by JES
			<<Call html.processMacros with plainprocessing as true to prevent extra expansion of paragraph tags.
		<<1/31/02; 4:42:39 PM by DW
			<<Add ALT attributes to rssLink and radioBadge images.
		<<12/18/01; 12:01:13 PM by JES
			<<Comment out call to html.addPageToGlossary.
		<<12/11/01; 1:49:58 AM by JES
			<<Changed the path linked to by the <%rssLink%> macro, to match the saved location determined in radio.weblog.publishCategoryRss, with rss files saved in their own sub-folders. This backs out the change from 12/6/01; 11:28:01 PM .
		<<12/8/01; 8:45:49 PM by JES
			<<Added support for #subTemplate.txt. The text was being gathered up in radio.webserver.gatherAttributes, but it was never used.
		<<12/6/01; 11:28:01 PM by JES
			<<Changed the path linked to by the <%rssLink%> macro, to match the saved location determined in radio.weblog.publishCategoryRss.
		<<12/5/01; 4:06:27 PM by JES
			<<Generate rssLink in a try. This is necessary because we can't get the URL for the rss file until we have the user's cloud URL, but we need to run the setup page in order to get a usernum and upstream URL.
		<<12/2/01; 2:53:44 AM by JES
			<<If rendering a category page, set pta^.rssLink to a link to the category's rss file, instead of the weblog rss file.
		<<11/20/01; 3:32:28 PM by JES
			<<Call radio.html.drawNavigatorLinks to get the text for <%navigatorLinks%>.
		<<10/18/01; 9:10:23 PM by DW
			<<Undid the previous change where autoParagraphs is set false. This was causing the text on pages to be wrapped where it should not be. Keep an eye out for places where there are "extraneous <p> tags."
		<<8/2/01; 4:16:20 PM by JES
			<<Call radio.html.includeFile to get the navigatorLinks HTML, cascading style sheet, and JavaScript.
			<<When calling html.processMacros, make sure pta^.autoParagraphs is false, to avoid getting extraneous <p> tags.
		<<7/24/01; 9:29:33 PM by JES
			<<Added support for #cascadingStyleSheet files. This solves the { and } character problem for CSS.
		<<6/15/01; 12:18:50 AM by PBS
			<<Put the basic macros in the page table, instead of doing string replacements, so they can be used in body text also.
		<<5/18/01; 8:07:45 PM by DW
			<<Created. Called from the pageFilter in the website that all our content is rendered in the context of. 
	<<scratchpad.pagetable = pta^; edit (@scratchpad.pagetable)
	local (s = pta^.template, adrblog = pta^.radioResponder.adrblog);
	if defined (pta^.radioResponder.atts.subTemplate) {
		local (startchars = "{", endchars = "}");
		local (adrsiteprefs = @radio.data.website.["#prefs"]);
		if defined (adrsiteprefs^.macroStartCharacters) {
			startchars = adrsiteprefs^.macroStartCharacters};
		if defined (adrsiteprefs^.macroEndCharacters) {
			endchars = adrsiteprefs^.macroEndCharacters};
		local (searchfor = startchars + "bodytext" + endchars);
		s = string.replaceAll (s, searchfor, pta^.radioResponder.atts.subTemplate, false)};
	local (adratts = @pta^.radioResponder.atts);
	local (rssLink);
	bundle { //set rssLink
		local (f, pc = file.getPathChar ());
		if defined (pta^.categoryName) {
			local (adrcat = @adrblog^.categories.[pta^.categoryName]);
			local (fname = adrcat^.filename);
			f = radio.file.getAbsolutePath (adrblog^.prefs.rssCategoryFolderPath + fname + pc + "rss.xml")}
		else { //link to the main weblog rss file
			f = radio.file.getAbsolutePath (adrblog^.prefs.rssFilePath)};
		try { //this fails before upstreaming has been turned on for the first time, but we need to be able to run the setup page before upstreaming can be enabled
			local (tooltip = "Click to see the XML version of this web page.");
			rssLink = "<a href=\"" + radio.upstream.getFileUrl (f) + "\" title=\"" + tooltip + "\">" + radio.images.systemImageRef ("icons/xml", alt:tooltip) + "</a>"}};
	pta^.description = string (adrblog^.prefs.description);
	pta^.authorname = adrblog^.prefs.authorname;
	pta^.authormailaddress = adrblog^.prefs.authormailaddress;
	pta^.year = date.year ();
	pta^.now = clock.now ();
	pta^.siteName = adrblog^.prefs.title;
	pta^.rssLink = rssLink;
	pta^.radioBadge = "<a href=\"http://radio.userland.com/\">" + radio.macros.imageref ("/system/images/icons/radioBadge.gif", alt:"Click here to visit the Radio UserLand website.") + "</a>";
	pta^.cascadingStyleSheet = radio.html.includeFile ("cascadingStyleSheet", pta);
	pta^.navigatorLinks = radio.html.drawNavigatorLinks ();
	pta^.javaScript = radio.html.includeFile ("javaScript", pta);
	pta^.template = s;
	pta^.bodytext = html.processmacros (pta^.bodytext, false, adrPageTable: pta);
	return (true)}



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.