1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-25 01:20:30 +00:00

More calming, clarifying renaming

This commit is contained in:
Jeremy Ruston 2012-08-30 14:53:35 +01:00
parent 8542bca4ea
commit b80332316b

View File

@ -234,9 +234,9 @@ $tw.utils.resolvePath = function(sourcepath,rootpath) {
/////////////////////////// Module mechanism /////////////////////////// Module mechanism
/* /*
Register a single module in the $tw.modules.types hashmap Register the exports of a single module in the $tw.modules.types hashmap
*/ */
$tw.modules.registerModule = function(name,moduleType,moduleExports) { $tw.modules.registerModuleExports = function(name,moduleType,moduleExports) {
if(!(moduleType in $tw.modules.types)) { if(!(moduleType in $tw.modules.types)) {
$tw.modules.types[moduleType] = []; $tw.modules.types[moduleType] = [];
} }
@ -246,7 +246,7 @@ $tw.modules.registerModule = function(name,moduleType,moduleExports) {
/* /*
Register all the module tiddlers that have a module type Register all the module tiddlers that have a module type
*/ */
$tw.modules.registerModules = function() { $tw.modules.registerModuleTiddlers = function() {
var title, tiddler; var title, tiddler;
// Execute and register any modules from plugins // Execute and register any modules from plugins
for(title in $tw.wiki.pluginTiddlers) { for(title in $tw.wiki.pluginTiddlers) {
@ -261,7 +261,7 @@ $tw.modules.registerModules = function() {
]; ];
$tw.modules.define(tiddler.fields.text,tiddler.fields["module-type"],window.eval(source.join(""))); $tw.modules.define(tiddler.fields.text,tiddler.fields["module-type"],window.eval(source.join("")));
// Register the module // Register the module
$tw.modules.registerModule(title,tiddler.fields["module-type"],$tw.modules.execute(title)); $tw.modules.registerModuleExports(title,tiddler.fields["module-type"],$tw.modules.execute(title));
} }
} }
} }
@ -269,7 +269,7 @@ $tw.modules.registerModules = function() {
for(title in $tw.wiki.tiddlers) { for(title in $tw.wiki.tiddlers) {
tiddler = $tw.wiki.getTiddler(title); tiddler = $tw.wiki.getTiddler(title);
if(tiddler.fields.type === "application/javascript" && tiddler.fields["module-type"] !== undefined) { if(tiddler.fields.type === "application/javascript" && tiddler.fields["module-type"] !== undefined) {
$tw.modules.registerModule(title,tiddler.fields["module-type"],$tw.modules.execute(title)); $tw.modules.registerModuleExports(title,tiddler.fields["module-type"],$tw.modules.execute(title));
} }
} }
}; };
@ -342,17 +342,17 @@ $tw.Tiddler.fieldModules = {};
/* /*
Register and install the built in tiddler field modules Register and install the built in tiddler field modules
*/ */
$tw.modules.registerModule("$:/boot/tiddlerfields/modified","tiddlerfield",{ $tw.modules.registerModuleExports("$:/boot/tiddlerfields/modified","tiddlerfield",{
name: "modified", name: "modified",
parse: $tw.utils.parseDate, parse: $tw.utils.parseDate,
stringify: $tw.utils.stringifyDate stringify: $tw.utils.stringifyDate
}); });
$tw.modules.registerModule("$:/boot/tiddlerfields/created","tiddlerfield",{ $tw.modules.registerModuleExports("$:/boot/tiddlerfields/created","tiddlerfield",{
name: "created", name: "created",
parse: $tw.utils.parseDate, parse: $tw.utils.parseDate,
stringify: $tw.utils.stringifyDate stringify: $tw.utils.stringifyDate
}); });
$tw.modules.registerModule("$:/boot/tiddlerfields/tags","tiddlerfield",{ $tw.modules.registerModuleExports("$:/boot/tiddlerfields/tags","tiddlerfield",{
name: "tags", name: "tags",
parse: $tw.utils.parseStringArray, parse: $tw.utils.parseStringArray,
stringify: function(value) { stringify: function(value) {
@ -467,7 +467,7 @@ $tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields) {
/* /*
Register the built in tiddler deserializer modules Register the built in tiddler deserializer modules
*/ */
$tw.modules.registerModule("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{ $tw.modules.registerModuleExports("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer",{
"application/javascript": function(text,fields) { "application/javascript": function(text,fields) {
var headerCommentRegExp = new RegExp($tw.config.jsModuleHeaderRegExpString,"mg"), var headerCommentRegExp = new RegExp($tw.config.jsModuleHeaderRegExpString,"mg"),
match = headerCommentRegExp.exec(text); match = headerCommentRegExp.exec(text);
@ -478,7 +478,7 @@ $tw.modules.registerModule("$:/boot/tiddlerdeserializer/js","tiddlerdeserializer
return [fields]; return [fields];
} }
}); });
$tw.modules.registerModule("$:/boot/tiddlerdeserializer/tid","tiddlerdeserializer",{ $tw.modules.registerModuleExports("$:/boot/tiddlerdeserializer/tid","tiddlerdeserializer",{
"application/x-tiddler": function(text,fields) { "application/x-tiddler": function(text,fields) {
var split = text.split(/\r?\n\r?\n/mg); var split = text.split(/\r?\n\r?\n/mg);
if(split.length > 1) { if(split.length > 1) {
@ -490,14 +490,14 @@ $tw.modules.registerModule("$:/boot/tiddlerdeserializer/tid","tiddlerdeserialize
return [fields]; return [fields];
} }
}); });
$tw.modules.registerModule("$:/boot/tiddlerdeserializer/txt","tiddlerdeserializer",{ $tw.modules.registerModuleExports("$:/boot/tiddlerdeserializer/txt","tiddlerdeserializer",{
"text/plain": function(text,fields) { "text/plain": function(text,fields) {
fields.text = text; fields.text = text;
fields.type = "text/plain"; fields.type = "text/plain";
return [fields]; return [fields];
} }
}); });
$tw.modules.registerModule("$:/boot/tiddlerdeserializer/html","tiddlerdeserializer",{ $tw.modules.registerModuleExports("$:/boot/tiddlerdeserializer/html","tiddlerdeserializer",{
"text/html": function(text,fields) { "text/html": function(text,fields) {
fields.text = text; fields.text = text;
fields.type = "text/html"; fields.type = "text/html";
@ -544,7 +544,7 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
/* /*
Register a deserializer that can extract tiddlers from the DOM Register a deserializer that can extract tiddlers from the DOM
*/ */
$tw.modules.registerModule("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{ $tw.modules.registerModuleExports("$:/boot/tiddlerdeserializer/dom","tiddlerdeserializer",{
"(DOM)": function(node) { "(DOM)": function(node) {
var extractTextTiddler = function(node) { var extractTextTiddler = function(node) {
var e = node.firstChild; var e = node.firstChild;
@ -737,7 +737,7 @@ $tw.loadTiddlersFromFolder(path.resolve($tw.boot.wikiPath,$tw.config.wikiTiddler
$tw.wiki.installPlugins(); $tw.wiki.installPlugins();
// Register typed modules from the tiddlers we've just loaded // Register typed modules from the tiddlers we've just loaded
$tw.modules.registerModules(); $tw.modules.registerModuleTiddlers();
// Run any startup modules // Run any startup modules
var mainModules = $tw.modules.types.startup; var mainModules = $tw.modules.types.startup;