Folks,

I hope the brains trust can help me with this, if not its an important 
lesson for us all because it is a quirk in TiddlyWiki that is quite 
annoying.

If you are aware of the problem and find it annoying please chime in so we 
can see how much of a problem this may be.

I have a macro, which I will not show here, needless to say it returns one 
of three values. off, yes and no.
If I use the macro in any tiddler it works
'<<design-mode>>'

This showed me it had both a leading/trailing space so I modified my macro 
to include the whitespace trim

\define design-mode()
\whitespace trim
...
Macro code
...
\end

Now as soon as we try and use this in a filter, a simple example as follows;
<$list filter="[<design-mode>match[yes]]">
     Design mode details
</$list> 

<$text text=<<design-mode>>/>
This fails to ever display "Design mode details", because as the text 
widget shows, the macro contains the definition, not the result. Its only 
rendered at the end.

Now a known work around is to use the wikify widget, who's default 
output=text
<$wikify name=design text="""<<design-mode>>""">
   <$list filter="[<design>match[yes]]">
        Design mode details
   </$list>
</$wikify>
This is so messy in the middle of a large macro or tiddler

   - Experience has told me use the wikify at the last possible moment or 
   you may nt get what you ask for, if something has changed elswhere in the 
   wikitext.

When I use it in a viewTemplate I may want  to display in half a dozen 
places something according to the value in design-mode

   - My code becomes messy and complex and easy to break
   - We are forced to close the wikify widget as well, so we are always 
   having to set its scope. When we just want to respond to a value.
   - Moving the wikify widget into the macro to hide it from where the 
   macro is used will not work

*Question?*

   - Does anyone have an alternate code pattern that allows us to hide this 
   unfriendly requirement?

*Opinion?*

   - It has taken me years to understand the problem fully and develop this 
   workaround, occasionally I forget and get fragile non-working wiki text as 
   a result.
   - The wikify widget is overlikk for this. With all its other functions 
   and purposes why must we revert to it for a simple desire to compare values?
   - This must be fixed to stop people abandoning tiddlywiki or resulting 
   in many questions in the forum.
   - This is an unnecessary limitation on writing wiki text.

*Speculation*

   - Surely we could find a way either a pragma in the macro definition, 
   - or an alternate way to reference a macro/variable that is is treated 
   as a wikified text result?
   - If not how we do this, ideally simply, however we must find a way to 
   fix this as its a thorn in out side.
   - If white space trim can operate on the result of the macro definition, 
   could we not also have a pragma to return only a wikified text result (on 
   the fly)

*Suggestions*

   - pragma such as `\whitespace trim text` or `\wikify' placed in a macro 
   definition, that forces wikification/evaluate and returns only text
   - an alternate way in filters to reference a variable or macro output eg 
   (macroname) that returns only a text result, pre-wikified.
   - Extending the list widget such we can list variables to be wikified as 
   text before use in the list widget or its filter.
   - Extending the variable substitution format to work in filters in the 
   main wikitext, not just in macros eg [[$(macroname)$]match[yes]] where the 
   result is substituted as text.
   - If a better method were not available a new widget such as "evaluate" 
   that was a cut down version of wikify that accepts a macro/variable name 
   and wikifies it as text (with the same name) could simplify the code and 
   the ability to understand. 
   
   
Please feel my pain and help us improve this.

Regards
Tones

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0ef7863f-aee5-4c48-b066-021d5893b832o%40googlegroups.com.

Reply via email to