One way would be to use the r4tw Ruby classes:
http://randomibis.com/r4tw/
That's probably cleaner than the JS-based solution.
> hopefully using the built-in javascript functions
Those would only take effect when the TiddlyWiki file is opened/rendered
by a user/client (unless you're using server-side JavaScript, maybe, but
I know nothing about that) - but you seem to be aware that already.
> I was thinking of adding a javascript include somewhere in the file
> and having the server script write to the included .js file.
There's recently been a discussion on something very similar:
http://tinyurl.com/2ockfq
(http://groups.google.com/group/TiddlyWiki/browse_thread/thread/b602aa688c9fc2fa/)
For your purposes, loadExternal sounds like it does what you want. I'm
currently developing an enhanced version:
http://fnd.lewcid.org/svn/TiddlyWiki/plugins/TiddlyMasterPlugin/
> When the TW is started by the user, the included .js file will create
> (through document.write() ) a systemConfig tiddler
Using document.write() is not a good idea.
Take a look at the TiddlyMasterPlugin's importFiles() function; it
should give you an idea of how it works.
This function just creates new tiddlers from files; modifying existing
tiddlers would look something like this:
var tiddler = store.getTiddler(title);
if(tiddler) {
tiddler.text = "lorem ipsum dolor sit amet";
store.saveTiddler(currentTitle, newTitle, text, modifier,
modified, tags, fields, clearChangeCount, created);
}
> Even if this is the best way, I'm not sure how to place the <script
> src=external.js...> tag.
That's what the following shadow tiddlers are there for:
MarkupPostBody
MarkupPostHead
MarkupPreBody
MarkupPreHead
For an example of how this works, take a look at the "slave.html" sample
from the TiddlyMasterPlugin SVN repo.
HTH.
-- F.