Folks,
I am writing a macro and/or custom widget that allows the user to provide a text reference in the following forms tiddlername
, tiddlername!!fieldname
or !!fieldname
. See https://tiddlywiki.com/#TextReference
- I want this parameter to be converted to target-tiddler and target-field and when one or the other is not provided use a default eg
target-tiddler=<<currentTiddler>>
andtarget-field=text
This seems to me a valid way to reference resources in tiddlywiki for which we do not have any helper macros.
- My attempts have being failing
eg
\procedure update.reference(text-reference target-tiddler target-field)
\function delimiter() !!
<$parameters target-tiddler={{{ [<text-reference>split<delimiter>first[]] :else[<currentTiddler>] }}} field={{{ [<text-reference>split<delimiter>last[]] :else[<target-field>] }}}>
text-reference: <<text-reference>>, target-tiddler: <<target-tiddler>>, field: <<field>>.
</$parameters>
\end
# <<update. Reference "tiddlername!!fieldname">>
# <<update. Reference "!!fieldname">>
Background;
I am trying to create a procedure or custom widget that allows you to provide a text references or tiddlername and fieldname, that transudes the value, however allows you to click it or an icon next to it to edit it in-line and/or allows you to select from a list (generated by a filter).
Why a text reference and not separate parameters?;
- Using a text reference implies a fixed reference that you do not change, it is a reference to a specific location tiddler and/or fieldname to store a global value.
- But you could use target-tiddler and/or target-field if you generate them programmatically.