Moved loading of core shadow tiddlers into the boot kernel

This commit is contained in:
Jeremy Ruston 2012-06-06 21:42:14 +01:00
parent 6319a7dee5
commit 2053b7c413
3 changed files with 19 additions and 17 deletions

View File

@ -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);

View File

@ -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:

View File

@ -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();