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

system.verbs.builtins.radio.outliner.menuCommands.postToWeblog

on postToWeblog () {
	<<Changes
		<<4/8/02; 10:24:40 AM by DW
			<<In the previous version it would just take the text of the cursor headline. In the new version it traverses the cursor outline, marking it up with <ul>s and <li>s, and posts that to your weblog.
		<<3/25/02; 8:41:39 PM by JES
			<<Created.
	bundle { //set the initial post text
		local (s, indentlevel = 0);
		on doline () {
			local (lt = op.getlinetext ());
			if indentlevel > 0 {
				s = s + string.filledstring ("\t", indentlevel) + "<li>" + lt + "</li>"}
			else {
				s = s + "<b>" + lt + "</b>"};
			if op.countsubs (1) > 0 {
				local (flcollapse = true);
				if op.subsexpanded () {
					flcollapse = false}
				else {
					op.expand (1)};
				op.go (right, 1);
				s = s + "<ul>\r";
				indentlevel++;
				loop {
					doline ();
					if not op.go (down, 1) {
						break}};
				indentlevel--;
				s = s + string.filledstring ("\t", indentlevel) + "</ul>\r";
				op.go (left, 1);
				if flcollapse {
					op.collapse ()}}
			else {
				s = s + "\r"}};
		doline ();
		system.temp.radio.misc.initialPostText = s;
		wp.newtextobject (s, @scratchpad.testtext)};
	local (atts);
	if op.attributes.getAll (@atts) {
		if defined (atts.url) {
			system.temp.radio.misc.initialPostLink = atts.url};
		if defined (atts.htmlUrl) { //RSS nodes have this attribute
			system.temp.radio.misc.initialPostLink = atts.rssUrl}};
	radio.menuCommands.openPage (radio.data.systemUrls.homePage)}
<<bundle //test code
	<<postToWeblog ()



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.