Qualifying the last message because I spoke a bit too quickly and don't
want to be blithe:
TiddlyWiki doesn't do nested string expressions, macros notwithstanding,
and Jeremy has suggested that the current design forces too much dependence
on macros. That's a motivator for my work on the formula plugin.
On Saturday, 30 December 2017 16:48:47 UTC-6, Evan Balster wrote:
>
> Honestly, stuff like that is why I'm making the formula widget.
> TiddlyWiki doesn't do nested expressions, formula does. The only missing
> piece is a transclude function accepting a string (or a family of these...).
>
> On Saturday, 30 December 2017 16:46:54 UTC-6, coda coder wrote:
>>
>>
>>
>> On Saturday, December 30, 2017 at 4:28:12 PM UTC-6, Evan Balster wrote:
>>>
>>> Oh, wait, sorry, shoot. That won't work at all, it'll just expand to
>>> the string of the transclusion.
>>>
>>
>> Right. And why I said (wished) $if accepting a TextReference (like state
>> does for $reveal). I'm hinting that if a preparse returned you something
>> with !! then you could support them (and then the wikification would work -
>> right?)
>>
>> But it's probably a step too far (plus you'd have the only widget that
>> supported both on the entire planet) ;) Too confusing is my guess.
>>
>>
>>
>>> Yeah, you're going to have to set another variable, or use <$tiddler> or
>>> something.
>>>
>>> On Saturday, 30 December 2017 16:27:12 UTC-6, Evan Balster wrote:
>>>>
>>>> OK, so this is a classic case of "TiddlyWiki macro expansion is
>>>> confusing as heck". You can't put a <<macro>> (or variable) inside a
>>>> {{transclusion}}, either in WikiText or in attributes. You *can*
>>>> expand specific variables inside macros, but it uses a dollar sign syntax.
>>>>
>>>> In your case, just move the curly braces to be inside the macro (or
>>>> another new macro).
>>>>
>>>> <$if not value=<<get-note-state>> match="show">
>>>>
>>>> \define get-note-state()
>>>> {{$:/temp/state/$(currentTiddler)$-$(_notetype)$-$(unique)$}}
>>>>
>>>> On Saturday, 30 December 2017 15:44:14 UTC-6, coda coder wrote:
>>>>>
>>>>> Edited for typos:
>>>>>
>>>>> Thanks Evan... I did wonder about that, too. So, do you think this
>>>>> should work? (I'm trying to keep to a minimum the alien code you need to
>>>>> digest :)
>>>>>
>>>>> Original:
>>>>> <$reveal type="nomatch" state=<<get-authornote-state>> text="show">
>>>>>
>>>>> $if:
>>>>> <$if not value={{<<get-note-state>>}} match="show">
>>>>>
>>>>> \define get-note-state()
>>>>> $:/temp/state/$(currentTiddler)$-$(_notetype)$-$(unique)$
>>>>>
>>>>> LOL... I think I *am* going to need another var :)
>>>>>
>>>>>
>>>>> On Saturday, December 30, 2017 at 3:32:05 PM UTC-6, Evan Balster wrote:
>>>>>>
>>>>>> Hey, Coda —
>>>>>>
>>>>>> The substitution in your example there *should* work fine, so I
>>>>>> suspect the trouble lies elsewhere. For example, this works:
>>>>>>
>>>>>> \define testSearchBar(field)
>>>>>> <$if value={{$:/temp/search!!$field$}} match="yes">
>>>>>> Search is "yes"
>>>>>> </$if>
>>>>>> \end
>>>>>>
>>>>>> <<testSearchBar text>>
>>>>>>
>>>>>> Remember that a macro can't define *only* the opening tag of a
>>>>>> widget; it needs to define the content and closing tag as well...
>>>>>>
>>>>>> On Saturday, 30 December 2017 15:24:20 UTC-6, coda coder wrote:
>>>>>>>
>>>>>>> Hi Evan...
>>>>>>>
>>>>>>> On Friday, December 29, 2017 at 11:54:54 PM UTC-6, Evan Balster
>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> As compared with the closely-related *$reveal* widget, conditions
>>>>>>>> are simpler, behave more like *$list*, and can be executed as a
>>>>>>>> chain. They don't retain contents or animate, and can be based on
>>>>>>>> variables, filtered or transcluded attributes rather than just state
>>>>>>>> tiddlers.
>>>>>>>>
>>>>>>>>
>>>>>>> I'm no expert but, I think there's a reason that Jeremy chose to use
>>>>>>> a TextReference for use by the state attribute of the $reveal widget.
>>>>>>> When
>>>>>>> I just tried to switch one out for the $if widget, I hit a snag:
>>>>>>>
>>>>>>> <$reveal type="match" state="someTiddler!!$switch$" text="yes">
>>>>>>>
>>>>>>> Note that the field part of the reference is supplied as a parameter
>>>>>>> to the outer macro wherein this line occurs. I don't see a way to
>>>>>>> directly
>>>>>>> replace the above using the $if widget -- the following of course does
>>>>>>> not
>>>>>>> work:
>>>>>>>
>>>>>>> <$if value={{$:/.rgt/bk/author-data!!$switch$}} match="yes">
>>>>>>>
>>>>>>> Do you think it possible to make TextReferences work with $if?
>>>>>>> Otherwise, the neater and much more readable $if widget would need a
>>>>>>> needless variable ($wikify?) to prepare the transclusion value for its
>>>>>>> use
>>>>>>> by $if (I think). Right?
>>>>>>>
>>>>>>> Hope that made sense...
>>>>>>>
>>>>>>> Coda
>>>>>>>
>>>>>>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/aa673c52-76e3-491e-a44c-7cd17be28ba2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.