From bf48e6f8a11bc0c1c646625bdb9ebba2d20cb3e4 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 28 Oct 2013 23:40:45 +0000 Subject: [PATCH] Rename `tiddlerTitle` variable to `currentTiddler` --- core/modules/commands/new_rendertiddlers.js | 2 +- core/modules/macros/changecount.js | 2 +- core/modules/new_widgets/button.js | 2 +- core/modules/new_widgets/checkbox.js | 2 +- core/modules/new_widgets/count.js | 2 +- core/modules/new_widgets/edit-bitmap.js | 2 +- core/modules/new_widgets/edit-text.js | 2 +- core/modules/new_widgets/edit.js | 2 +- core/modules/new_widgets/fieldmangler.js | 2 +- core/modules/new_widgets/fields.js | 2 +- core/modules/new_widgets/link.js | 2 +- core/modules/new_widgets/linkcatcher.js | 2 +- core/modules/new_widgets/list.js | 2 +- core/modules/new_widgets/reveal.js | 2 +- core/modules/new_widgets/setvariable.js | 2 +- core/modules/new_widgets/tiddler.js | 2 +- core/modules/new_widgets/transclude.js | 4 ++-- core/modules/new_widgets/view.js | 2 +- core/modules/new_widgets/widget.js | 4 ++-- core/ui/FieldEditor.tid | 2 +- core/wiki/modules.tid | 2 +- editions/test/tiddlers/tests/test-widget.js | 2 +- editions/tw5.com/tiddlers/widgets/LinkWidget.tid | 2 +- 23 files changed, 25 insertions(+), 25 deletions(-) diff --git a/core/modules/commands/new_rendertiddlers.js b/core/modules/commands/new_rendertiddlers.js index be513b0bb..291b3840b 100644 --- a/core/modules/commands/new_rendertiddlers.js +++ b/core/modules/commands/new_rendertiddlers.js @@ -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 diff --git a/core/modules/macros/changecount.js b/core/modules/macros/changecount.js index 08d8a799e..2d0f62e5a 100644 --- a/core/modules/macros/changecount.js +++ b/core/modules/macros/changecount.js @@ -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")) + ""; }; })(); diff --git a/core/modules/new_widgets/button.js b/core/modules/new_widgets/button.js index 77224cb7c..47dfe1422 100644 --- a/core/modules/new_widgets/button.js +++ b/core/modules/new_widgets/button.js @@ -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) { diff --git a/core/modules/new_widgets/checkbox.js b/core/modules/new_widgets/checkbox.js index d4f562daf..32c05bc62 100644 --- a/core/modules/new_widgets/checkbox.js +++ b/core/modules/new_widgets/checkbox.js @@ -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 diff --git a/core/modules/new_widgets/count.js b/core/modules/new_widgets/count.js index 3385a3d9e..8780b8d59 100644 --- a/core/modules/new_widgets/count.js +++ b/core/modules/new_widgets/count.js @@ -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; } diff --git a/core/modules/new_widgets/edit-bitmap.js b/core/modules/new_widgets/edit-bitmap.js index caa7c971b..cf42f2b68 100644 --- a/core/modules/new_widgets/edit-bitmap.js +++ b/core/modules/new_widgets/edit-bitmap.js @@ -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"); }; diff --git a/core/modules/new_widgets/edit-text.js b/core/modules/new_widgets/edit-text.js index bc7af6a2b..939ae4e36 100644 --- a/core/modules/new_widgets/edit-text.js +++ b/core/modules/new_widgets/edit-text.js @@ -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",""); diff --git a/core/modules/new_widgets/edit.js b/core/modules/new_widgets/edit.js index e649341f0..b8855824e 100644 --- a/core/modules/new_widgets/edit.js +++ b/core/modules/new_widgets/edit.js @@ -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"); diff --git a/core/modules/new_widgets/fieldmangler.js b/core/modules/new_widgets/fieldmangler.js index 040404bf5..06d696d7c 100644 --- a/core/modules/new_widgets/fieldmangler.js +++ b/core/modules/new_widgets/fieldmangler.js @@ -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(); }; diff --git a/core/modules/new_widgets/fields.js b/core/modules/new_widgets/fields.js index e4bd21a3d..362520a74 100755 --- a/core/modules/new_widgets/fields.js +++ b/core/modules/new_widgets/fields.js @@ -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"; diff --git a/core/modules/new_widgets/link.js b/core/modules/new_widgets/link.js index d17f7adca..f0b10b3a7 100755 --- a/core/modules/new_widgets/link.js +++ b/core/modules/new_widgets/link.js @@ -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); diff --git a/core/modules/new_widgets/linkcatcher.js b/core/modules/new_widgets/linkcatcher.js index f5afb1767..74ff417fe 100644 --- a/core/modules/new_widgets/linkcatcher.js +++ b/core/modules/new_widgets/linkcatcher.js @@ -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({ diff --git a/core/modules/new_widgets/list.js b/core/modules/new_widgets/list.js index 58d9ae6fc..42d2651ea 100755 --- a/core/modules/new_widgets/list.js +++ b/core/modules/new_widgets/list.js @@ -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() { diff --git a/core/modules/new_widgets/reveal.js b/core/modules/new_widgets/reveal.js index f4a4f00c4..ed9b082d2 100755 --- a/core/modules/new_widgets/reveal.js +++ b/core/modules/new_widgets/reveal.js @@ -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); diff --git a/core/modules/new_widgets/setvariable.js b/core/modules/new_widgets/setvariable.js index 3be58e54d..921383812 100755 --- a/core/modules/new_widgets/setvariable.js +++ b/core/modules/new_widgets/setvariable.js @@ -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); diff --git a/core/modules/new_widgets/tiddler.js b/core/modules/new_widgets/tiddler.js index c61eaeca4..01a806f02 100755 --- a/core/modules/new_widgets/tiddler.js +++ b/core/modules/new_widgets/tiddler.js @@ -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" : ""); diff --git a/core/modules/new_widgets/transclude.js b/core/modules/new_widgets/transclude.js index 572dcc539..cdd8b9cd0 100755 --- a/core/modules/new_widgets/transclude.js +++ b/core/modules/new_widgets/transclude.js @@ -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("|"); diff --git a/core/modules/new_widgets/view.js b/core/modules/new_widgets/view.js index 3e6b489cb..da17492bb 100755 --- a/core/modules/new_widgets/view.js +++ b/core/modules/new_widgets/view.js @@ -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"); diff --git a/core/modules/new_widgets/widget.js b/core/modules/new_widgets/widget.js index bd1159ec6..53fcfb199 100755 --- a/core/modules/new_widgets/widget.js +++ b/core/modules/new_widgets/widget.js @@ -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); diff --git a/core/ui/FieldEditor.tid b/core/ui/FieldEditor.tid index 4e448e2c8..64a0381dd 100644 --- a/core/ui/FieldEditor.tid +++ b/core/ui/FieldEditor.tid @@ -1,6 +1,6 @@ title: $:/core/ui/FieldEditor -<$fieldmangler><$setvariable name="targetTiddler" value=<>>
+<$fieldmangler><$setvariable name="targetTiddler" value=<>>
<$list filter="[is[current]fields[]] -title -tags -text -creator -created -modified -modifier -[[draft.title]] -[[draft.of]]"> diff --git a/core/wiki/modules.tid b/core/wiki/modules.tid index 1f6bc69de..135a2cfbb 100644 --- a/core/wiki/modules.tid +++ b/core/wiki/modules.tid @@ -6,7 +6,7 @@ title: $:/snippets/modules <$list filter="[moduletypes[]]"> !! <> <$macrocall $name="describeModuleType" type=<>/> -
    <$list filter="[is[current]modules[]]">
  • <$link><> +
      <$list filter="[is[current]modules[]]">
    • <$link><>
    diff --git a/editions/test/tiddlers/tests/test-widget.js b/editions/test/tiddlers/tests/test-widget.js index 7e010c880..890fb369c 100755 --- a/editions/test/tiddlers/tests/test-widget.js +++ b/editions/test/tiddlers/tests/test-widget.js @@ -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}}/> is Jolly" + var text = "My <$setvariable name='currentTiddler' value={{TiddlerFour}}><$transclude title={{!!title}}/> is Jolly" var widgetNode = createWidgetNode(parseText(text,wiki),wiki); // Render the widget node to the DOM var wrapper = renderWidgetNode(widgetNode); diff --git a/editions/tw5.com/tiddlers/widgets/LinkWidget.tid b/editions/tw5.com/tiddlers/widgets/LinkWidget.tid index 9f167e493..4ce62d082 100644 --- a/editions/tw5.com/tiddlers/widgets/LinkWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/LinkWidget.tid @@ -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 `` tag.
<>:<$edit-text title=<> field=<> placeholder="field value"/><$button message="tw-remove-field" param=<> class="btn-invisible">{{$:/core/images/delete-button}}