From 34edb487842e8f57358a3cb9f2506839b9baf582 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 19 May 2012 18:23:14 +0100 Subject: [PATCH] A quick sweep for missing or inaccurate code comments --- core/modules/commands/dump.js | 2 +- core/modules/commands/load.js | 2 +- core/modules/commands/savetiddler.js | 2 +- core/modules/commands/server.js | 15 +--- core/modules/macros/button.js | 2 + core/modules/macros/chooser.js | 2 + core/modules/macros/download.js | 2 + core/modules/macros/echo.js | 2 + core/modules/macros/edit/edit.js | 2 + .../macros/edit/editors/bitmapeditor.js | 2 + .../modules/macros/edit/editors/texteditor.js | 2 + core/modules/macros/image.js | 2 + core/modules/macros/include.js | 2 + core/modules/macros/list.js | 2 + core/modules/macros/story/views/scroller.js | 2 +- core/modules/macros/version.js | 2 + core/modules/macros/video.js | 2 + core/modules/macros/view.js | 2 + core/modules/macros/zoomer.js | 2 + .../javascriptparser/javascriptparser.js | 2 +- core/modules/parsers/plaintextparser.js | 2 +- .../wikitextparser/rules/wikitextrules.js | 2 + core/modules/utils.js | 2 - core/static.template.html.tid | 3 - readme.md | 10 ++- tw5.com/tiddlers/CommandLineInterface.tid | 86 ++++++++++++++----- 26 files changed, 106 insertions(+), 52 deletions(-) diff --git a/core/modules/commands/dump.js b/core/modules/commands/dump.js index 2f989e691..851783c0a 100644 --- a/core/modules/commands/dump.js +++ b/core/modules/commands/dump.js @@ -3,7 +3,7 @@ title: $:/core/modules/commands/dump.js type: application/javascript module-type: command -Dump command +Dump command for inspecting TiddlyWiki internals \*/ (function(){ diff --git a/core/modules/commands/load.js b/core/modules/commands/load.js index 2aae4a7f9..0b179c308 100644 --- a/core/modules/commands/load.js +++ b/core/modules/commands/load.js @@ -3,7 +3,7 @@ title: $:/core/modules/commands/load.js type: application/javascript module-type: command -Load tiddlers command +Command to load tiddlers from a file \*/ (function(){ diff --git a/core/modules/commands/savetiddler.js b/core/modules/commands/savetiddler.js index 424653eaf..d58b71b4a 100644 --- a/core/modules/commands/savetiddler.js +++ b/core/modules/commands/savetiddler.js @@ -3,7 +3,7 @@ title: $:/core/modules/commands/savetiddler.js type: application/javascript module-type: command -Save tiddlers command +Command to save a tiddler to a file \*/ (function(){ diff --git a/core/modules/commands/server.js b/core/modules/commands/server.js index 53df9db24..b673d34bb 100644 --- a/core/modules/commands/server.js +++ b/core/modules/commands/server.js @@ -3,20 +3,7 @@ title: $:/core/modules/commands/server.js type: application/javascript module-type: command -Serve tiddlers over http. The server is very simple. At the root, it serves a rendering of a specified tiddler. Otherwise, it serves individual tiddlers encoded in JSON, and supports the basic HTTP operations for GET, PUT and DELETE. - -For example: - - --server 8080 $:/core/tiddlywiki5.template.html text/plain text/html - -The parameters are: - - --server - -* ''port'' - port number to serve from (defaults to "8080") -* ''roottiddler'' - the tiddler to serve at the root (defaults to "$:/core/tiddlywiki5.template.html") -* ''rendertype'' - the content type to which the root tiddler should be rendered (defaults to "text/plain") -* ''servetype'' - the content type with which the root tiddler should be served (defaults to "text/html") +Serve tiddlers over http \*/ (function(){ diff --git a/core/modules/macros/button.js b/core/modules/macros/button.js index b44ce8571..6f12abcc2 100644 --- a/core/modules/macros/button.js +++ b/core/modules/macros/button.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/button.js type: application/javascript module-type: macro +Button macro + \*/ (function(){ diff --git a/core/modules/macros/chooser.js b/core/modules/macros/chooser.js index fcfab7d46..de42e3393 100644 --- a/core/modules/macros/chooser.js +++ b/core/modules/macros/chooser.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/chooser.js type: application/javascript module-type: macro +Zooming chooser macro + \*/ (function(){ diff --git a/core/modules/macros/download.js b/core/modules/macros/download.js index 2baeda1ec..52f4fd93b 100644 --- a/core/modules/macros/download.js +++ b/core/modules/macros/download.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/download.js type: application/javascript module-type: macro +Download macro + \*/ (function(){ diff --git a/core/modules/macros/echo.js b/core/modules/macros/echo.js index 2ebdc090e..0eafd79f2 100644 --- a/core/modules/macros/echo.js +++ b/core/modules/macros/echo.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/echo.js type: application/javascript module-type: macro +Echo macro + \*/ (function(){ diff --git a/core/modules/macros/edit/edit.js b/core/modules/macros/edit/edit.js index e877db2c2..3c3debd90 100644 --- a/core/modules/macros/edit/edit.js +++ b/core/modules/macros/edit/edit.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/edit/edit.js type: application/javascript module-type: macro +Edit macro for editting fields and tiddlers + \*/ (function(){ diff --git a/core/modules/macros/edit/editors/bitmapeditor.js b/core/modules/macros/edit/editors/bitmapeditor.js index 10bec98e0..21f9565df 100644 --- a/core/modules/macros/edit/editors/bitmapeditor.js +++ b/core/modules/macros/edit/editors/bitmapeditor.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/edit/editors/bitmapeditor.js type: application/javascript module-type: editor +An editor plugin for editting bitmaps + \*/ (function(){ diff --git a/core/modules/macros/edit/editors/texteditor.js b/core/modules/macros/edit/editors/texteditor.js index 8cfacda30..2c10c56a5 100644 --- a/core/modules/macros/edit/editors/texteditor.js +++ b/core/modules/macros/edit/editors/texteditor.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/edit/editors/texteditor.js type: application/javascript module-type: editor +An editor plugin for editting text + \*/ (function(){ diff --git a/core/modules/macros/image.js b/core/modules/macros/image.js index 0b04e148f..1c7e00d38 100644 --- a/core/modules/macros/image.js +++ b/core/modules/macros/image.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/image.js type: application/javascript module-type: macro +Image macro for displaying images + \*/ (function(){ diff --git a/core/modules/macros/include.js b/core/modules/macros/include.js index 0f95f8bfd..34dd04ec5 100644 --- a/core/modules/macros/include.js +++ b/core/modules/macros/include.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/include.js type: application/javascript module-type: macro +Include macro + \*/ (function(){ diff --git a/core/modules/macros/list.js b/core/modules/macros/list.js index 06a9bdbcf..62705d47c 100644 --- a/core/modules/macros/list.js +++ b/core/modules/macros/list.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/list.js type: application/javascript module-type: macro +List macro + \*/ (function(){ diff --git a/core/modules/macros/story/views/scroller.js b/core/modules/macros/story/views/scroller.js index 123e317ca..5fb8ef5ac 100644 --- a/core/modules/macros/story/views/scroller.js +++ b/core/modules/macros/story/views/scroller.js @@ -3,7 +3,7 @@ title: $:/core/modules/macros/story/views/scroller.js type: application/javascript module-type: storyview -A storyview that shows a sequence of tiddlers and navigates by scrolling +A storyview that shows a sequence of tiddlers and navigates by smoothly scrolling \*/ (function(){ diff --git a/core/modules/macros/version.js b/core/modules/macros/version.js index 51f4b90c4..1a96564fc 100644 --- a/core/modules/macros/version.js +++ b/core/modules/macros/version.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/version.js type: application/javascript module-type: macro +Version macro + \*/ (function(){ diff --git a/core/modules/macros/video.js b/core/modules/macros/video.js index 840a9692b..1112cbf65 100644 --- a/core/modules/macros/video.js +++ b/core/modules/macros/video.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/video.js type: application/javascript module-type: macro +Video macro + \*/ (function(){ diff --git a/core/modules/macros/view.js b/core/modules/macros/view.js index 61e0c7d52..59b190e6e 100644 --- a/core/modules/macros/view.js +++ b/core/modules/macros/view.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/view.js type: application/javascript module-type: macro +View macro + \*/ (function(){ diff --git a/core/modules/macros/zoomer.js b/core/modules/macros/zoomer.js index 5ff056cc0..a4d13aaf5 100644 --- a/core/modules/macros/zoomer.js +++ b/core/modules/macros/zoomer.js @@ -3,6 +3,8 @@ title: $:/core/modules/macros/zoomer.js type: application/javascript module-type: macro +Zooming navigator macro + \*/ (function(){ diff --git a/core/modules/parsers/javascriptparser/javascriptparser.js b/core/modules/parsers/javascriptparser/javascriptparser.js index be7b41e49..d5ec7b50f 100644 --- a/core/modules/parsers/javascriptparser/javascriptparser.js +++ b/core/modules/parsers/javascriptparser/javascriptparser.js @@ -3,7 +3,7 @@ title: $:/core/modules/parsers/javascriptparser/javascriptparser.js type: application/javascript module-type: parser -Parses a JSON object into a parse tree +Parses a JavaScript program into a parse tree \*/ (function(){ diff --git a/core/modules/parsers/plaintextparser.js b/core/modules/parsers/plaintextparser.js index 0a777a856..dee70daf9 100644 --- a/core/modules/parsers/plaintextparser.js +++ b/core/modules/parsers/plaintextparser.js @@ -3,7 +3,7 @@ title: $:/core/modules/parsers/plaintextparser.js type: application/javascript module-type: parser -Renders plain text tiddlers +Parses plain text tiddlers \*/ (function(){ diff --git a/core/modules/parsers/wikitextparser/rules/wikitextrules.js b/core/modules/parsers/wikitextparser/rules/wikitextrules.js index dd8d994c5..2c76703c6 100755 --- a/core/modules/parsers/wikitextparser/rules/wikitextrules.js +++ b/core/modules/parsers/wikitextparser/rules/wikitextrules.js @@ -3,6 +3,8 @@ title: $:/core/modules/parsers/wikitextparser/rules/wikitextrules.js type: application/javascript module-type: wikitextrule +Rule modules for the wikitext parser + \*/ (function(){ diff --git a/core/modules/utils.js b/core/modules/utils.js index 46410dacd..624b1b59e 100644 --- a/core/modules/utils.js +++ b/core/modules/utils.js @@ -5,8 +5,6 @@ module-type: utils Various static utility functions. -This file is a bit of a dumping ground; the expectation is that most of these functions will be refactored. - \*/ (function(){ diff --git a/core/static.template.html.tid b/core/static.template.html.tid index a581c3757..27db90455 100644 --- a/core/static.template.html.tid +++ b/core/static.template.html.tid @@ -7,9 +7,6 @@ type: text/x-tiddlywiki-html >" /> - - - > diff --git a/readme.md b/readme.md index 411289656..42f38479f 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,10 @@ -

Welcome to TiddlyWiki5

Welcome to TiddlyWiki5, a reboot of TiddlyWiki, the venerable, reusable non-linear personal web notebook first released in 2004. It is a complete interactive wiki that can run from a single HTML file in the browser or as a powerful node.js application.

TiddlyWiki5 is currently at version 5.0.0.a2 and is under active development, which is to say that it is useful but incomplete. You can try out the prototype at http://tiddlywiki.com/tiddlywiki5, get involved in the development on GitHub or the discussions on the TiddlyWikiDev Google Group.

Introduction

Usage

TiddlyWiki5 can be used on the command line to perform an extensive set of operations based on RecipeFiles, TiddlerFiles and TiddlyWikiFiles.

Usage

-node core/boot.js <options> -
This boots the TiddlyWiki kernel and loads the core plugins. The wiki store is initially empty.

The command line options are processed sequentially from left to right. Processing pauses during long operations and then resumes with the next command line option in sequence.

The following options are available:
--load <filepath>Load tiddlers from 2.x.x TiddlyWiki files (.html), .tiddler, .tid, .json or other files
--savetiddler <title> <filename> [<type>]Save an individual tiddler as a specified MIME type, defaults to text/html
--wikitest <dir> [save]Run wikification tests against the tiddlers in the given directory. Include the save flag to save the test result files as the new targets
--dump tiddlersDump the titles of the tiddlers in the wiki store
--dump tiddler <title>Dump the fields of an individual tiddler
--dump shadowsDump the titles of the shadow tiddlers in the wiki store
--dump configDump the current core configuration
--verboseTriggers verbose output, useful for debugging

Examples

This example loads the tiddlers from a TiddlyWiki HTML file and then saves one of them in HTML:
+

Welcome to TiddlyWiki5

Welcome to TiddlyWiki5, a reboot of TiddlyWiki, the venerable, reusable non-linear personal web notebook first released in 2004. It is a complete interactive wiki that can run from a single HTML file in the browser or as a powerful node.js application.

TiddlyWiki5 is currently at version 5.0.0.a2 and is under active development, which is to say that it is useful but incomplete. You can try out the prototype at http://tiddlywiki.com/tiddlywiki5, get involved in the development on GitHub or the discussions on the TiddlyWikiDev Google Group.

Introduction

Usage

TiddlyWiki5 can be used on the command line to perform an extensive set of operations based on RecipeFiles, TiddlerFiles and TiddlyWikiFiles.

Examples

This example loads the tiddlers from a TiddlyWiki HTML file and then saves one of them in HTML:
node tiddlywiki.js --verbose --load mywiki.html --savetiddler ReadMe ./readme.html -

Notes

--wikitest looks for *.tid files in the specified folder. It then wikifies the tiddlers to both "text/plain" and "text/html" format and checks the results against the content of the *.html and *.txt files in the same directory.

Try it out

The easiest way to try out the code is to visit http://tiddlywiki.com/tiddlywiki5/

For trying it out under node.js, two batch files are provided:

  • run.sh boots the kernel and loads the core modules and then outputs the $tw global for inspection
  • bld.sh builds the new TiddlyWiki 5 HTML file (placed in the tmp/tw5/ directory by default)

Architecture

Overview


The heart of TiddlyWiki can be seen as an extensible representation transformation engine. Given the text of a tiddler and its associated MIME type, the engine can produce a rendering of the tiddler in a new MIME type. Furthermore, it can efficiently selectively update the rendering to track any changes in the tiddler or its dependents.

The most important transformations are from text/x-tiddlywiki wikitext into text/html or text/plain but the engine is used throughout the system for other transformations, such as converting images for display in HTML, sanitising fragments of JavaScript, and processing CSS.

The key feature of wikitext is the ability to include one tiddler within another (usually referred to as transclusion). For example, one could have a tiddler called Disclaimer that contains the boilerplate of a legal disclaimer, and then include it within lots of different tiddlers with the macro call <<tiddler Disclaimer>>. This simple feature brings great power in terms of encapsulating and reusing content, and evolving a clean, usable implementation architecture to support it efficiently is a key objective of the TiddlyWiki5 design.

It turns out that the transclusion capability combined with the selective refreshing mechanism provides a good foundation for building TiddlyWiki's user interface itself. Consider, for example, the StoryMacro in its simplest form:
<<story story:MyStoryTiddler>>
+

Usage

+node core/boot.js [--<option> [<arg>[,<arg>]]] +
Running boot.js from the command line boots the TiddlyWiki kernel, loads the core plugins and establishes an empty wiki store. It then sequentially processes the command line arguments. The arguments are separated with spaces. The commands are identified by the prefix --.

The commands are processed sequentially from left to right. Processing pauses during long operations and then resumes with the next command in sequence

Commands

The following commands are available.

load

--load <filepath>
Load tiddlers from 2.x.x TiddlyWiki files (.html), .tiddler, .tid, .json or other files

savetiddler

--savetiddler <title> <filename> [<type>]
Save an individual tiddler as a specified MIME type, defaults to text/html

wikitest

--wikitest <dir> [save]
Run wikification tests against the tiddlers in the given directory. Include the save flag to save the test result files as the new targets.

--wikitest looks for *.tid files in the specified folder. It then wikifies the tiddlers to both "text/plain" and "text/html" format and checks the results against the content of the *.html and *.txt files in the same directory.

server

--server <port> <roottiddler> <rendertype> <servetype>

The server is very simple. At the root, it serves a rendering of a specified tiddler. Away from the root, it serves individual tiddlers encoded in JSON, and supports the basic HTTP operations for GET, PUT and DELETE.

For example:
--server 8080 $:/core/tiddlywiki5.template.html text/plain text/html
+
The parameters are:
--server <port> <roottiddler> <rendertype> <servetype>
+
  • port - port number to serve from (defaults to "8080")
  • roottiddler - the tiddler to serve at the root (defaults to "$:/core/tiddlywiki5.template.html")
  • rendertype - the content type to which the root tiddler should be rendered (defaults to "text/plain")
  • servetype - the content type with which the root tiddler should be served (defaults to "text/html")

dump

--dump tiddlers
Dump the titles of the tiddlers in the wiki store

dump

--dump tiddler <title>
Dump the fields of an individual tiddler

dump

--dump shadows
Dump the titles of the shadow tiddlers in the wiki store

dump

--dump config
Dump the current core configuration

verbose

--verbose
Triggers verbose output, useful for debugging

Trying it out

For trying TiddlyWiki5 out under node.js, two batch files are provided:

  • run.sh boots the kernel and loads the core modules and then outputs the $tw global for inspection
  • bld.sh builds the new TiddlyWiki 5 HTML file (placed in the tmp/tw5/ directory by default)

Architecture

Overview


The heart of TiddlyWiki can be seen as an extensible representation transformation engine. Given the text of a tiddler and its associated MIME type, the engine can produce a rendering of the tiddler in a new MIME type. Furthermore, it can efficiently selectively update the rendering to track any changes in the tiddler or its dependents.

The most important transformations are from text/x-tiddlywiki wikitext into text/html or text/plain but the engine is used throughout the system for other transformations, such as converting images for display in HTML, sanitising fragments of JavaScript, and processing CSS.

The key feature of wikitext is the ability to include one tiddler within another (usually referred to as transclusion). For example, one could have a tiddler called Disclaimer that contains the boilerplate of a legal disclaimer, and then include it within lots of different tiddlers with the macro call <<tiddler Disclaimer>>. This simple feature brings great power in terms of encapsulating and reusing content, and evolving a clean, usable implementation architecture to support it efficiently is a key objective of the TiddlyWiki5 design.

It turns out that the transclusion capability combined with the selective refreshing mechanism provides a good foundation for building TiddlyWiki's user interface itself. Consider, for example, the StoryMacro in its simplest form:
<<story story:MyStoryTiddler>>
 
The story macro looks for a list of tiddler titles in the tiddler MyStoryTiddler, and displays them in sequence. The subtle part is that subsequently, if MyStoryTiddler changes, the <<story>> macro is selectively re-rendered. So, to navigate to a new tiddler, code merely needs to add the name of the tiddler and a line break to the top of MyStoryTiddler:
var storyTiddler = store.getTiddler("MyStoryTiddler");
 store.addTiddler(new Tiddler(storyTiddler,{text: navigateTo + "\n" + storyTiddler.text}));
 
The mechanisms that allow all of this to work are fairly intricate. The sections below progressively build the key architectural concepts of TiddlyWiki5 in a way that should provide a good basis for exploring the code directly.

Tiddlers

Tiddlers are an immutable dictionary of name:value pairs called fields.

The only field that is required is the title field, but useful tiddlers also have a text field, and some or all of the standard fields modified, modifier, created, creator, tags and type.

Hardcoded in the system is the knowledge that the tags field is a string array, and that the modified and created fields are JavaScript Date objects. All other fields are strings.

The type field identifies the representation of the tiddler text with a MIME type.

WikiStore

Groups of uniquely titled tiddlers are contained in WikiStore objects.

The WikiStore also manages the plugin modules used for macros, and operations like serializing, deserializing, parsing and rendering tiddlers.

Each WikiStore is connected to another shadow store that is used to provide default content. Under usual circumstances, when an attempt is made to retrieve a tiddler that doesn't exist in the store, the search continues into its shadow store (and so on, if the shadow store itself has a shadow store).

WikiStore Events

Clients can register event handlers with the WikiStore object. Event handlers can be registered to be triggered for modifications to any tiddler in the store, or with a filter to only be invoked when a particular tiddler or set of tiddlers changes.

Whenever a change is made to a tiddler, the wikistore registers a nexttick handler (if it hasn't already done so). The nexttick handler looks back at all the tiddler changes, and dispatches any matching event handlers.

Parsing and Rendering

TiddlyWiki parses the content of tiddlers to build an internal tree representation that is used for several purposes:
  • Rendering a tiddler to other formats (e.g. converting wikitext to HTML)
  • Detecting outgoing links from a tiddler, and from them...
  • ...computing incoming links to a tiddler
  • Detecting tiddlers that are orphans with no incoming links
  • Detecting tiddlers that are referred to but missing
The parse tree is built when needed, and then cached by the WikiStore until the tiddler changes.

TiddlyWiki5 uses multiple parsers:
  • Wikitext (text/x-tiddlywiki) in js/WikiTextParser.js
  • JavaScript (text/javascript) in js/JavaScriptParser.js
  • Images (image/png and image/jpg) in js/ImageParser.js
  • JSON (application/json) in js/JSONParser.js
Additional parsers are planned:
  • CSS (text/css)
  • Recipe (text/x-tiddlywiki-recipe)
One global instance of each parser is instantiated in js/App.js and registered with the main WikiStore object.

The parsers are all used the same way:
var parseTree = parser.parse(type,text) // Parses the text and returns a parse tree object
diff --git a/tw5.com/tiddlers/CommandLineInterface.tid b/tw5.com/tiddlers/CommandLineInterface.tid index 06cf0d8f4..7a02c8d54 100644 --- a/tw5.com/tiddlers/CommandLineInterface.tid +++ b/tw5.com/tiddlers/CommandLineInterface.tid @@ -2,35 +2,75 @@ title: CommandLineInterface modifier: JeremyRuston TiddlyWiki5 can be used on the command line to perform an extensive set of operations based on RecipeFiles, TiddlerFiles and TiddlyWikiFiles. - -!!Usage -` -node core/boot.js -` -This boots the TiddlyWiki kernel and loads the core plugins. The wiki store is initially empty. - -The command line options are processed sequentially from left to right. Processing pauses during long operations and then resumes with the next command line option in sequence. - -The following options are available: -|`--load ` |Load tiddlers from 2.x.x TiddlyWiki files (`.html`), `.tiddler`, `.tid`, `.json` or other files | -|`--savetiddler <filename> [<type>]` |Save an individual tiddler as a specified MIME type, defaults to `text/html` | -|`--wikitest <dir> [save]` |Run wikification tests against the tiddlers in the given directory. Include the `save` flag to save the test result files as the new targets | -|`--dump tiddlers` |Dump the titles of the tiddlers in the wiki store | -|`--dump tiddler <title>` |Dump the fields of an individual tiddler | -|`--dump shadows` |Dump the titles of the shadow tiddlers in the wiki store | -|`--dump config` |Dump the current core configuration | -|`--verbose` |Triggers verbose output, useful for debugging | !! Examples This example loads the tiddlers from a TiddlyWiki HTML file and then saves one of them in HTML: ` node tiddlywiki.js --verbose --load mywiki.html --savetiddler ReadMe ./readme.html ` -!! Notes -`--wikitest` looks for `*.tid` files in the specified folder. It then wikifies the tiddlers to both "text/plain" and "text/html" format and checks the results against the content of the `*.html` and `*.txt` files in the same directory. -!!Try it out -The easiest way to try out the code is to visit http://tiddlywiki.com/tiddlywiki5/ +!!Usage +` +node core/boot.js [--<option> [<arg>[,<arg>]]] +` +Running `boot.js` from the command line boots the TiddlyWiki kernel, loads the core plugins and establishes an empty wiki store. It then sequentially processes the command line arguments. The arguments are separated with spaces. The commands are identified by the prefix `--`. -For trying it out under `node.js`, two batch files are provided: +The commands are processed sequentially from left to right. Processing pauses during long operations and then resumes with the next command in sequence +!!Commands +The following commands are available. + +!!! load +`--load <filepath>` +Load tiddlers from 2.x.x TiddlyWiki files (`.html`), `.tiddler`, `.tid`, `.json` or other files + +!!! savetiddler +`--savetiddler <title> <filename> [<type>]` +Save an individual tiddler as a specified MIME type, defaults to `text/html` + +!!! wikitest +`--wikitest <dir> [save]` +Run wikification tests against the tiddlers in the given directory. Include the `save` flag to save the test result files as the new targets. + +`--wikitest` looks for `*.tid` files in the specified folder. It then wikifies the tiddlers to both "text/plain" and "text/html" format and checks the results against the content of the `*.html` and `*.txt` files in the same directory. + +!!! server +`--server <port> <roottiddler> <rendertype> <servetype>` + +The server is very simple. At the root, it serves a rendering of a specified tiddler. Away from the root, it serves individual tiddlers encoded in JSON, and supports the basic HTTP operations for GET, PUT and DELETE. + +For example: +{{{ +--server 8080 $:/core/tiddlywiki5.template.html text/plain text/html +}}} +The parameters are: +{{{ +--server <port> <roottiddler> <rendertype> <servetype> +}}} +* ''port'' - port number to serve from (defaults to "8080") +* ''roottiddler'' - the tiddler to serve at the root (defaults to "$:/core/tiddlywiki5.template.html") +* ''rendertype'' - the content type to which the root tiddler should be rendered (defaults to "text/plain") +* ''servetype'' - the content type with which the root tiddler should be served (defaults to "text/html") + +!!! dump +`--dump tiddlers` +Dump the titles of the tiddlers in the wiki store + +!!! dump +`--dump tiddler <title>` +Dump the fields of an individual tiddler + +!!! dump +`--dump shadows` +Dump the titles of the shadow tiddlers in the wiki store + +!!! dump +`--dump config` +Dump the current core configuration + +!!! verbose +`--verbose` +Triggers verbose output, useful for debugging + +!!Trying it out +For trying TiddlyWiki5 out under `node.js`, two batch files are provided: * `run.sh` boots the kernel and loads the core modules and then outputs the `$tw` global for inspection * `bld.sh` builds the new TiddlyWiki 5 HTML file (placed in the `tmp/tw5/` directory by default)