diff --git a/core/modules/commander.js b/core/modules/commander.js index 24d6ff6d5..1a58fbace 100644 --- a/core/modules/commander.js +++ b/core/modules/commander.js @@ -146,7 +146,14 @@ Commander.prototype.stringifyToken = function(index,callback) { promptText: token.prompt || "Please enter a value", defaultResult: token["default"] || "", callback: function(err,userText) { - callback(err,userText); + if(err) { + callback(err); + } else { + if(token.transformFilter) { + userText = self.wiki.filterTiddlers(token.transformFilter,null,self.wiki.makeTiddlerIterator([userText]))[0] || ""; + } + callback(null,userText); + } }, input: self.streams.input, output: self.streams.output, diff --git a/editions/tw5.com/tiddlers/nodejs/tiddlywiki.info_Files.tid b/editions/tw5.com/tiddlers/nodejs/tiddlywiki.info_Files.tid index 1438e6880..48d5ec4f8 100644 --- a/editions/tw5.com/tiddlers/nodejs/tiddlywiki.info_Files.tid +++ b/editions/tw5.com/tiddlers/nodejs/tiddlywiki.info_Files.tid @@ -30,7 +30,7 @@ Command tokens can be a simple string or <<.from-version "5.3.6">> a command tok * ''filter'': the value of the first result of a filter expression specified in the ''text'' property of the command token object * ''wikify'': the result of wikifying a text string specified in the ''text'' property of the command token object -* ''prompt'': the result of prompting the user for a string. The ''prompt'' property of the command token object specifies the textual prompt to be used. The optional ''default'' property specifies a string value to be used if the user presses enter in response to the prompt +* ''prompt'': the result of prompting the user for a string. The ''prompt'' property of the command token object specifies the textual prompt to be used. The optional ''default'' property specifies a string value to be used if the user presses enter in response to the prompt. The optional ''transformFilter'' property specifies a filter to be applied to the user input to transform it into a command token. The string input by the user is available in the variable `user-input` The EchoCommand is useful for debugging complex dynamic command tokens. diff --git a/editions/tw5.com/tiddlywiki.info b/editions/tw5.com/tiddlywiki.info index 14ee18e1e..f9507b76a 100644 --- a/editions/tw5.com/tiddlywiki.info +++ b/editions/tw5.com/tiddlywiki.info @@ -39,7 +39,8 @@ { "type": "prompt", "prompt": "Please enter some text and type enter", - "default": "Nothing" + "default": "Nothing", + "transformFilter": "[addprefix[testing ]]" } ], "index": [