Could we extend the get and has operators to allow reference to the shadow tiddler?

As discussed below;

I think an operator parameter that allows get: shadow[fieldname] or has:shadow[fieldname] would make access to shadow tiddler fields much easier and testable.

  • They would be easier to use in match/patch or to offer reset the default value etc…

I don’t think that will work because a given tiddler can be present as a shadow tiddler in multiple plugins.

We do have [[xxx]shadowsource[]] which can give a list of possible plugins.

So with a more specific info about the source for get eg: get:shadow:source[title] it may be possible retrieve the info.

Every wiki has a GettingStarted tiddler, which could be overwritten by plugins. The problem is, that the last pluign that contains it will win.

I sometimes thought, it would be nice if the core GettingStarted would have a possibility to list all GettingStarted tiddlers from all plugins.

So for me the request does make sense, thinking in that direction.

1 Like

It would help if the named shadow source were a variable or value of a field.

It would be possible to have a syntax like this:

getshadow[title],[source] or getshadow[title],<source> ...

getshadow:field-name[title],[source]

IMO that’s worth some experimenting. @jeremyruston what do you think?

I think it maybe almost as easy to use the JSON operators directly:

<$text text={{{ [{$:/core}jsonget[tiddlers],[$:/core/copyright.txt],[text]] }}}/>

One could also make a user defined function:


\function .shadow-source(source,title)
[<source>get[text]jsonget[tiddlers],<title>,[text]]
\end

<$text text={{{ [.shadow-source[$:/core],[$:/core/copyright.txt]] }}}/>

That’s nice. We would need to document that and we may be good to go.

Assistance would be much appreciated with that.

I would add a field parameter as well (defaulting to text), to solve some of the issues raised elsewhere recently.

Just trying to keep this active;

Although the below is more complex to write than the OT it would at least fill the gap.

\function .shadow-source(source, title, field:"text")
[<source>get[text]jsonget[tiddlers],<title>,<field>]
\end

<$text text={{{ [.shadow-source[$:/core],[$:/core/copyright.txt],[fieldnameifnottext]] }}}/>