diff --git a/js/App.js b/js/App.js index caccdefb463..d9372e28561 100644 --- a/js/App.js +++ b/js/App.js @@ -41,12 +41,25 @@ var App = function() { {title: "MarkupPostHead", text: ""}, {title: "MarkupPreBody", text: ""}, {title: "MarkupPostBody", text: ""}, + {title: "TabTimeline", text: "<>"}, + {title: "TabAll", text: "<>"}, + {title: "TabTags", text: "<>"}, + {title: "TabMoreMissing", text: "<>"}, + {title: "TabMoreOrphans", text: "<>"}, + {title: "TabMoreShadowed", text: "<>"}, + {title: "AdvancedOptions", text: "<>"}, + {title: "PluginManager", text: "<>"}, + {title: "SystemSettings", text: ""}, + {title: "ToolbarCommands", text: "|~ViewToolbar|closeTiddler closeOthers +editTiddler > fields syncing permalink references jump|\n|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|"}, {title: "WindowTitle", text: "<> - <>"}, {title: "DefaultTiddlers", text: "[[GettingStarted]]"}, {title: "MainMenu", text: "[[GettingStarted]]"}, {title: "SiteTitle", text: "My TiddlyWiki"}, {title: "SiteSubtitle", text: "a reusable non-linear personal web notebook"}, - {title: "SiteUrl", text: ""} + {title: "SiteUrl", text: ""}, + {title: "SideBarOptions", text: '<><><><><><><>'}, + {title: "SideBarTabs", text: '<>'}, + {title: "TabMore", text: '<>'} ]; this.store.shadows.shadows = shadowShadowStore; for(t=0; t> -<> +<> -<> +<> diff --git a/tiddlywiki.js b/tiddlywiki.js index 0fc9d3854f8..6c8f5a7fb6f 100644 --- a/tiddlywiki.js +++ b/tiddlywiki.js @@ -7,7 +7,8 @@ TiddlyWiki command line interface /*jslint node: true */ "use strict"; -var WikiStore = require("./js/WikiStore.js").WikiStore, +var App = require("./js/App.js").App, + WikiStore = require("./js/WikiStore.js").WikiStore, Tiddler = require("./js/Tiddler.js").Tiddler, Recipe = require("./js/Recipe.js").Recipe, tiddlerInput = require("./js/TiddlerInput.js"), @@ -20,6 +21,8 @@ var WikiStore = require("./js/WikiStore.js").WikiStore, aync = require("async"), http = require("http"); +var app = new App(); + var parseOptions = function(args,defaultSwitch) { var result = [], a = 0, @@ -44,58 +47,10 @@ var parseOptions = function(args,defaultSwitch) { }; var switches = parseOptions(Array.prototype.slice.call(process.argv,2),"dummy"), - store = new WikiStore(), recipe = null, lastRecipeFilepath = null, currSwitch = 0; -store.registerTextProcessor("text/x-tiddlywiki",new WikiTextProcessor({ - store: store -})); -// Register the standard tiddler serializers and deserializers -tiddlerInput.register(store); -tiddlerOutput.register(store); - -// Frightful temporary hack, but setup the sandbox for evaluated macro parameters -var Sandbox = require("./js/Sandbox.js").Sandbox; -store.sandbox = new Sandbox(fs.readFileSync("parsers/javascript.pegjs","utf8")); - -store.installMacros(); - -// Add the shadow tiddlers that are built into TiddlyWiki -var shadowShadowStore = new WikiStore({ - shadowStore: null - }), - shadowShadows = [ - {title: "StyleSheet", text: ""}, - {title: "MarkupPreHead", text: ""}, - {title: "MarkupPostHead", text: ""}, - {title: "MarkupPreBody", text: ""}, - {title: "MarkupPostBody", text: ""}, - {title: "TabTimeline", text: "<>"}, - {title: "TabAll", text: "<>"}, - {title: "TabTags", text: "<>"}, - {title: "TabMoreMissing", text: "<>"}, - {title: "TabMoreOrphans", text: "<>"}, - {title: "TabMoreShadowed", text: "<>"}, - {title: "AdvancedOptions", text: "<>"}, - {title: "PluginManager", text: "<>"}, - {title: "SystemSettings", text: ""}, - {title: "ToolbarCommands", text: "|~ViewToolbar|closeTiddler closeOthers +editTiddler > fields syncing permalink references jump|\n|~EditToolbar|+saveTiddler -cancelTiddler deleteTiddler|"}, - {title: "WindowTitle", text: "<> - <>"}, - {title: "DefaultTiddlers", text: "[[GettingStarted]]"}, - {title: "MainMenu", text: "[[GettingStarted]]"}, - {title: "SiteTitle", text: "My TiddlyWiki"}, - {title: "SiteSubtitle", text: "a reusable non-linear personal web notebook"}, - {title: "SiteUrl", text: ""}, - {title: "SideBarOptions", text: '<><><><><><><>'}, - {title: "SideBarTabs", text: '<>'}, - {title: "TabMore", text: '<>'} - ]; -store.shadows.shadows = shadowShadowStore; -for(var t=0; t 0 ? args[0] : 8000; http.createServer(function (request, response) { var title = decodeURIComponent(url.parse(request.url).pathname.substr(1)), - tiddler = store.getTiddler(title); + tiddler = app.store.getTiddler(title); if(tiddler) { response.writeHead(200, {"Content-Type": "text/html"}); - response.end(store.renderTiddler("text/html",title),"utf8"); + response.end(app.store.renderTiddler("text/html",title),"utf8"); } else { response.writeHead(404); response.end(); diff --git a/wikitest.js b/wikitest.js index 1b674a7a4ae..3cdc031ccc6 100644 --- a/wikitest.js +++ b/wikitest.js @@ -14,7 +14,8 @@ verifying that the output matches `.html` and `.txt`. /*jslint node: true */ "use strict"; -var Tiddler = require("./js/Tiddler.js").Tiddler, +var App = require("./js/App.js").App, + Tiddler = require("./js/Tiddler.js").Tiddler, WikiStore = require("./js/WikiStore.js").WikiStore, WikiTextProcessor = require("./js/WikiTextProcessor.js").WikiTextProcessor, tiddlerInput = require("./js/TiddlerInput.js"), @@ -23,29 +24,21 @@ var Tiddler = require("./js/Tiddler.js").Tiddler, fs = require("fs"), path = require("path"); +var app = new App(); + var testdirectory = process.argv[2], - store = new WikiStore(), files = fs.readdirSync(testdirectory), titles = [], f,t,extname,basename; -store.registerTextProcessor("text/x-tiddlywiki",new WikiTextProcessor({ - store: store -})); -tiddlerInput.register(store); - -// Frightful temporary hack, but setup the sandbox for evaluated macro parameters -var Sandbox = require("./js/Sandbox.js").Sandbox; -store.sandbox = new Sandbox(fs.readFileSync("parsers/javascript.pegjs","utf8")); - for(f=0; f 1) { throw "Cannot use .JSON files"; } - store.addTiddler(new Tiddler(tiddlers[0])); + app.store.addTiddler(new Tiddler(tiddlers[0])); titles.push(tiddlers[0].title); } } @@ -53,9 +46,9 @@ for(f=0; f