mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-12-10 02:38:06 +00:00
Rename "shadow" tiddlers to "system" tiddlers
What we have at the moment isn't really the same as TiddlyWiki classic's shadow tiddlers, it's a much simpler system for excluding tiddlers. We'll use the term "shadow" instead to refer to the way that tiddlers in plugins behave, which is exactly like TiddlyWiki classic's shadow tiddlers.
This commit is contained in:
@@ -61,9 +61,9 @@ Command.prototype.subcommands.tiddlers = function() {
|
||||
return null; // No error
|
||||
};
|
||||
|
||||
Command.prototype.subcommands.shadows = function() {
|
||||
var tiddlers = this.commander.wiki.getShadowTitles();
|
||||
this.output.write("Wiki contains these shadow tiddlers:\n");
|
||||
Command.prototype.subcommands.system = function() {
|
||||
var tiddlers = this.commander.wiki.getSystemTitles();
|
||||
this.output.write("Wiki contains these system tiddlers:\n");
|
||||
for(var t=0; t<tiddlers.length; t++) {
|
||||
this.output.write(tiddlers[t] + "\n");
|
||||
}
|
||||
|
||||
@@ -105,8 +105,8 @@ exports.operators = {
|
||||
return "$tw.utils.pushTop(subResults,currTiddlerTitle);";
|
||||
}
|
||||
break;
|
||||
case "shadow":
|
||||
return "for(title in source) {if(" + op + "this.getTiddler(title).isShadow()) {$tw.utils.pushTop(subResults,title);}}";
|
||||
case "system":
|
||||
return "for(title in source) {if(" + op + "this.getTiddler(title).isSystem()) {$tw.utils.pushTop(subResults,title);}}";
|
||||
default:
|
||||
throw "Unknown operand for 'is' filter operator";
|
||||
}
|
||||
@@ -121,8 +121,8 @@ exports.operators = {
|
||||
return "r = subResults.indexOf(currTiddlerTitle);\nif(r !== -1) {subResults = [currTiddlerTitle];} else {subResults = [];}";
|
||||
}
|
||||
break;
|
||||
case "shadow":
|
||||
return "for(r=subResults.length-1; r>=0; r--) {if(" + op + "this.getTiddler(subResults[r]).isShadow()) {subResults.splice(r,1);}}";
|
||||
case "system":
|
||||
return "for(r=subResults.length-1; r>=0; r--) {if(" + op + "this.getTiddler(subResults[r]).isSystem()) {subResults.splice(r,1);}}";
|
||||
default:
|
||||
throw "Unknown operand for 'is' filter operator";
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ exports.hasTag = function(tag) {
|
||||
return this.fields.tags && this.fields.tags.indexOf(tag) !== -1;
|
||||
};
|
||||
|
||||
exports.isShadow = function() {
|
||||
if(!$tw.utils.hop(this,"shadowFlag")) {
|
||||
this.shadowFlag = this.fields.title.indexOf("$:/") === 0;
|
||||
exports.isSystem = function() {
|
||||
if(!$tw.utils.hop(this,"systemFlag")) {
|
||||
this.systemFlag = this.fields.title.indexOf("$:/") === 0;
|
||||
}
|
||||
return this.shadowFlag;
|
||||
return this.systemFlag;
|
||||
};
|
||||
|
||||
exports.isTemporary = function() {
|
||||
|
||||
@@ -28,11 +28,11 @@ var ListWidget = function(renderer) {
|
||||
These types are shorthands for particular filters
|
||||
*/
|
||||
var typeMappings = {
|
||||
all: "[!is[shadow]sort[title]]",
|
||||
recent: "[!is[shadow]sort[modified]]",
|
||||
all: "[!is[system]sort[title]]",
|
||||
recent: "[!is[system]sort[modified]]",
|
||||
missing: "[is[missing]sort[title]]",
|
||||
orphans: "[is[orphan]sort[title]]",
|
||||
shadows: "[is[shadow]sort[title]]"
|
||||
system: "[is[system]sort[title]]"
|
||||
};
|
||||
|
||||
ListWidget.prototype.generate = function() {
|
||||
@@ -70,7 +70,7 @@ ListWidget.prototype.getTiddlerList = function() {
|
||||
filter = this.renderer.getAttribute("filter");
|
||||
}
|
||||
if(!filter) {
|
||||
filter = "[!is[shadow]]";
|
||||
filter = "[!is[system]]";
|
||||
}
|
||||
this.list = this.renderer.renderTree.wiki.filterTiddlers(filter,this.renderer.getContextTiddlerTitle());
|
||||
};
|
||||
|
||||
@@ -171,13 +171,13 @@ exports.addTiddler = function(tiddler) {
|
||||
};
|
||||
|
||||
/*
|
||||
Return a sorted array of non-shadow tiddler titles, optionally filtered by a tag
|
||||
Return a sorted array of non-system tiddler titles, optionally filtered by a tag
|
||||
*/
|
||||
exports.getTiddlers = function(sortField,excludeTag) {
|
||||
sortField = sortField || "title";
|
||||
var tiddlers = [], t, titles = [];
|
||||
for(t in this.tiddlers) {
|
||||
if($tw.utils.hop(this.tiddlers,t) && !this.tiddlers[t].isShadow() && (!excludeTag || !this.tiddlers[t].hasTag(excludeTag))) {
|
||||
if($tw.utils.hop(this.tiddlers,t) && !this.tiddlers[t].isSystem() && (!excludeTag || !this.tiddlers[t].hasTag(excludeTag))) {
|
||||
tiddlers.push(this.tiddlers[t]);
|
||||
}
|
||||
}
|
||||
@@ -257,10 +257,10 @@ exports.getOrphanTitles = function() {
|
||||
return []; // Todo
|
||||
};
|
||||
|
||||
exports.getShadowTitles = function() {
|
||||
exports.getSystemTitles = function() {
|
||||
var titles = [];
|
||||
for(var title in this.tiddlers) {
|
||||
if(this.tiddlers[title].isShadow()) {
|
||||
if(this.tiddlers[title].isSystem()) {
|
||||
titles.push(title);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user