From 2053b7c413b9f1db153cd703657e7e017514bcfe Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 6 Jun 2012 21:42:14 +0100 Subject: [PATCH] Moved loading of core shadow tiddlers into the boot kernel --- core/boot.js | 20 +++++++++++++++++++- core/modules/deserializers.js | 12 ------------ core/modules/startup.js | 4 ---- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/core/boot.js b/core/boot.js index 8a52fc219..f7c10478b 100644 --- a/core/boot.js +++ b/core/boot.js @@ -53,7 +53,7 @@ $tw.plugins.moduleTypes = $tw.plugins.moduleTypes || {}; // hashmap by module ty $tw.config = $tw.config || {}; // Constants -$tw.config.root = $tw.config.root || "$:"; // Root for module titles (eg, "$:/kernel/boot.js") +$tw.config.root = $tw.config.root || "$:"; // Root for module titles (eg, "$:/core/boot.js") $tw.config.bootModuleSubDir = $tw.config.bootModuleSubDir || "./modules"; $tw.config.wikiPluginsSubDir = $tw.config.wikiPluginsSubDir || "./plugins"; $tw.config.wikiShadowsSubDir = $tw.config.wikiShadowsSubDir || "./wiki"; @@ -406,6 +406,21 @@ $tw.plugins.registerPlugin($tw.config.root + "/kernel/tiddlerdeserializer/tid"," return [fields]; } }); +$tw.plugins.registerPlugin($tw.config.root + "/kernel/tiddlerdeserializer/txt","tiddlerdeserializer",{ + "text/plain": function(text,fields) { + fields.text = text; + fields.type = "text/plain"; + return [fields]; + } +}); +$tw.plugins.registerPlugin($tw.config.root + "/kernel/tiddlerdeserializer/html","tiddlerdeserializer",{ + "text/html": function(text,fields) { + fields.text = text; + fields.type = "text/html"; + return [fields]; + } +}); + // Install the tiddler deserializer plugins so they are immediately available $tw.plugins.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerPlugins); @@ -620,6 +635,9 @@ $tw.modules.execute = function(moduleName,moduleRoot) { // Load plugins from the plugins directory $tw.loadTiddlersFromFolder(path.resolve($tw.boot.bootPath,$tw.config.bootModuleSubDir),null,null,true); +// Load up the shadow tiddlers in the root of the core directory +$tw.loadTiddlersFromFolder($tw.boot.bootPath,"$:/core",/^\.DS_Store$|.meta$|^modules$/,true); + // Load any plugins in the wiki plugins directory $tw.loadTiddlersFromFolder(path.resolve($tw.boot.wikiPath,$tw.config.wikiPluginsSubDir),null,null,true); diff --git a/core/modules/deserializers.js b/core/modules/deserializers.js index 76a8e8d6f..515926cce 100644 --- a/core/modules/deserializers.js +++ b/core/modules/deserializers.js @@ -12,18 +12,6 @@ Plugins to deserialise tiddlers from a block of text /*global $tw: false */ "use strict"; -exports["text/plain"] = function(text,fields) { - fields.text = text; - fields.type = "text/plain"; - return [fields]; -}; - -exports["text/html"] = function(text,fields) { - fields.text = text; - fields.type = "text/html"; - return [fields]; -}; - /* Utility function to parse an old-style tiddler DIV. It looks like this: diff --git a/core/modules/startup.js b/core/modules/startup.js index 5001c3d08..f30589c60 100644 --- a/core/modules/startup.js +++ b/core/modules/startup.js @@ -38,10 +38,6 @@ exports.startup = function() { $tw.plugins.applyMethods("treenode",$tw.Tree); // Get version information $tw.version = $tw.utils.extractVersionInfo(); - // Load up the shadow tiddlers in the root of the core directory (we couldn't do before because we didn't have the serializers installed) - if(!$tw.browser) { - $tw.loadTiddlersFromFolder($tw.boot.bootPath,"$:/core",/^\.DS_Store$|.meta$|^modules$/,true); - } // Set up the wiki store $tw.wiki.initMacros(); $tw.wiki.initEditors();