....and the wikify widget is finally, for the first time, clear to me.
Thanks!
On Tuesday, August 18, 2020 at 7:47:32 PM UTC-4 TW Tones wrote:
> Werner,
>
> I am confident Eric is spot on. It was the correct understanding of this
> issue and the use of wikify that stopped me getting stuck regularly. I have
> being trying to get some activity on this because it is a barrier to new
> users. Perhaps this quick note will help as a rule until you fully
> understand it.
>
> - If you need a value to be "evaluated" from wikitext to use within
> subsequent Wikitext logic use the wikify widget at the last possible
> moment.
> - This guide suggests trying to use wikify in external macros is a
> path to disappointment
> - Make sure you close the wikify appropriately (as with all other
> widgets) or unusual and broken result will occur
> - Its only at the final render of the tiddler that all things are
> wikified automatically so a standalone `<<varormacro>>` appears to produce
> the result you want, but as Eric said the result inside the wikitext
> (before evaluation) without wikification it is not evaluated at that point.
> - It is fine to use the same name when wikifying to stop code
> complexity
>
> \define macroname() blah blah
> <$wikify name=macroname text="<<macroname>>">
> use <<macroname>> here where it is the wikified version, or pre-
> evaluated
> </$wikify>
>
> In closing
>
> - If some of our community developers see this what would be better is
> something like the following;
> - Allow any variable to be referenced in its "evaluated state" eg
> ((macroname)) would effectively wikify inline
> - Automatically wikify/evaluate variables or macros when used in
> filters and other appropriate places.
>
> Regards
> Tones
>
>
> On Wednesday, August 19, 2020 at 7:15:51 AM UTC+10, Eric Shulman wrote:
>>
>> On Tuesday, August 18, 2020 at 10:06:59 AM UTC-7, Werner wrote:
>>>
>>> I am referring to a tiddler called activeDossier whose contents refers
>>> to a JSON data tiddler. Tiddler content
>>> is {{$:/data/CI/companyRegister##1/name}}.
>>>
>>> <$set name="theCompany" value={{$:/data/CI/activeDossier}}>
>>> !<$vars tv-wikilinks=no><<theCompany>></$vars> <!-- gets displayed
>>> properly -->
>>> <$list filter="[!is[system]search<theCompany>]" >
>>> <<currentTiddler>>
>>> </$list>
>>> </$set>
>>>
>>
>> The problem is that you are doing a "double transclusion". That is, the
>> value of <<theCompany>> retrieved via transclusion isn't the actual name of
>> the company as text, but rather a secondary transclusion from a JSON
>> tiddler (i.e., {{$:/data/CI/companyRegister##1/name}}). When you render
>> <<theCompany>>, TiddlyWiki automatically parses that transclusion and
>> displays the actual value. However, when you use search<theCompany> in the
>> filter, the value isn't parsed any further, and you are literally searching
>> for the transclusion syntax, not the actual company name as text.
>>
>> To resolve this, use <$wikify> instead of <$set> to fetch theCompany
>> value, like this:
>> <$wikify name="theCompany" text={{$:/data/CI/activeDossier}}>
>> !<$vars tv-wikilinks=no><<theCompany>></$vars> <!-- gets displayed
>> properly -->
>> <$list filter="[!is[system]search<theCompany>]" >
>> <<currentTiddler>>
>> </$list>
>> </$wikify>
>> The $wikify gets the value from the activeDossier tiddler AND then also
>> parses that value, so the result is the desired text value from the
>> underlying $:/data/CI/companyRegister tiddler.
>>
>> When you use it in the search<theCompany> filter, it's already fully
>> resolved to be the actual company name as text, so the search should work
>> as you intend.
>>
>> -e
>>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/4ed0fa0f-ff59-4eef-9529-56be0292f6c1n%40googlegroups.com.