Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG?] - missing closing tag for vars widget in core macros #7697

Closed
twMat opened this issue Aug 24, 2023 · 6 comments
Closed

[BUG?] - missing closing tag for vars widget in core macros #7697

twMat opened this issue Aug 24, 2023 · 6 comments

Comments

@twMat
Copy link
Contributor

twMat commented Aug 24, 2023

Describe the bug

Bug or nothing?

https://tiddlywiki.com/#%24%3A%2Fcore%2Fmacros%2Ftag

...the tag-pill-inner macro starts off with a <$vars> widget but there is no closing </$vars> tag.

(Please do close this if it is nothing.)

@ericshulman
Copy link
Member

By default, any widgets that are "unclosed" when the end of a macro (or end of a tiddler) is encountered are implicitly "closed". While this might seem like a bug, omitting closing tags can actually be very handy.

For example, suppose we have a macro definition that starts with a $list widget followed by a few $set, $vars and $let widgets that create some internal "working variables" for use within the macro. Rather than having to match each with a corresponding /$let, /$vars, /$set and /$list (in reverse order, since the widgets are effectively nested!), we can just end the macro.

@twMat
Copy link
Contributor Author

twMat commented Aug 25, 2023

Ah, thanks @ericshulman - I knew this about end of tiddlers but not also for macros... which does seem odd considering how macros are just text substitution and they can be called from anywhere in the tiddler. It also seems inconsistent that the very macro in that very tiddler which I refer to, very explicitly includes the end tag for an inner nested widget (the </$element-tag$>).

Anyway, thanks. Closing.

@twMat twMat closed this as completed Aug 25, 2023
@pmario
Copy link
Member

pmario commented Aug 25, 2023

I think this is an oversight. While Eric is right, we usually do close all widgets in the core as an example for best practice. Users often do copy paste our code into their own creations and missing end-markers can lead to problems.

@Jermolene -- What do you think. Should we fix this?

@twMat
Copy link
Contributor Author

twMat commented Aug 25, 2023

Should we fix this?

If we do, may I propose that while we're at it, exchange $vars for $let - and that we do this generally from now on when modifying core tids? I assume that specifically the $let widget cannot be easily "search-replaced". Again, for setting an example of what is best practice.
Thoughts on this?

@pmario
Copy link
Member

pmario commented Aug 25, 2023

Thoughts on this?

I'm not sure if there is a "grand strategy" for modernizing TW atm.

I know, there is a commitment from @Jermolene that we want to update major aspects of the TW core code. Wikitext and Javascript -- but there is no timeline

For new wikitext tiddlers Jeremy lately demanded the new syntax -- but for existing code its much more complex, because many UI elements are kind of "interconnected". IMO they should be done at once.

So even if you start small, those PRs tend to "run out of scale" very fast. Eg: PR #7657 -- The first PR created in March this year changed 81 docs only tiddlers and it was not merged yet. :(

@Jermolene
Copy link
Member

Thank you @twMat that is indeed a bug. It is now fixed in fa9bfa0; I took up your suggestion of turning the vars widget into a let widget

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants