Substituted attribute values SAV are a relatively new thing. At least when providing a value to an attribute, be it a macro, widget or even html/css its is in my view becoming the method of choice to concatenate or form strings from other values. In part because we have deprecated the \define macro definitions but they can be applied right where you need them in your code without an unnecessary additional macro/procedure, and they are evaluated before the final render, so can be used in logic.
As the documentation says;
-
$(varname)$Text substitution of a variable. Undefined variables are replaced with an empty string. -
${ filter expression }$Text substitution with the first result of evaluating the filter expression.
Given the option to use a filter expression we can use a filter to also get fieldnames and tiddler content
Proposal
However I was wondering if this is a kind of custom method could the “Substituted attribute values” mechanism be extended to include transclusions “more directly” such as {{!!fieldname}} {{tiddlername}} etc…?
- However what if we want to use these as literals eg
{{!!fieldname}}? so lets consider${{ reference }}$or some other annotation to transclusions, so as to be “evaluated” within SAV - perhaps this is an opportunity to allow other references to wiki content directly, that we are likely to substitute? Cant think of any more ATM
- I would also suggest any features of SAV still permit the construction of filters from parts without partial evaluation. The resulting filter can then be passed as an attribute to a filter parameter as one example.
- See this discussion Filter, meta actions, Discussion
- Evaluation of filters will continue within the
${ filter }$form, and variables within$(varname)$.
A Simple example
<span class=`${{!!class}}$`> Something with class applied </span>
End Note:
Will the $(varname)$ permit the use of Multi-value variables MVV’s in SAV both directly in $(listvarname)$ and within ${ filter expression }$ for multiple values?, not just the first item.
FYI: If you arrive here through search, keep in mind you can set variables to a field or tiddler transclusion then make us of that with $(varname)$ or within a filter with $(listvarname)$ eg [all[current]get[fieldname]]
