Tuesday, August 18, 2009 at 7:30 PM.

newsRiverSuite.cleanStoryText

on cleanStoryText (s) {
	<<Changes
		<<2/14/09; 11:03:44 AM by DW
			<<Support for new Pheedo ad format.
			<<<p><a href="http://mobile.nytimes.com/click.phdo?i=63dd92300803417fa7d536b618caea51">Recovery Bill Gets Final Approval</a>. The $787 billion package got 60 votes in the Senate, readying it for the president&single=1’s signature. Party lines were unmoved.<br clear="both" style="clear: both;"/><br clear="both" style="clear: both;"/><a href="http://www.pheedo.com/click.phdo?s=63dd92300803417fa7d536b618caea51&p=1"><img alt="" style="border: 0;" border="0" src="http://www.pheedo.com/img.phdo?s=63dd92300803417fa7d536b618caea51&p=1"/></a><img src="http://www.pheedo.com/feeds/tracker.php?i=63dd92300803417fa7d536b618caea51" style="display: none;" border="0" height="1" width="1" alt=""/></p>
		<<8/9/08; 5:26:31 PM by DW
			<<Support NY Times <span class="advertisement">.
		<<5/19/08; 11:34:59 AM by DW
			<<Support Pheedo links and images.
		<<8/26/06; 5:56:00 AM by DW
			<<Created. At Gnomedex 2005, Brad Feld, who is the lead investor on Feedburner, suggested that I write a script to strip out all the bugs that FB adds. I thought what a waste of effort, they go to all the trouble to add them, and then I have to go to a lot of trouble to remove them. Wouldn't it be better if they didn't add them in the first place?
			<<Anyway, a year later, I got around to doing it. :->
			<<example
				<<<div class="feedflare"><a href="http://feeds.feedburner.com/~f/MicroPersuasion?a=jT4Tj2mM"><img src="http://feeds.feedburner.com/~f/MicroPersuasion?i=jT4Tj2mM" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/MicroPersuasion?a=D2XD4y8e"><img src="http://feeds.feedburner.com/~f/MicroPersuasion?i=D2XD4y8e" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/MicroPersuasion?a=hAeRuc5f"><img src="http://feeds.feedburner.com/~f/MicroPersuasion?i=hAeRuc5f" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/MicroPersuasion?a=cLADF8iE"><img src="http://feeds.feedburner.com/~f/MicroPersuasion?i=cLADF8iE" border="0"></img></a></div><img src="http://feeds.feedburner.com/~r/MicroPersuasion/~4/15031199"/></p>
	bundle { //Pheedo, 2/14/09 by DW
		local (pat = "<br clear=\"both\" style=\"clear: both;\"/>");
		local (ix = string.patternmatch (pat, s));
		if ix > 0 {
			s = string.mid (s, 1, ix-1)}};
	bundle { //Feedburner, 8/26/06 by DW
		local (ix, i);
		loop {
			ix = string.patternmatch ("<div class=\"feedflare\">", s);
			if ix == 0 {
				break};
			for i = ix to sizeof (s) {
				if s [i] == '<' {
					if string.lower (string.mid (s, i, 6)) == "</div>" {
						wp.newtextobject (string.mid (s, ix, i - ix + 6), @scratchpad.deletedtext);
						s = string.delete (s, ix, i - ix + 6);
						break}}}}};
	bundle { //Pheedo, 5/19/08 by DW
		local (pat = "<br/><br/>    <a href=\"http://www.pheedo.com");
		local (ix = string.patternmatch (pat, s));
		if ix > 0 {
			s = string.mid (s, 1, ix-1)}};
	bundle { //NY Times, 8/9/08 by DW
		local (pat = "<br/><br/><span class=\"advertisement\">");
		local (ix = string.patternmatch (pat, s));
		if ix > 0 {
			s = string.mid (s, 1, ix-1)}};
	return (s)}
<<bundle //test code
	<<wp.newtextobject (cleanStoryText (string (aggregatorData.stories.["02265810"].storytext)), @scratchpad.tmp2)



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.