Rename `tiddlerTitle` variable to `currentTiddler`

This commit is contained in:
Jeremy Ruston 2013-10-28 23:40:45 +00:00
parent 0a9ad8efaf
commit bf48e6f8a1
23 changed files with 25 additions and 25 deletions

View File

@ -44,7 +44,7 @@ Command.prototype.execute = function() {
parseTreeNode = parser ? {type: "widget", children: [{
type: "setvariable",
attributes: {
name: {type: "string", value: "tiddlerTitle"},
name: {type: "string", value: "currentTiddler"},
value: {type: "string", value: title}
},
children: parser.tree

View File

@ -24,7 +24,7 @@ exports.params = [];
Run the macro
*/
exports.run = function() {
return this.wiki.getChangeCount(this.getVariable("tiddlerTitle")) + "";
return this.wiki.getChangeCount(this.getVariable("currentTiddler")) + "";
};
})();

View File

@ -87,7 +87,7 @@ ButtonWidget.prototype.isPoppedUp = function() {
};
ButtonWidget.prototype.dispatchMessage = function(event) {
this.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable("tiddlerTitle")});
this.dispatchEvent({type: this.message, param: this.param, tiddlerTitle: this.getVariable("currentTiddler")});
};
ButtonWidget.prototype.triggerPopup = function(event) {

View File

@ -79,7 +79,7 @@ Compute the internal state of the widget
*/
CheckboxWidget.prototype.execute = function() {
// Get the parameters from the attributes
this.checkboxTitle = this.getAttribute("title",this.getVariable("tiddlerTitle"));
this.checkboxTitle = this.getAttribute("title",this.getVariable("currentTiddler"));
this.checkboxTag = this.getAttribute("tag");
this.checkboxClass = this.getAttribute("class");
// Make the child widgets

View File

@ -43,7 +43,7 @@ CountWidget.prototype.execute = function() {
this.filter = this.getAttribute("filter");
// Execute the filter
if(this.filter) {
this.currentCount = this.wiki.filterTiddlers(this.filter,this.getVariable("tiddlerTitle")).length;
this.currentCount = this.wiki.filterTiddlers(this.filter,this.getVariable("currentTiddler")).length;
} else {
this.currentCount = undefined;
}

View File

@ -84,7 +84,7 @@ Compute the internal state of the widget
*/
EditBitmapWidget.prototype.execute = function() {
// Get our parameters
this.editTitle = this.getAttribute("title",this.getVariable("tiddlerTitle"));
this.editTitle = this.getAttribute("title",this.getVariable("currentTiddler"));
this.editClass = this.getAttribute("class");
};

View File

@ -106,7 +106,7 @@ Compute the internal state of the widget
*/
EditTextWidget.prototype.execute = function() {
// Get our parameters
this.editTitle = this.getAttribute("title",this.getVariable("tiddlerTitle"));
this.editTitle = this.getAttribute("title",this.getVariable("currentTiddler"));
this.editField = this.getAttribute("field","text");
this.editIndex = this.getAttribute("index");
this.editDefault = this.getAttribute("default","");

View File

@ -49,7 +49,7 @@ Compute the internal state of the widget
*/
EditWidget.prototype.execute = function() {
// Get our parameters
this.editTitle = this.getAttribute("title",this.getVariable("tiddlerTitle"));
this.editTitle = this.getAttribute("title",this.getVariable("currentTiddler"));
this.editField = this.getAttribute("field","text");
this.editIndex = this.getAttribute("index");
this.editClass = this.getAttribute("class");

View File

@ -44,7 +44,7 @@ Compute the internal state of the widget
*/
FieldManglerWidget.prototype.execute = function() {
// Get our parameters
this.mangleTitle = this.getAttribute("title",this.getVariable("tiddlerTitle"));
this.mangleTitle = this.getAttribute("title",this.getVariable("currentTiddler"));
// Construct the child widgets
this.makeChildWidgets();
};

View File

@ -40,7 +40,7 @@ Compute the internal state of the widget
*/
FieldsWidget.prototype.execute = function() {
// Get parameters from our attributes
this.tiddlerTitle = this.getAttribute("tiddler",this.getVariable("tiddlerTitle"));
this.tiddlerTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
this.template = this.getAttribute("template");
this.exclude = this.getAttribute("exclude");
this.stripTitlePrefix = this.getAttribute("stripTitlePrefix","no") === "yes";

View File

@ -148,7 +148,7 @@ Compute the internal state of the widget
*/
LinkWidget.prototype.execute = function() {
// Get the target tiddler title
this.to = this.getAttribute("to",this.getVariable("tiddlerTitle"));
this.to = this.getAttribute("to",this.getVariable("currentTiddler"));
// Determine the link characteristics
this.isMissing = !this.wiki.tiddlerExists(this.to);
this.isShadow = this.wiki.isShadowTiddler(this.to);

View File

@ -67,7 +67,7 @@ Handle a tw-navigate event
*/
LinkCatcherWidget.prototype.handleNavigateEvent = function(event) {
if(this.catchTo) {
this.wiki.setTextReference(this.catchTo,event.navigateTo,this.getVariable("tiddlerTitle"));
this.wiki.setTextReference(this.catchTo,event.navigateTo,this.getVariable("currentTiddler"));
}
if(this.catchMessage) {
this.dispatchEvent({

View File

@ -63,7 +63,7 @@ ListWidget.prototype.execute = function() {
ListWidget.prototype.getTiddlerList = function() {
var defaultFilter = "[!is[system]sort[title]]";
return this.wiki.filterTiddlers(this.getAttribute("filter",defaultFilter),this.getVariable("tiddlerTitle"));
return this.wiki.filterTiddlers(this.getAttribute("filter",defaultFilter),this.getVariable("currentTiddler"));
};
ListWidget.prototype.getEmptyMessage = function() {

View File

@ -103,7 +103,7 @@ Read the state tiddler
RevealWidget.prototype.readState = function() {
// Read the information from the state tiddler
if(this.stateTitle) {
var state = this.wiki.getTextReference(this.stateTitle,this["default"],this.getVariable("tiddlerTitle"));
var state = this.wiki.getTextReference(this.stateTitle,this["default"],this.getVariable("currentTiddler"));
switch(this.type) {
case "popup":
this.readPopupState(state);

View File

@ -38,7 +38,7 @@ Compute the internal state of the widget
*/
SetVariableWidget.prototype.execute = function() {
// Get our parameters
this.setName = this.getAttribute("name","tiddlerTitle");
this.setName = this.getAttribute("name","currentTiddler");
this.setValue = this.getAttribute("value");
// Set context variable
this.setVariable(this.setName,this.setValue,this.parseTreeNode.params);

View File

@ -43,7 +43,7 @@ TiddlerWidget.prototype.execute = function() {
// Get our parameters
this.tiddlerTitle = this.getAttribute("title","");
// Set context variables
this.setVariable("tiddlerTitle",this.tiddlerTitle);
this.setVariable("currentTiddler",this.tiddlerTitle);
this.setVariable("missingTiddlerClass",(this.wiki.tiddlerExists(this.tiddlerTitle) || this.wiki.isShadowTiddler(this.tiddlerTitle)) ? "tw-tiddler-exists" : "tw-tiddler-missing");
this.setVariable("shadowTiddlerClass",this.wiki.isShadowTiddler(this.tiddlerTitle) ? "tw-tiddler-shadow" : "");
this.setVariable("systemTiddlerClass",this.wiki.isSystemTiddler(this.tiddlerTitle) ? "tw-tiddler-system" : "");

View File

@ -38,7 +38,7 @@ Compute the internal state of the widget
*/
TranscludeWidget.prototype.execute = function() {
// Get our parameters
this.transcludeTitle = this.getAttribute("title",this.getVariable("tiddlerTitle"));
this.transcludeTitle = this.getAttribute("title",this.getVariable("currentTiddler"));
this.transcludeField = this.getAttribute("field");
this.transcludeIndex = this.getAttribute("index");
// Check for recursion
@ -66,7 +66,7 @@ Compose a string comprising the title, field and/or index to identify this trans
TranscludeWidget.prototype.makeRecursionMarker = function() {
var output = [];
output.push("{");
output.push(this.getVariable("tiddlerTitle",{defaultValue: ""}));
output.push(this.getVariable("currentTiddler",{defaultValue: ""}));
output.push("|");
output.push(this.transcludeTitle || "");
output.push("|");

View File

@ -40,7 +40,7 @@ Compute the internal state of the widget
*/
ViewWidget.prototype.execute = function() {
// Get parameters from our attributes
this.viewTitle = this.getAttribute("title",this.getVariable("tiddlerTitle"));
this.viewTitle = this.getAttribute("title",this.getVariable("currentTiddler"));
this.viewField = this.getAttribute("field","text");
this.viewIndex = this.getAttribute("index");
this.viewFormat = this.getAttribute("format","text");

View File

@ -22,7 +22,7 @@ Options include:
parentWidget: optional reference to a parent renderer node for the context chain
document: optional document object to use instead of global document
Context variables include:
tiddlerTitle: title of the tiddler providing the context
currentTiddler: title of the tiddler providing the context
*/
var Widget = function(parseTreeNode,options) {
if(arguments.length > 0) {
@ -215,7 +215,7 @@ Widget.prototype.computeAttributes = function() {
value;
$tw.utils.each(this.parseTreeNode.attributes,function(attribute,name) {
if(attribute.type === "indirect") {
value = self.wiki.getTextReference(attribute.textReference,"",self.getVariable("tiddlerTitle"));
value = self.wiki.getTextReference(attribute.textReference,"",self.getVariable("currentTiddler"));
} else if(attribute.type === "macro") {
var text = self.getVariable(attribute.value.name,{params: attribute.value.params});
value = self.wiki.new_renderText("text/plain","text/vnd.tiddlywiki",text);

View File

@ -1,6 +1,6 @@
title: $:/core/ui/FieldEditor
<$fieldmangler><$setvariable name="targetTiddler" value=<<tiddlerTitle>>><div class="tw-edit-fields">
<$fieldmangler><$setvariable name="targetTiddler" value=<<currentTiddler>>><div class="tw-edit-fields">
<table class="tw-edit-fields"><tbody><$list filter="[is[current]fields[]] -title -tags -text -creator -created -modified -modifier -[[draft.title]] -[[draft.of]]"><tr class="tw-edit-field"><td class="tw-edit-field-name"><<listItem>>:</td><td class="tw-edit-field-value"><$edit-text title=<<targetTiddler>> field=<<listItem>> placeholder="field value"/></td><td class="tw-edit-field-remove"><$button message="tw-remove-field" param=<<listItem>> class="btn-invisible">{{$:/core/images/delete-button}}</$button></td>
</tr>
</$list>

View File

@ -6,7 +6,7 @@ title: $:/snippets/modules
<$list filter="[moduletypes[]]">
!! <<listItem>>
<$macrocall $name="describeModuleType" type=<<listItem>>/>
<ul><$list filter="[is[current]modules[]]"><li><$link><<tiddlerTitle>></$link>
<ul><$list filter="[is[current]modules[]]"><li><$link><<currentTiddler>></$link>
</li>
</$list>
</ul>

View File

@ -239,7 +239,7 @@ describe("Widget module", function() {
{title: "TiddlerFour", text: "TiddlerTwo"}
]);
// Construct the widget node
var text = "My <$setvariable name='tiddlerTitle' value={{TiddlerFour}}><$transclude title={{!!title}}/></$setvariable> is Jolly"
var text = "My <$setvariable name='currentTiddler' value={{TiddlerFour}}><$transclude title={{!!title}}/></$setvariable> is Jolly"
var widgetNode = createWidgetNode(parseText(text,wiki),wiki);
// Render the widget node to the DOM
var wrapper = renderWidgetNode(widgetNode);

View File

@ -6,7 +6,7 @@ The `link` widget generates links to tiddlers.
! Content and Attributes
|!Attribute |!Description |
|to |The title of the target tiddler for the link |
|to |The title of the target tiddler for the link (defaults to the currentTiddler variable if not specified) |
The content of the link widget is rendered within the `<a>` tag.