Sunday, February 06, 2011 at 12:00 AM.

system.verbs.builtins.io.client.saveBlogPost

on saveBlogPost () {
	<<Changes
		<<2/5/11; 2:39:04 PM by DW
			<<If the cursor is on or below a blog post headline when we save, shoot a copy of the outline over to Scripting2.
	local (adroutline = address (window.frontmost ()), oldcursor = op.getcursor ());
	local (oldtarget = target.set (adroutline), atts);
	loop {
		op.attributes.getall (@atts);
		if defined (atts.type) {
			if atts.type == "scripting2Post" {
				local (outlinecopy = adroutline^, oldtarget = target.set (@outlinecopy), newatts);
				op.reorg (left, infinity);
				op.reorg (up, infinity);
				if op.go (down, 1) {
					op.demote ();
					op.deleteline ()};
				scripting2Suite.editor.save (@outlinecopy);
				op.attributes.getall (@newatts); //get the atts Scripting2 saved there
				target.set (oldtarget);
				op.attributes.addgroup (@newatts); //transfer them to the big outline
				break}};
		if not op.go (left, 1) {
			break}};
	target.set (oldtarget);
	op.setcursor (oldcursor)};
bundle { //test code
	saveBlogPost ()}



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.