| Class | Tiddler |
| In: |
r4tw.rb
|
| Parent: | Object |
For creating and manipulating tiddlers
puts Tiddler.new({'tiddler'=>'Hello','text'=>'Hi there','tags'=>['tag1','tag2']})
| from_tw | -> | from_remote_tw |
| from_tw | -> | from_local_tw |
| fields | [RW] |
Depending on the arguments this can be used to create or import a tiddler in various ways.
If the argument is a Hash then it is used to specify a tiddler to be created from scratch.
Example:
t = Tiddler.new.from({
'tiddler'=>'HelloThere',
'text'=>'And welcome',
})
Other built-in fields are modified, created, modifier and tags. Any other fields you add will be created as tiddler extended fields. Text is the contents of the tiddler. Tiddler is the title of the tiddler.
If the argument looks like a file name (ie a string that doesn‘t match the other criteria then create a tiddler with the name being the file name and the contents being the contents of the file. Does some guessing about tags based on the file‘s extension. (This is customisable, see code for details). Also reads the file modified date and uses it.
Example:
t = Tiddler.new.from("myplugin.js")
If the argument is in the form file.html#TiddlerName or sitename.com/#TiddlerName then import TiddlerName from the specified location
Example:
t1 = Tiddler.new.from("myfile.html#SomeTiddler")
t2 = Tiddler.new.from("http://www.tiddlywiki.com/#HelloThere")
Creates a tiddler from a url. The entire contents of the page are the contents of the tiddler. You should set the ‘tiddler’ field and other fields using a hash as the second argument in the same format as creating a tiddler from scratch. There is no automatic tagging for this one so you should add tags yourself as required
Example:
t = Tiddler.new.from(
"http://svn.somewhere.org/Trunk/HelloWorld.js",
{'tiddler'=>'HelloWorld','tags'=>'systemConfig'}
)
If the argument is a string containing a tiddler div such as would be found in a TiddlyWiki storeArea then the tiddler is created from that div
Returns a hash containing the tiddlers extended fields Probably would include changecount at this stage at least