1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00
A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
Go to file
2011-12-05 18:21:52 +00:00
js Added basic support for HTML rendering 2011-12-05 18:21:52 +00:00
node_modules/async Restored async.js module 2011-12-02 16:12:31 +00:00
test Improved readme and example recipe 2011-12-03 14:05:39 +00:00
.gitignore Introduced tmp/ directory for test artefacts 2011-11-25 15:51:02 +00:00
cook.js A bunch of changes to keep JSHint happy 2011-12-01 10:30:17 +00:00
ginsu.js Minor refactoring, including switching to strict mode 2011-11-30 17:27:00 +00:00
readme.md Noted plans for refactoring the command line interface 2011-12-05 13:46:51 +00:00
server.js Minor corrections and refactorings 2011-11-30 19:35:01 +00:00
test.sh Revised test data 2011-12-03 11:41:25 +00:00
wikitest.js Added basic support for HTML rendering 2011-12-05 18:21:52 +00:00

cook.js

This is an attempt to modernise TiddlyWiki's build system, which has been based on tools written in Ruby called Cook and Ginsu (see https://github.com/TiddlyWiki/cooker for details). They were first written in 2006 and have been heavily hacked since then.

This new version is written in JavaScript for node.js, with the intention that it can share code with TiddlyWiki itself.

The goal is to achieve byte-for-byte compatibility with the old tools, but only to support the features required by the recipe files that are currently in use by TiddlyWiki and TiddlySpace. One of the difficulties is that cook.rb is very buggy; the current build process for tiddlywiki.com relies on TiddlyWiki itself doing a save operation in the browser to clear up problems with duplicate tiddlers and badly formed attributes.

Usage

node cook.js <recipefile>

Cooks a recipe file and sends the output to STDOUT

node server.js <recipefile>

Cooks a recipe file and serves it over HTTP port 8000

node ginsu.js <tiddlywikifile> <outputdir>

Splits a TiddlyWiki file into separate .tid files and a split.recipe file.

Tiddlers can be read from .tid, .tiddler or TiddlyWeb-style fat `.json' files.

You can use filepaths or URLs to reference recipe files and tiddlers. For example, this recipe cooks the latest TiddlyWiki components directly from the online repositories:

recipe: https://raw.github.com/TiddlyWiki/tiddlywiki/master/tiddlywikinonoscript.html.recipe
tiddler: http://tiddlywiki-com.tiddlyspace.com/bags/tiddlywiki-com-ref_public/tiddlers.json?fat=1
tiddler: http://tiddlywiki-com.tiddlyspace.com/bags/tiddlywiki-com_public/tiddlers.json?fat=1

Testing

test.sh contains a simple test that cooks the main tiddlywiki.com recipe and compares it with the results of the old build process (ie, running cook.rb and then opening the file in a browser and performing a 'save changes' operation).

Current status

As of 2nd December 2011, cook.js can now build a fully functional TiddlyWiki from the existing recipe files. There are two or three minor whitespace issues that prevent full byte-for-byte compatibility.

Plans for new command line interface

The idea is to join cook.js, ginsu.js and server.js into a single command line tool, provisionally called tiddlywiki.js. This would be used as follows:

node tiddlywiki.js <options>

An interesting potential goal is that the same tiddlywiki.js file could be used in the browser as on the server side.

The command line options are processed left to right. The following options are available:

--recipe <filepath>			# Loads a specfied `.recipe` file
--load <filepath>			# Load additional tiddlers from TiddlyWiki files (`.html`), `.tiddler`, `.tid`, `.json` or other files
--savewiki <outdir>			# Saves all the loaded tiddlers as a single file TiddlyWiki in `.html` and RSS (`.xml`) format
--savetiddlers <outdir>		# Saves all the loaded tiddlers as `.tid` files in the specified directory
--serve <host and port>		# Serve the cooked TiddlyWiki at `/`, and single tiddlers at `/tiddlertitle`
--verbose 					# verbose output, useful for debugging

This example loads the tiddlers from a TiddlyWiki HTML file and makes them available over HTTP:

node tiddlywiki.js --load mywiki.html --serve 127.0.0.1:8000

This example cooks a TiddlyWiki from a recipe:

node tiddlywiki.js --recipe tiddlywiki.com/index.recipe --savewiki tmp/

This example ginsus a TiddlyWiki into its constituent tiddlers:

node tiddlywiki.js --load mywiki.html --savetiddlers tmp/tiddlers