From 0d354fe57f7424c1751a5c0cf5fbf1203803f3c8 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Fri, 16 Mar 2018 20:35:41 +0000 Subject: [PATCH] SetWidget: Add "subtiddler" attribute --- core/modules/widgets/setvariable.js | 8 +++++++- editions/tw5.com/tiddlers/widgets/SetWidget.tid | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/modules/widgets/setvariable.js b/core/modules/widgets/setvariable.js index dda00af89..a72337cf3 100755 --- a/core/modules/widgets/setvariable.js +++ b/core/modules/widgets/setvariable.js @@ -42,6 +42,7 @@ SetWidget.prototype.execute = function() { this.setFilter = this.getAttribute("filter"); this.setSelect = this.getAttribute("select"); this.setTiddler = this.getAttribute("tiddler"); + this.setSubTiddler = this.getAttribute("subtiddler"); this.setField = this.getAttribute("field"); this.setIndex = this.getAttribute("index"); this.setValue = this.getAttribute("value"); @@ -58,7 +59,12 @@ Get the value to be assigned SetWidget.prototype.getValue = function() { var value = this.setValue; if(this.setTiddler) { - var tiddler = this.wiki.getTiddler(this.setTiddler); + var tiddler; + if(this.setSubTiddler) { + tiddler = this.wiki.getSubTiddler(this.setTiddler,this.setSubTiddler); + } else { + tiddler = this.wiki.getTiddler(this.setTiddler); + } if(!tiddler) { value = this.setEmptyValue; } else if(this.setField) { diff --git a/editions/tw5.com/tiddlers/widgets/SetWidget.tid b/editions/tw5.com/tiddlers/widgets/SetWidget.tid index 214aab9cc..cc5f29167 100644 --- a/editions/tw5.com/tiddlers/widgets/SetWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/SetWidget.tid @@ -1,6 +1,6 @@ caption: set created: 20131115182700000 -modified: 20170712153850528 +modified: 20180315165405442 tags: Widgets title: SetWidget type: text/vnd.tiddlywiki @@ -17,6 +17,7 @@ The content of the `<$set>` widget is the scope for the value assigned to the va |name |The name of the variable to assign (defaults to "currentTiddler") | |value |The value to assign to the variable if the filter is missing or not empty | |tiddler |<<.from-version "5.1.15">> Optional title of the tiddler from which to read the value | +|subtiddler |<<.from-version "5.1.16">> Optionally specifies the title of a subtiddler within a plugin tiddler identified by the ''tiddler'' attribute | |field |<<.from-version "5.1.15">> Optional field of the tiddler from which to read the value (only used if ''tiddler'' is used) | |index |<<.from-version "5.1.15">> Optional index of the tiddler from which to read the value (only used if ''tiddler'' is used) | |filter |An optional filter to be evaluated and assigned to the variable (see below) |