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

scripting2Suite.hacks.elimDupTextAtt

on elimDupTextAtt (opmltext) {
	<<Changes
		<<7/4/10; 1:45:06 PM by DW
			<<In some cases there's a second text attribute on the summit headline of the outline we're saving. It's the second one we want to get rid of.
	local (xstruct);
	xml.compile (opmltext, @xstruct);
	opmltext = xml.decompile (@xstruct);
	<<
	<<
	<<
	<<local (lo, title)
	<<op.xmltooutline (opmltext, @lo)
	<<bundle //set title
		<<local (oldtarget = target.set (@lo))
		<<op.firstsummit ()
		<<title = op.getlinetext ()
		<<
	<<opmltext = op.outlinetoxml (@lo)
	wp.newtextobject (opmltext, @scripting2Suite.hacks.opmltextPostHack);
	return (opmltext);
	
	
	
	
	local (pat = "\" text=\"", ix = string.patternmatch (pat, opmltext));
	if ix > 0 {
		local (i);
		<<wp.newtextobject (opmltext, @scripting2suite.hacks.opmltextPreHack)
		for i = ix + sizeof (pat) to sizeof (opmltext) {
			ch = opmltext [i];
			if opmltext [i] == '"' {
				local (ixstartdelete = ix + 2);
				opmltext = string.delete (opmltext, ixstartdelete, i - ixstartdelete + 2);
				<<wp.newtextobject (opmltext, @scripting2Suite.hacks.opmltextPostHack)
				break}}};
	return (opmltext)};
bundle { //test code
	local (s = string (scripting2Suite.hacks.opmltextPreHack));
	webbrowser.displaytext ("<pre>" + string.replaceall (elimDupTextAtt (s), "<", "<") + "</pre>")}



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.