(function(){ /* Wikifier test rig Usage: node wikitest.js This command creates a store and loads up all the `*.tid` files in the test directory. Then it wikifies each tiddler in turn, verifying that the output matches `.html` and `.txt`. */ /*jslint node: true */ "use strict"; var Tiddler = require("./js/Tiddler.js").Tiddler, WikiStore = require("./js/WikiStore.js").WikiStore, TextProcessors = require("./js/TextProcessors.js").TextProcessors, WikiTextProcessor = require("./js/WikiTextProcessor.js").WikiTextProcessor, TiddlerConverters = require("./js/TiddlerConverters.js").TiddlerConverters, tiddlerInput = require("./js/TiddlerInput.js"), utils = require("./js/Utils.js"), util = require("util"), fs = require("fs"), path = require("path"); var testdirectory = process.argv[2], textProcessors = new TextProcessors(), tiddlerConverters = new TiddlerConverters(), store = new WikiStore({ textProcessors: textProcessors }), files = fs.readdirSync(testdirectory), titles = [], f,t,extname,basename; textProcessors.registerTextProcessor("text/x-tiddlywiki",new WikiTextProcessor({ textProcessors: textProcessors })); tiddlerInput.register(tiddlerConverters); for(f=0; f 1) { throw "Cannot use .JSON files"; } store.addTiddler(new Tiddler(tiddlers[0])); titles.push(tiddlers[0].title); } } for(t=0; t