On Sunday, September 13, 2020 at 5:12:06 PM UTC-7, Bob Jansen wrote:
>
> Eric & Tones,
> I do not know how to close the wikify tags as Tones has recommended. I 
> have two tags as there are two variables I need.
>
> Code:
> <$wikify name="theuniqueid" text={{$:/TLS/uniqueid}}>
> <$wikify name="theartworkurl" text={{$:/TLS/artworkurl}}>
> ...
>
If I add </wikify></wikify> as the last line of the code then the display 
> of the tiddler changes to
>
Add New artwork </wikify></wikify>
>

You've left out the "$" in the close widget!  Thus:
</$wikify></$wikify> 
 

> If I leave out the </wikify> then the display looks as it should and the 
> code does work.
>

This is a convenient side-effect of reaching the end of the tiddler 
definition.  Any unclosed widgets are *automatically* assumed to end when 
there's no more tiddler content.
Thus, for this specific use-case, leaving off the </$wikify></$wikify> 
"looks as it should and the code does work".

Note that the "unclosed widget" handling also applies to the end of macro 
definitions even when they are not the end of the tiddler definition.  
Thus, if I write:

\define someMacro()
<$vars v1="..." >
<$vars v2="..." >
<$vars v3="..." >
... rest of macro here ...
\end
...more tiddler content here...

I can simply omit the close </$vars></$vars></$vars> and everything is 
still happy.  Strictly speaking, this is not "proper" syntax, since every 
widget it meant have a matching "close widget" or at use the 'shortform' 
where the widget itself ends with "/>" (as in <$action-setfield .... />).  
Nonetheless, it can be VERY convenient.  For example, in 
http://tiddlytools.com/timer.html#TiddlyTools%2FTimer%2FClocks, 
the clock_adjustForTimezone() macro starts with **34** lines of <$vars> and 
<$set> widgets that do a series of complex calculations and assignments 
followed by just two lines containing <$list>...</$list> widgets.  It would 
be ridiculously inconvenient to then have to include another 34 lines of 
matching </$set> and </$vars> at the end of the macro definition.

Note: This "omit the matching close <$widget>" technique only works when 
the opening widgets are in the outermost level of the macro syntax.  For 
example, if I have some code like this:
\define someMacro()
<$vars v1="...">
<$reveal ...>
   <$vars v2="..."
   ... something here ...
   </$vars>
</$reveal>
... some more stuff here ...
\end

I *must* use the </$vars> *inside* the <$reveal>...</$reveal> to match the 
opening <$vars v2="...">, since it isn't at the end of the entire macro.  
However, I *can* still omit the </$vars> that would match the *first* 
<$vars v1="...">, since that *is* at the end of the macro.  In general, I 
recommend using proper "close widget" syntax most of the time, except for 
some of the specific instances I've just described.  This avoids any 
headaches that can occur if you happen to add just one extra line of code 
at the end of a macro, only to find that all your previously unclosed 
widgets now need to be properly matched.

I hope this all makes sense to you and doesn't confuse things even more!

-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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/327cd7e7-e38c-41f1-86d9-181cc81bee0eo%40googlegroups.com.

Reply via email to