HC A Code Pattern is like one of those reciplies like sponge cake, it describes the underlying recipe which you can improvise on top of to create a strawberry sponge cake, a birthday cake like a clock, a fresh strawberry and cream sponge cake, a lemon passion fruit sponge cake. They are all fundamentally the same thing.
Code patterns are usually easy to reuse models that you can then customise, rather than a specific example for a specific purpose. They are all fundamentally the same thing. Much easier to remember a hundred code patterns than a thousand specific cases. FYI: As in my reply to Mohammad, I have built a button to toggle a field on any tiddler, to assist with my default toc above but now I am trying to generalize it so a new button can be created with little effort in future. Regards Tony On Wednesday, January 29, 2020 at 8:04:31 PM UTC+11, HC Haase wrote: > > I plan to soon add a filter option to my TOC generic plugin > <https://groups.google.com/forum/#!topic/TiddlyWiki/KZWhS-BtZCQ>. > > > onsdag den 29. januar 2020 kl. 00.34.35 UTC+1 skrev TonyM: >> >> Folks, >> >> I have another approach, test this on TiddlyWiki.com >> >> Create a tiddler containing this and tag with $:/tags/ViewTemplate >> \define default-toc-here() >> <h4>Optional TOC here</h4> >> <$list filter="[tag<currentTiddler>limit[1]]" emptyMessage="//nothing >> tagged with <<currentTiddler>>//" variable=nul > >> <$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> > >> </$list> >> \end >> <$list filter="[all[current]has:field[toc-here]]" variable=nul> >> <$list filter="[all[current]get[toc-here]]" variable=toc-tiddler >> emptyMessage=<<default-toc-here>> > >> <h4>Optional TOC <<toc-tiddler>></h4> >> <$macrocall $name="toc-selective-expandable" tag=<<toc- >> tiddler>> > >> </$list> >> </$list> >> >> >> - Nothing will happen right away. >> - Now add the field toc-here to any tiddler and it will provide a toc >> based on the current tiddler. Use new here to add items to its toc >> - If however you give that field a value of tiddlername eg HelloThere >> <https://tiddlywiki.com/#HelloThere> then the tiddlername will be >> used as the root of the TOC >> >> Advantages of this approach >> >> - No additional tag use >> - Ability to reference other parts of a TOC >> >> > This is a cool. I will see how to put that in the TOC generic plugin. > <https://groups.google.com/forum/#!topic/TiddlyWiki/KZWhS-BtZCQ> > <https://groups.google.com/forum/#!topic/TiddlyWiki/KZWhS-BtZCQ> > >> >> I can see some useful enhancements, but do consider my approach as a >> "Code Pattern" >> > > what does Code Pattern mean? > >> >> -- 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/b17dbcf1-6e49-418e-a989-df271f8a5227%40googlegroups.com.

