How can a regular stylesheet tiddler access currentTiddler and other contextual/dynamic variables (as opposed to e.g <<colour>>
which is not contextual but global)?
I create quite a lot of stuff that rely on embedded styleblocks, for example;
<$list filter="red green blue">
<style>[data-tags*="<<currentTiddler>>"] {background:<<currentTiddler>>}</style>
</$list>
…however, embedding styles is brittle and adviced against, as Jeremy kindly and elaborately explains here.
The question has two sides (…I think): How can contextual variables be accessed by…
- Separate stylesheets
- Separate styleblocks
For (2), separate styleblocks, I guess the containing tiddlers title etc is accessible, which is at least something. But then even styleblocks are generally adviced against (for reasons I never quite understood but here is one issue caused by it).
A little reflection; When this question is phrased as “how can stylesheets access variables” one is perhaps led to only consider the stylesheets doing the action (presumably transcluding or calling the variable). But maybe the code using the style could instead send the variable to the stylesheet?
Thank you!