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

lifeLinerSuite.menuCommands.addTags

on addTags () {
	<<Changes
		<<7/18/09; 11:35:51 AM by DW
			<<Created. Add tags. Separated by spaces. You can have a tag with a space in it by including it "in quotes."
	local (adrdata = lifelinersuite.init (), taglist = {}, s = "", tag, i);
	op.attributes.getone ("tags", @taglist);
	for tag in taglist {
		if tag contains " " {
			tag = '"' + tag + '"'};
		s = s + tag + " "};
	s = string.trimwhitespace (s);
	if dialog.ask ("Tags (separate with spaces) ?", @s) {
		bundle { //process quotes
			local (i, j);
			i = 1;
			loop {
				if i > sizeof (s) {
					break};
				if s [i] == '"' {
					for j = i + 1 to sizeof (s) {
						if s [j] == '"' {
							s = string.delete (s, j, 1);
							s = string.delete (s, i, 1);
							break}
						else {
							if s [j] == " " {
								s [j] = "\t"}}}}
				else {
					i++}}};
		taglist = {};
		for i = 1 to string.countfields (s, " ") {
			local (tag = string.nthfield (s, " ", i));
			tag = string.replaceall (tag, "\t", " ");
			taglist = taglist + tag};
		op.attributes.setone ("tags", taglist)}};
bundle { //test code
	addTags ()}



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.