Save Tiddler to TagMe
OK, saving a single tiddler to TagMe was relatively trivial. Hijacking the TiddlyWiki.prototype.saveTiddler() function and adding the following at the end.
var TiddlerObj = {subject:tiddler.title, body:tiddler.text, wikiword:tiddler.title, id:title, tags:tiddler.tags}
ajax.PostObject("tagme.asp", TiddlerObj, "POST", "action=save")
The action "save" is a new action in tagme.asp which basically inserts or updates depending on the existance of the tiddler. It also obtains the id from the wikiword in the parameter id.
ajax.PostObject is also a new function which simply serializes a simple object as a series of parameters basically resulting in the following post data:
subject=MyTiddler&body=Hello+World&wikiword=MyTiddler&id=MyOldTiddlerTitle&tags=Tag1,Tag+2
Actually in order to get the comma seperated tags we must pass the following as the tags attribute of TiddlerObj:
tags:tiddler.tags.join(’,').replace(/[\[\]]/, "")
This ensures the TW-style tags (Tag1 [[Tag 2]]) get converted to our CSV Tags.
