mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-11-18 04:44:27 +00:00
Docs update
This commit is contained in:
1 parent
bac2c0ec07
commit
6d0da350c7
2 files changed
+4
-1
No files matched your search
@@ -14,7 +14,7 @@ var renderer = parseTree.compile("text/html");
|
||||
myNode.innerHTML = renderer.render(tiddler,store);
|
||||
// And then, later:
|
||||
renderer.rerender(node,changes,tiddler,store,renderStep);
|
||||
</pre>The parameters to <code>rerender()</code> are:<br><table class='table'><tbody><tr class='evenRow'><th align='left'>Name</th><th align='left'>Description</th></tr><tr class='oddRow'><td align='left'>node</td><td align='left'>A reference to the DOM node containing the rendering to be rerendered</td></tr><tr class='evenRow'><td align='left'>changes</td><td align='left'>A hashmap of <code>{title: "created|modified|deleted"}</code> indicating which tiddlers have changed since the original rendering</td></tr><tr class='oddRow'><td align='left'>tiddler</td><td align='left'>The tiddler providing the rendering context</td></tr><tr class='evenRow'><td align='left'>store</td><td align='left'>The store to use for resolving references to other tiddlers</td></tr><tr class='oddRow'><td align='left'>renderStep</td><td align='left'>See below</td></tr></tbody></table>Currently, the only macro that supports rerendering is the <code><<story>></code> macro; all other macros are rerendered by calling the ordinary <code>render()</code> method again. The reason that the <code><<story>></code> macro goes to the trouble of having a <code>rerender()</code> method is so that it can be carefully selective about not disturbing tiddlers in the DOM that aren't affected by the change. If there were, for instance, a video playing in one of the open tiddlers it would be reset to the beginning if the tiddler were rerendered.<br><br><br></div><br><h1>Plugin Mechanism</h1><div data-tiddler-target='PluginMechanism' data-tiddler-template='PluginMechanism' class='tw-tiddler-frame'><h1>Introduction</h1><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a> is based on a 500 line boot kernel that runs on node.js or in the browser, and everything<br>else is plugins.<br><br>The kernel boots just enough of the <a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>TiddlyWiki</a> environment to allow it to load tiddlers as plugins and execute them (a barebones tiddler class, a barebones wiki store class, some utilities etc.). Plugin modules are written like <code>node.js</code> modules; you can use <code>require()</code> to invoke sub components and to control load order.<br><br>There are several different types of plugins: parsers, serializers, deserializers, macros etc. It goes much further than you might expect. For example, individual tiddler fields are plugins, too: there's a plugin that knows how to handle the <code>tags</code> field, and another that knows how to handle the special behaviour of<br>the <code>modified</code> and <code>created</code> fields.<br><br>Some plugins have further sub-plugins: the wikitext parser, for instance, accepts rules as individual plugins.<br><br><h1>Plugins and Modules</h1>In <a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a>, a plugin is a bundle of related tiddlers that are distributed together as a single unit. Plugins can include tiddlers which are <a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a> modules. <br><br>The file <code>core/boot.js</code> is a barebones <a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>TiddlyWiki</a> kernel that is just sufficient to load the core plugin modules and trigger a startup plugin module to load up the rest of the application.<br><br>The kernel includes:<br><ul><li> Eight short shared utility functions</li><li> Three methods implementing the plugin module mechanism</li><li> The <code>$tw.Tiddler</code> class (and three field definition plugins)</li><li> The <code>$tw.Wiki</code> class (and three tiddler deserialization methods)</li><li> Code for the browser to load tiddlers from the HTML DOM</li><li> Code for the server to load tiddlers from the file system</li></ul><br>Each module is an ordinary <code>node.js</code>-style module, using the <code>require()</code> function to access other modules and the <code>exports</code> global to return <a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a> values. The boot kernel smooths over the differences between <code>node.js</code> and the browser, allowing the same plugin modules to execute in both environments.<br><br>In the browser, <code>core/boot.js</code> is packed into a template HTML file that contains the following elements in order:<br><br><ul><li> Ordinary and shadow tiddlers, packed as HTML <code><DIV></code> elements</li><li> <code>core/bootprefix.js</code>, containing a few lines to set up the plugin environment</li><li> Plugin <a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a> modules, packed as HTML <code><SCRIPT></code> blocks</li><li> <code>core/boot.js</code>, containing the boot kernel</li></ul><br>On the server, <code>core/boot.js</coLine truncated
|
||||
</pre>The parameters to <code>rerender()</code> are:<br><table class='table'><tbody><tr class='evenRow'><th align='left'>Name</th><th align='left'>Description</th></tr><tr class='oddRow'><td align='left'>node</td><td align='left'>A reference to the DOM node containing the rendering to be rerendered</td></tr><tr class='evenRow'><td align='left'>changes</td><td align='left'>A hashmap of <code>{title: "created|modified|deleted"}</code> indicating which tiddlers have changed since the original rendering</td></tr><tr class='oddRow'><td align='left'>tiddler</td><td align='left'>The tiddler providing the rendering context</td></tr><tr class='evenRow'><td align='left'>store</td><td align='left'>The store to use for resolving references to other tiddlers</td></tr><tr class='oddRow'><td align='left'>renderStep</td><td align='left'>See below</td></tr></tbody></table>Currently, the only macro that supports rerendering is the <code><<story>></code> macro; all other macros are rerendered by calling the ordinary <code>render()</code> method again. The reason that the <code><<story>></code> macro goes to the trouble of having a <code>rerender()</code> method is so that it can be carefully selective about not disturbing tiddlers in the DOM that aren't affected by the change. If there were, for instance, a video playing in one of the open tiddlers it would be reset to the beginning if the tiddler were rerendered.<br><br><br></div><br><h1>Plugin Mechanism</h1><div data-tiddler-target='PluginMechanism' data-tiddler-template='PluginMechanism' class='tw-tiddler-frame'><h1>Introduction</h1><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a> is based on a 500 line boot kernel that runs on node.js or in the browser, and everything<br>else is plugins.<br><br>The kernel boots just enough of the <a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>TiddlyWiki</a> environment to allow it to load tiddlers as plugins and execute them (a barebones tiddler class, a barebones wiki store class, some utilities etc.). Plugin modules are written like <code>node.js</code> modules; you can use <code>require()</code> to invoke sub components and to control load order.<br><br>There are several different types of plugins: parsers, serializers, deserializers, macros etc. It goes much further than you might expect. For example, individual tiddler fields are plugins, too: there's a plugin that knows how to handle the <code>tags</code> field, and another that knows how to handle the special behaviour of<br>the <code>modified</code> and <code>created</code> fields.<br><br>Some plugins have further sub-plugins: the wikitext parser, for instance, accepts rules as individual plugins.<br><br><h1>Plugins and Modules</h1>In <a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a>, a plugin is a bundle of related tiddlers that are distributed together as a single unit. Plugins can include tiddlers which are <a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a> modules. <br><br>The file <code>core/boot.js</code> is a barebones <a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>TiddlyWiki</a> kernel that is just sufficient to load the core plugin modules and trigger a startup plugin module to load up the rest of the application.<br><br>The kernel includes:<br><ul><li> Eight short shared utility functions</li><li> Three methods implementing the plugin module mechanism</li><li> The <code>$tw.Tiddler</code> class (and three field definition plugins)</li><li> The <code>$tw.Wiki</code> class (and three tiddler deserialization methods)</li><li> Code for the browser to load tiddlers from the HTML DOM</li><li> Code for the server to load tiddlers from the file system</li></ul><br>Each module is an ordinary <code>node.js</code>-style module, using the <code>require()</code> function to access other modules and the <code>exports</code> global to return <a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a> values. The boot kernel smooths over the differences between <code>node.js</code> and the browser, allowing the same plugin modules to execute in both environments.<br><br>In the browser, <code>core/boot.js</code> is packed into a template HTML file that contains the following elements in order:<br><br><ul><li> Ordinary and shadow tiddlers, packed as HTML <code><DIV></code> elements</li><li> <code>core/bootprefix.js</code>, containing a few lines to set up the plugin environment</li><li> Plugin <a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a> modules, packed as HTML <code><SCRIPT></code> blocks</li><li> <code>core/boot.js</code>, containing the boot kernel</li></ul><br>On the server, <code>core/boot.js</coLine truncated
|
||||
param1: Parameter value
|
||||
param2: value
|
||||
"unnamed parameter"
|
||||
|
||||
@@ -59,3 +59,6 @@ The 'core' is the boot kernel plus the set of plugin modules that it loads. It c
|
||||
TiddlyWiki5 makes extensive use of JavaScript inheritance:
|
||||
* Tree nodes defined in `$:/core/treenodes/` all inherit from `$:/core/treenodes/node.js`
|
||||
* Macros defined in `$:/core/macros/` all inherit from `$:/core/treenodes/macro.js`
|
||||
|
||||
`tiddlywiki.plugin` files
|
||||
|
||||
Reference in new issue
Block a user