mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2025-12-15 15:10:30 -08:00
Fixed substitute attributes to allow more variables (#9059)
This commit is contained in:
parent
48b45f0e35
commit
f1b33c02f7
2 changed files with 4 additions and 4 deletions
|
|
@ -1173,7 +1173,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(/\$\(([^\)\$]+)\)\$/g, function(match,varname) {
|
||||
return output.replace(/\$\((.+?)\)\$/g, function(match,varname) {
|
||||
return widget.getVariable(varname,{defaultValue: ""})
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ title: Output
|
|||
|
||||
\whitespace trim
|
||||
<$set name="var with spaces" value="spaces">
|
||||
<$let project="TiddlyWiki" disabled="true" var-with-dashes="dashes">
|
||||
<$let project="TiddlyWiki" disabled="true" $tiddler="Getting Started" var-with-dashes="dashes">
|
||||
<div class=`$(project)$
|
||||
${ [[Hello]addsuffix[There]] }$` attrib=`myvalue` otherattrib=`$(1)$` blankattrib=`` quoted="here" disabled=```$(disabled)$``` dashes=`$(var-with-dashes)$` spaces=`$(var with spaces)$`>
|
||||
${ [[Hello]addsuffix[There]] }$` attrib=`myvalue` otherattrib=`$(1)$` blankattrib=`` quoted="here" disabled=```$(disabled)$``` dollar=`p-$($tiddler)$-s` dashes=`$(var-with-dashes)$` spaces=`$(var with spaces)$`>
|
||||
</div>
|
||||
</$let>
|
||||
</$set>
|
||||
|
|
@ -18,4 +18,4 @@ ${ [[Hello]addsuffix[There]] }$` attrib=`myvalue` otherattrib=`$(1)$` blankattri
|
|||
title: ExpectedResult
|
||||
|
||||
<p><div attrib="myvalue" blankattrib="" class="TiddlyWiki
|
||||
HelloThere" dashes="dashes" disabled="true" otherattrib="" quoted="here" spaces="spaces"></div></p>
|
||||
HelloThere" dashes="dashes" disabled="true" dollar="p-Getting Started-s" otherattrib="" quoted="here" spaces="spaces"></div></p>
|
||||
Loading…
Add table
Add a link
Reference in a new issue