diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 93e818f21..3eae3902d 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -1086,7 +1086,7 @@ exports.getSubstitutedText = function(text,widget,options) { output = $tw.utils.replaceString(output,new RegExp("\\$" + $tw.utils.escapeRegExp(substitute.name) + "\\$","mg"),substitute.value); }); // Substitute any variable references with their values - return output.replace(/\$\((\w+)\)\$/g, function(match,varname) { + return output.replace(/\$\(([^\)\$]+)\)\$/g, function(match,varname) { return widget.getVariable(varname,{defaultValue: ""}) }); }; diff --git a/editions/test/tiddlers/tests/data/widgets/SubstitutedAttributes.tid b/editions/test/tiddlers/tests/data/widgets/SubstitutedAttributes.tid index 408d202c6..9d5538573 100644 --- a/editions/test/tiddlers/tests/data/widgets/SubstitutedAttributes.tid +++ b/editions/test/tiddlers/tests/data/widgets/SubstitutedAttributes.tid @@ -6,14 +6,16 @@ tags: [[$:/tags/wiki-test-spec]] title: Output \whitespace trim -<$let project="TiddlyWiki" disabled="true"> +<$set name="var with spaces" value="spaces"> +<$let project="TiddlyWiki" disabled="true" var-with-dashes="dashes">
+${ [[Hello]addsuffix[There]] }$` attrib=`myvalue` otherattrib=`$(1)$` blankattrib=`` quoted="here" disabled=```$(disabled)$``` dashes=`$(var-with-dashes)$` spaces=`$(var with spaces)$`>
+ + title: ExpectedResult

\ No newline at end of file +HelloThere" dashes="dashes" disabled="true" otherattrib="" quoted="here" spaces="spaces">

\ No newline at end of file