Hi Charlie, yes that was what I meant. I always find it interesting to learn the thought process behind someones solution, since it often gives a different perspective on things that I would not have considered before, leads to learning something new or both. So when I saw a solution I would not have thought of myself I was curious how this came to be.
I sadly don't have any real tips for learning filters as it is one of the things my brain was actually willing to learn at least the basics quite quickly, but if you want I could write up the solution I had in mind so that you can play around with it, if this would be something that interests you/could help you. And to add something useful to the babbling at the top: A short excursion about the difference between non-javascript and javascript macros at least as far as I learned it - definitely not an expert. - Javascript macros are loaded in with everything else javascript before any processing happens as this is so to speak the engine on which everything runs, so yes a javascript macro is already loaded in when the startup actions are run. - Non-javascript macros one the other hand exist at first only within the tiddler they where defined in. So for example if you have a tiddler containing the definition for a macro called get-context you would only be able to use this macro in the same tiddler. This is where then the import pragma and tag $:/tags/Macro come in. Import is used as you have done to allow use of a specific macro in the tiddler it was imported to. The tag $:/tags/Macro on the other hand allows you to mark the macro as global so that you can use it where ever you want without having to specifically import it each time. This is were the exception you reference comes in. Since the startup actions run before the tagged macros are processed to make them globally available you need to import non-javascript macros even if they are properly tagged. Hope you can take away at least something from this and it wasn't too confusing. Happy Sunday for you as well. On Sunday, 13 September 2020 20:47:35 UTC+2, Charlie Veniot wrote: > > G'day Felicia, > > Hi Charlie, >> >> love the concept and very impressiv what you managed to put together, >> thank you for sharing. >> > > Thank-you! Of course, let's keep in mind that, in martial arts terms, I'm > not quite a TiddlyWiki yellow belt yet, so I'm sure there are many things > that could be improved ! > > >> >> If you don't mind asking, is there a specific reason for placing the >> decision for what to transclude in the two templates themselves and always >> calling both of them? >> Personally I would have put the decision in the root tiddler - e.g. >> TiddlyWiki Title - via a match filter and only called what was needed, so I >> wonder if there is something I am missing/not thinking about or if it is >> just another case of multiple ways to achieve the same result. >> > > I suspect that you are talking about this way of deciding what to show > based on context: {{TiddlyWiki Title 1||tPr}}{{TiddlyWiki Title 2||tOg}} > > I chose that way of doing things because I'm having a hard time wrapping > my mind around filters, but I think I've got transclusion templates down > pat. > > So I saw that mechanism as a quick (and non-cryptic) and easily repeatable > method across the board, for example: > > - the "content" tiddler (included in my "navigation" tiddler that > shows in the sidebar) has {{Contents (Product Reviews)||tPr}}{{Contents > (Urban Off Gridding)||tOg}} to show different navigation links depending > on > context > - I may want to show other tiddlers different ways depending on > context ... > > > >> Oh and one thing I noticed, just as an info: Since getstartupcontext is a >> javascript macro you don't actually need to import it. Unlike normal macros >> javascript macros are always global. >> > > Maybe I misunderstood something when I put that import there. I thought > that "StartupAction" tiddlers, because they are processed so early, didn't > have access to any macros unless they are imported. Does that just apply > to non-javascript macros ? > > >> >> Kind Regards, >> Felicia >> > > Cheers, best regards, and Happy Sunday ! > > -- 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/15e8d240-7c8d-44cf-83f9-341563982ffbo%40googlegroups.com.