diff --git a/core/modules/widgets/value.js b/core/modules/widgets/fill.js similarity index 77% rename from core/modules/widgets/value.js rename to core/modules/widgets/fill.js index 38fef1d29..c9a8a94de 100644 --- a/core/modules/widgets/value.js +++ b/core/modules/widgets/fill.js @@ -14,7 +14,7 @@ Sub-widget used by the transclude widget for specifying values for slots within var Widget = require("$:/core/modules/widgets/widget.js").widget; -var ValueWidget = function(parseTreeNode,options) { +var FillWidget = function(parseTreeNode,options) { // Initialise this.initialise(parseTreeNode,options); }; @@ -22,12 +22,12 @@ var ValueWidget = function(parseTreeNode,options) { /* Inherit from the base widget class */ -ValueWidget.prototype = Object.create(Widget.prototype); +FillWidget.prototype = Object.create(Widget.prototype); /* Render this widget into the DOM */ -ValueWidget.prototype.render = function(parent,nextSibling) { +FillWidget.prototype.render = function(parent,nextSibling) { // Call the constructor Widget.call(this); this.parentDomNode = parent; @@ -39,7 +39,7 @@ ValueWidget.prototype.render = function(parent,nextSibling) { /* Compute the internal state of the widget */ -ValueWidget.prototype.execute = function() { +FillWidget.prototype.execute = function() { // Construct the child widgets this.makeChildWidgets(); }; @@ -47,11 +47,11 @@ ValueWidget.prototype.execute = function() { /* Refresh the widget by ensuring our attributes are up to date */ -ValueWidget.prototype.refresh = function(changedTiddlers) { +FillWidget.prototype.refresh = function(changedTiddlers) { return this.refreshChildren(changedTiddlers); }; -exports.value = ValueWidget; +exports.fill = FillWidget; })(); \ No newline at end of file diff --git a/core/modules/widgets/slot.js b/core/modules/widgets/slot.js index 31df12a75..8ca6992d7 100644 --- a/core/modules/widgets/slot.js +++ b/core/modules/widgets/slot.js @@ -59,7 +59,7 @@ SlotWidget.prototype.execute = function() { var parseTreeNodes = [{type: "text", attributes: {text: {type: "string", value: "Missing slot reference!"}}}]; if(pointer instanceof TranscludeWidget) { // Get the parse tree nodes comprising the slot contents - parseTreeNodes = pointer.getTransclusionSlotValue(this.slotName,this.parseTreeNode.children); + parseTreeNodes = pointer.getTransclusionSlotFill(this.slotName,this.parseTreeNode.children); } // Construct the child widgets this.makeChildWidgets(parseTreeNodes); diff --git a/core/modules/widgets/transclude.js b/core/modules/widgets/transclude.js index 7fcc39fac..38970efb9 100755 --- a/core/modules/widgets/transclude.js +++ b/core/modules/widgets/transclude.js @@ -40,7 +40,7 @@ TranscludeWidget.prototype.execute = function() { // Get our attributes, string parameters, and slot values into properties of the widget object this.collectAttributes(); this.collectStringParameters(); - this.collectSlotValueParameters(); + this.collectSlotFillParameters(); // Get the parse tree nodes that we are transcluding var target = this.getTransclusionTarget(), parseTreeNodes = target.parseTreeNodes; @@ -129,30 +129,30 @@ TranscludeWidget.prototype.collectStringParameters = function() { /* Collect slot value parameters */ -TranscludeWidget.prototype.collectSlotValueParameters = function() { +TranscludeWidget.prototype.collectSlotFillParameters = function() { var self = this; - this.slotValueParseTrees = Object.create(null); + this.slotFillParseTrees = Object.create(null); if(this.legacyMode) { - this.slotValueParseTrees["ts-missing"] = this.parseTreeNode.children; + this.slotFillParseTrees["ts-missing"] = this.parseTreeNode.children; } else { - this.slotValueParseTrees["ts-raw"] = this.parseTreeNode.children; - var noValueWidgetsFound = true, + this.slotFillParseTrees["ts-raw"] = this.parseTreeNode.children; + var noFillWidgetsFound = true, searchParseTreeNodes = function(nodes) { $tw.utils.each(nodes,function(node) { - if(node.type === "value") { + if(node.type === "fill") { if(node.attributes["$name"] && node.attributes["$name"].type === "string") { var slotValueName = node.attributes["$name"].value; - self.slotValueParseTrees[slotValueName] = node.children; + self.slotFillParseTrees[slotValueName] = node.children; } - noValueWidgetsFound = false; + noFillWidgetsFound = false; } else { searchParseTreeNodes(node.children); } }); }; searchParseTreeNodes(this.parseTreeNode.children); - if(noValueWidgetsFound) { - this.slotValueParseTrees["ts-missing"] = this.parseTreeNode.children; + if(noFillWidgetsFound) { + this.slotFillParseTrees["ts-missing"] = this.parseTreeNode.children; } } }; @@ -242,7 +242,7 @@ TranscludeWidget.prototype.getTransclusionTarget = function() { // If there's no parse tree then return the missing slot value return { parser: null, - parseTreeNodes: (this.slotValueParseTrees["ts-missing"] || []), + parseTreeNodes: (this.slotFillParseTrees["ts-missing"] || []), parseAsInline: parseAsInline, text: null, type: null @@ -312,9 +312,9 @@ TranscludeWidget.prototype.getTransclusionMetaVariables = function() { /* Fetch the value of a slot */ -TranscludeWidget.prototype.getTransclusionSlotValue = function(name,defaultParseTreeNodes) { - if(name && this.slotValueParseTrees[name]) { - return this.slotValueParseTrees[name]; +TranscludeWidget.prototype.getTransclusionSlotFill = function(name,defaultParseTreeNodes) { + if(name && this.slotFillParseTrees[name]) { + return this.slotFillParseTrees[name]; } else { return defaultParseTreeNodes || []; } diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index cf32e71c4..bc6c4b3fe 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -443,7 +443,7 @@ Widget.prototype.makeChildWidget = function(parseTreeNode,options) { type: "transclude", children: [ { - type: "value", + type: "fill", children: parseTreeNode.children } ], diff --git a/core/ui/Components/VisibleTransclude.tid b/core/ui/Components/VisibleTransclude.tid index 8063b2a77..f654c0520 100644 --- a/core/ui/Components/VisibleTransclude.tid +++ b/core/ui/Components/VisibleTransclude.tid @@ -5,7 +5,7 @@ Import this component to make all the child transclusions visible. Block transclusions are shown in red, and inline transclusions are shown in green. --> -\procedure <$transclude>(tiddler,$tiddler,mode,$mode) +\widget $transclude(tiddler,$tiddler,mode,$mode) <$let mode={{{ [[$mode]is[variable]then<$mode>!is[blank]] :else[[mode]is[variable]then!is[blank]] :else[match[yes]then[inline]else[block]] }}} @@ -35,7 +35,7 @@ Block transclusions are shown in red, and inline transclusions are shown in gree """> <$genesis $type="transclude" $remappable="no" $names="[<@params>jsonindexes[]]" $values="[<@params>jsonindexes[]] :map[<@params>jsonget]" $$recursionMarker="no" $$mode=<>> - + <$slot $name="ts-raw" $depth="2"/> diff --git a/editions/test/tiddlers/tests/data/transclude/MissingTarget.tid b/editions/test/tiddlers/tests/data/transclude/MissingTarget.tid index 5fa2d12c7..8bdc86eaa 100644 --- a/editions/test/tiddlers/tests/data/transclude/MissingTarget.tid +++ b/editions/test/tiddlers/tests/data/transclude/MissingTarget.tid @@ -13,12 +13,12 @@ title: Output <$transclude $tiddler='TiddlerOne' one='Ferret'> - <$value $name="ts-missing"> + <$fill $name="ts-missing"> <$parameters one='Ferret'> Badger <$text text=<>/> - + <$transclude $tiddler='MissingTiddler' one='Ferret'> <$parameters one='Ferret'> @@ -27,12 +27,12 @@ title: Output <$transclude $tiddler='MissingTiddler' one='Ferret'> - <$value $name="ts-missing"> + <$fill $name="ts-missing"> <$parameters one='Ferret'> Badger <$text text=<>/> - + + title: TiddlerOne diff --git a/editions/test/tiddlers/tests/data/transclude/Parameterised-Slotted.tid b/editions/test/tiddlers/tests/data/transclude/Parameterised-Slotted.tid index eeff9b33e..c795621ef 100644 --- a/editions/test/tiddlers/tests/data/transclude/Parameterised-Slotted.tid +++ b/editions/test/tiddlers/tests/data/transclude/Parameterised-Slotted.tid @@ -7,9 +7,9 @@ title: Output \whitespace trim <$transclude $tiddler='TiddlerOne' one='Ferret'> - <$value $name="content"> + <$fill $name="content"> Hippopotamus - + + title: TiddlerOne