diff --git a/rabbithole/core/boot.js b/rabbithole/core/boot.js index da365658c..d5e4592f9 100644 --- a/rabbithole/core/boot.js +++ b/rabbithole/core/boot.js @@ -198,7 +198,7 @@ $tw.plugins.registerPlugin = function(name,moduleType,moduleExports) { /* Register all plugin module tiddlers */ -$tw.plugins.registerPlugins = function() { +$tw.plugins.registerPluginModules = function() { for(var title in $tw.wiki.shadows.tiddlers) { var tiddler = $tw.wiki.shadows.getTiddler(title); if(tiddler.fields.type === "application/javascript" && tiddler.fields["module-type"] !== undefined) { @@ -276,13 +276,6 @@ Hashmap of field plugins by plugin name */ $tw.Tiddler.fieldPlugins = {}; -/* -Install any tiddler field plugin modules -*/ -$tw.Tiddler.installPlugins = function() { - $tw.Tiddler.fieldPlugins = $tw.plugins.getPluginsByTypeAsHashmap("tiddlerfield"); -}; - /* Register and install the built in tiddler field plugins */ @@ -312,7 +305,7 @@ $tw.plugins.registerPlugin($tw.config.root + "/kernel/tiddlerfields/tags","tiddl } }); // Install built in tiddler fields plugins so that they are available immediately -$tw.Tiddler.installPlugins(); +$tw.Tiddler.fieldPlugins = $tw.plugins.getPluginsByTypeAsHashmap("tiddlerfield"); /////////////////////////// Barebones wiki store @@ -370,6 +363,9 @@ $tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields) { for(var f in srcFields) { fields[f] = srcFields[f]; } + if(!fields.type) { + fields.type = type; + } if(deserializer) { return deserializer.call(this,text,fields); } else { @@ -527,11 +523,8 @@ $tw.boot.wikiPath = process.cwd(); /* Load the tiddlers contained in a particular file (and optionally the accompanying .meta file) */ -$tw.plugins.loadTiddlersFromFile = function(file,basetitle) { +$tw.plugins.loadTiddlersFromFile = function(file,fields) { var ext = path.extname(file), - fields = { - title: basetitle - }, extensionInfo = $tw.config.fileExtensions[ext], data = fs.readFileSync(file).toString(extensionInfo ? extensionInfo.encoding : "utf8"), tiddlers = $tw.wiki.deserializeTiddlers(ext,data,fields), @@ -548,21 +541,31 @@ $tw.plugins.loadTiddlersFromFile = function(file,basetitle) { /* Load all the plugins from the plugins directory */ -$tw.plugins.loadPlugins = function(filepath,basetitle,excludeRegExp) { +$tw.plugins.loadPluginsFromFolder = function(filepath,basetitle,excludeRegExp) { basetitle = basetitle || "$:/plugins"; excludeRegExp = excludeRegExp || /^\.DS_Store$|.meta$/; if(path.existsSync(filepath)) { var stat = fs.statSync(filepath); if(stat.isDirectory()) { var files = fs.readdirSync(filepath); - for(var f=0; f