diff --git a/core/modules/new_widgets/macrodef.js b/core/modules/new_widgets/macrodef.js deleted file mode 100644 index a386fe4ab..000000000 --- a/core/modules/new_widgets/macrodef.js +++ /dev/null @@ -1,55 +0,0 @@ -/*\ -title: $:/core/modules/new_widgets/macrodef.js -type: application/javascript -module-type: new_widget - -Macro definition widget - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -var Widget = require("$:/core/modules/new_widgets/widget.js").widget; - -var MacroDefWidget = function(parseTreeNode,options) { - this.initialise(parseTreeNode,options); -}; - -/* -Inherit from the base widget class -*/ -MacroDefWidget.prototype = new Widget(); - -/* -Render this widget into the DOM -*/ -MacroDefWidget.prototype.render = function(parent,nextSibling) { - this.parentDomNode = parent; - this.computeAttributes(); - this.execute(); - this.renderChildren(parent,nextSibling); -}; - -/* -Compute the internal state of the widget -*/ -MacroDefWidget.prototype.execute = function() { - // Set macro definition - this.setVariable(this.parseTreeNode.name,this.parseTreeNode.text,this.parseTreeNode.params); - // Construct the child widgets - this.makeChildWidgets(); -}; - -/* -Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering -*/ -MacroDefWidget.prototype.refresh = function(changedTiddlers) { - return this.refreshChildren(changedTiddlers); -}; - -exports.macrodef = MacroDefWidget; - -})(); diff --git a/core/modules/new_widgets/setvariable.js b/core/modules/new_widgets/setvariable.js index 2fa0cb5d9..3be58e54d 100755 --- a/core/modules/new_widgets/setvariable.js +++ b/core/modules/new_widgets/setvariable.js @@ -41,7 +41,7 @@ SetVariableWidget.prototype.execute = function() { this.setName = this.getAttribute("name","tiddlerTitle"); this.setValue = this.getAttribute("value"); // Set context variable - this.setVariable(this.setName,this.setValue); + this.setVariable(this.setName,this.setValue,this.parseTreeNode.params); // Construct the child widgets this.makeChildWidgets(); }; diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 479cfbf12..d87eff86e 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -641,6 +641,11 @@ var tweakParseTreeNodes = function(nodeList) { var tweakMacroDefinition = function(nodeList) { if(nodeList && nodeList[0] && nodeList[0].type === "macrodef") { + nodeList[0].type = "setvariable"; + nodeList[0].attributes = { + name: {type: "string", value: nodeList[0].name}, + value: {type: "string", value: nodeList[0].text} + }; nodeList[0].children = nodeList.slice(1); nodeList.splice(1,nodeList.length-1); tweakMacroDefinition(nodeList.children);