1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Renamed the store class from TiddlyWiki to WikiStore

Much less confusing.
This commit is contained in:
Jeremy Ruston 2011-12-06 18:29:53 +00:00
parent 391b1be3dc
commit dd9537cd88
5 changed files with 16 additions and 17 deletions

View File

@ -5,13 +5,13 @@
/*global require: false, exports: false */
"use strict";
var TiddlyWiki = require("./js/TiddlyWiki.js").TiddlyWiki,
var WikiStore = require("./js/WikiStore.js").WikiStore,
Recipe = require("./js/Recipe.js").Recipe,
util = require("util");
var filename = process.argv[2];
var store = new TiddlyWiki();
var store = new WikiStore();
var theRecipe = new Recipe(store,filename,function() {
process.stdout.write(theRecipe.cook());

View File

@ -53,7 +53,6 @@ var Tiddler = require("./Tiddler.js").Tiddler,
tiddlerInput = require("./TiddlerInput.js"),
tiddlerOutput = require("./TiddlerOutput.js"),
utils = require("./Utils.js"),
TiddlyWiki = require("./TiddlyWiki.js").TiddlyWiki,
retrieveFile = require("./FileRetriever.js").retrieveFile,
fs = require("fs"),
path = require("path"),

View File

@ -4,16 +4,16 @@
var Tiddler = require("./Tiddler.js").Tiddler,
util = require("util");
var TiddlyWiki = function TiddlyWiki(shadowStore) {
var WikiStore = function WikiStore(shadowStore) {
this.tiddlers = {};
this.shadows = shadowStore === undefined ? new TiddlyWiki(null) : shadowStore;
this.shadows = shadowStore === undefined ? new WikiStore(null) : shadowStore;
};
TiddlyWiki.prototype.clear = function() {
WikiStore.prototype.clear = function() {
this.tiddlers = {};
};
TiddlyWiki.prototype.getTiddler = function(title) {
WikiStore.prototype.getTiddler = function(title) {
var t = this.tiddlers[title];
if(t instanceof Tiddler) {
return t;
@ -24,24 +24,24 @@ TiddlyWiki.prototype.getTiddler = function(title) {
}
};
TiddlyWiki.prototype.getTiddlerText = function(title) {
WikiStore.prototype.getTiddlerText = function(title) {
var t = this.getTiddler(title);
return t instanceof Tiddler ? t.fields.text : null;
};
TiddlyWiki.prototype.deleteTiddler = function(title) {
WikiStore.prototype.deleteTiddler = function(title) {
delete this.tiddlers[title];
};
TiddlyWiki.prototype.tiddlerExists = function(title) {
WikiStore.prototype.tiddlerExists = function(title) {
return this.tiddlers[title] instanceof Tiddler;
};
TiddlyWiki.prototype.addTiddler = function(tiddler) {
WikiStore.prototype.addTiddler = function(tiddler) {
this.tiddlers[tiddler.fields.title] = tiddler;
};
TiddlyWiki.prototype.forEachTiddler = function(callback) {
WikiStore.prototype.forEachTiddler = function(callback) {
var t;
for(t in this.tiddlers) {
var tiddler = this.tiddlers[t];
@ -50,4 +50,4 @@ TiddlyWiki.prototype.forEachTiddler = function(callback) {
}
};
exports.TiddlyWiki = TiddlyWiki;
exports.WikiStore = WikiStore;

View File

@ -4,7 +4,7 @@
"use strict";
var TiddlyWiki = require("./js/TiddlyWiki.js").TiddlyWiki,
var WikiStore = require("./js/WikiStore.js").WikiStore,
Recipe = require("./js/Recipe.js").Recipe,
http = require("http"),
fs = require("fs"),
@ -16,7 +16,7 @@ var filename = process.argv[2];
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/html"});
var store = new TiddlyWiki(),
var store = new WikiStore(),
theRecipe = new Recipe(store,filename,function() {
response.end(theRecipe.cook(), "utf-8");
});

View File

@ -4,14 +4,14 @@ Wikifier test rig
var Tiddler = require("./js/Tiddler.js").Tiddler,
TiddlyWiki = require("./js/TiddlyWiki.js").TiddlyWiki,
WikiStore = require("./js/WikiStore.js").WikiStore,
utils = require("./js/Utils.js"),
util = require("util");
var wikiTest = function(spec) {
//console.error(util.inspect(spec,false,99));
var t,
store = new TiddlyWiki(),
store = new WikiStore(),
w;
for(t=0; t<spec.tiddlers.length; t++) {
var tid = new Tiddler(spec.tiddlers[t]);