TiddlyWiki tools for ruby

posted by simon on Wednesday, May 09, 2007

Maybe that should be ruby tools for TiddlyWiki. As previously mentioned some of the code used in Tiddlyspot (the part that assembles your TiddlyWiki file) is open source. If you know a bit of ruby you can use it for all kinds of TiddlyWiki fun. It's called r4tw and as of last night it supports TW 2.2 files and has some rudimentary RDoc. To use it just download the r4tw.rb file and put it in your current directory.

Here is the code repos. And here is the new RDoc (such as it is). To use it you just need r4tw.rb. You can skip the rest of the files. Some people say I should have just used cook and ginsu. They might be right but r4tw its guaranteed to cook your TiddlyWiki's 15% tastier. Just remember this catch phrase, "r4tw: now you're cooking". Or this other one, "we don't need to steenkin' recipe". ;)

But in seriousness they do have slightly different focii. R4tw considers the TW core (as distinct from the store area) as a black box, while cook can assemble it from separate js files. (Wtf is cook? See here).

Here is an actual snippet of Tiddlyspot code that's using r4tw:
...
source_file empty_file
copy_all_tiddlers_from flavour_file if File.exist? flavour_file
add_tiddler_from_file "#{tiddlyspot_content}/UploadPlugin.js"
package_as_from_dir   "#{tiddlyspot_content}/TspotSetupPlugin.js", "#{tiddlyspot_content}/TspotSetupPlugin"
...
dt = get_tiddler 'DefaultTiddlers'
dt.prepend_content "[[Welcome to Tiddlyspot]] " if dt
...
You can find more example code in the test unit folder. Sorry the tutorial might be a long time coming.

Anyway the reason I've been working on this is that I need so that Tiddlyspot can support 2.2 when it arrives. I've tested with the beta and so far so good. I'll probably wait until it's out of beta before making the flavour available and also like I said before I want to test the new 2.2 enhanced UploadPlugin.

Update
r4tw now has a home page.

0 Comments:

Post a Comment

<< Home