Hi Tony, after some testing I may have a first idea, but there are two things:
- Calls: Javascript macros are called when the tiddler is parsed. So you would need something that rerenders the tiddler - for instance the list widget you mentioned upon changes in the filter result - to call the macro multiple times without closing and reopening the tiddler. As an example if you change your variable in one tiddler and in another already open tiddler get the variable's value it won't be updated until the tiddler is reloaded. I currently don't have an idea for that. - Permanent Save: Due to javascript macros not being able to directly write to a field by themselves currently the variables only last as long as the wiki is not closed or reloaded. For this I might have a solution, but will need to play around a little more with it, before being able to say if it actually works or not. Regards, Felicia On Thursday, 30 July 2020 at 02:43:12 UTC+2 TW Tones wrote: > Felicia, > > Since you a quite able to build Javascript solutions into Tiddlywiki now, > I would like to ask a quick question, if it makes sense to you. > > Would you know how to define a global variable(s) that we can update > (repeatedly) via a macro call? As a result it will need to have a step to > initialise it. > > Imagine that inside a list widget someone could conditionally change the > variable, ie add 1 to a number or set a flag = yes, such that the value can > be accessed outside of the list widget? > > This is a missing mechanism as far as I can see. > > Regared > TW Tones > > > > > On Friday, July 24, 2020 at 8:34:52 PM UTC+10, Felicia Crow wrote: >> >> Hi, >> so after playing around with filter operators and trying to find a way >> over a data tiddler I wrote a javascript macro I attatched below. >> The only caveat with this is that you have to close and reopen the >> tiddler calling the macro due to how javascript macros are called. Maybe >> someone has an idea for how to reload a single tiddler. >> >> For now the macro - called simply with <<missing-tiddlers>> - renders as >> a list of all missing tiddlers sorted by how often they are referenced: >> >> [image: missingTiddlersList.png] >> It can be changed to render as a table by changing this line of code in >> the macro: >> return renderList(tiddlerData); >> >> To this: >> return renderTable(tiddlerData); >> >> Which then looks like this: >> >> [image: missingTiddlersTable.png] >> >> Please be aware that after importing the macro/changing it you have to >> reload your wiki for it to take effect. >> >> Also as an aside unlike Tony's solution this uses the backlink filter >> operator so it only counts hard links and excludes system tiddlers >> completely. A little more about what hard and soft links are here >> <https://tiddlywiki.com/#Hard%20and%20Soft%20Links>. >> The reason I did this is mostly to ensure that these are actual >> references and not just the tiddler title being in the text even if it >> isn't meant as an actual reference. >> Should you want to use Tony's solution with search instead of backlinks >> it is easy change the filter either by yourself or I can update the macro. >> >> Regards, >> Felicia >> >> On Thursday, 23 July 2020 23:05:56 UTC+2, Beckstrom wrote: >>> >>> Is there a way to generate a list of missing tiddlers sorted by the >>> number of times they have been referenced? >>> >>> Right now I have a hundred or so "missing tiddlers," and I'd guess most >>> of them are only referenced from other tiddlers once or twice - but there >>> are probably a handful that are referenced many times. I like to >>> periodically clean up and add things to my wiki, and knowing which tiddlers >>> are most needed would be cool. >>> >>> thanks in advance! >>> >> -- 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/33646c5d-3677-4f50-839b-531006785b91n%40googlegroups.com.

