Hi Tony, Many thanks. This is also great for documentation. Best Mohammad
On Tuesday, March 17, 2020 at 11:13:26 AM UTC+3:30, TonyM wrote: > > Mohammad, > > Thanks so much. Your code looks beautiful > > It's the use of the codeblock I had not understood, to achieve unwikified > output. > > By the way since you are a prolific published of macros perhaps you would > be interested in this defacto standard I have developed. > > I have attached a modified version of your tiddler > $:/plugins/kookma/utility/macro/transclusion and provided a tiddler that > shows how to list the result. > > - In each tiddler defining macros I create a matching field with the > syntax for each macro > - A Separate listing allows the macro, its syntax and its location to > be identified > - You can change the scope of the list to only show macros in a > particular set of tiddlers, eg $:/plugins/kookma/utility > - If we can adopt this defacto standard we could have a control panel > or info tab that lists all macros in the current wiki with syntax, whoever > wrote the macro. > - It helps identify if you had two macros of the same name, or locate > a macro to clone and make a variation > - We could improve it to also look at shadow tiddlers. > > Regards > Tony > > > > > > > On Tuesday, March 17, 2020 at 3:49:17 PM UTC+11, Mohammad wrote: >> >> Hi Tony, >> >> See this shadow tiddler: $:/plugins/kookma/utility/macro/transclusion >> >> --Mohammad >> >> On Tuesday, March 17, 2020 at 12:42:01 AM UTC+3:30, TonyM wrote: >>> >>> Mohammad, >>> >>> Thanks for sharing that. I was experiencing some issues with >>> transcluding code and ensuring plain text with new lines, I am sure the >>> answer will be in your macro. >>> >>> >>> - Can you tell me the best way to explore your macros on the utility >>> site? >>> - Have you a way to extract specific utilities? >>> >>> Regards >>> Tony >>> >>> On Monday, March 16, 2020 at 7:07:44 PM UTC+11, Mohammad wrote: >>>> >>>> Added to TW-Scripts >>>> >>>> Very nice tip! >>>> >>>> If you have a look at TW-Utility, I have developed custom transclusion >>>> and I use them in TW-Scripts alot >>>> See https://kookma.github.io/TW-Utility/#demo%2Ftransclusion-macro >>>> >>>> --Mohammad >>>> >>>> On Monday, March 16, 2020 at 7:25:54 AM UTC+3:30, TonyM wrote: >>>>> >>>>> Folks, >>>>> >>>>> I was looking through tiddlywiki to find how it does things because if >>>>> you are left on a desert island or isolated with corona virus and no >>>>> internet, tiddlywiki is in some ways its own documentation. I came across >>>>> this in the tiddler $:/core/templates/exporters/TidFile which piqued my >>>>> interest. >>>>> >>>>> \define renderContent() >>>>> {{{ $(exportFilter)$ +[limit[1]] ||$:/core/templates/tid-tiddler}}} >>>>> \end >>>>> \import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/ >>>>> Macro]!has[draft.of]] >>>>> <<renderContent>> >>>>> >>>>> Already I often use the triple curly braces to get a quick filter >>>>> result >>>>> >>>>> {{{ [all[]prefix[New Tiddler]] }}} >>>>> >>>>> Observe how the triple curly braces not only evaluates a filter but >>>>> then displays the result via a template? >>>>> >>>>> This is "documented" here >>>>> https://tiddlywiki.com/#Transclusion%20in%20WikiText but it is easy >>>>> to miss. >>>>> >>>>> {{{ [all[]prefix[New Tiddler]]||$:/core/ui/ListItemTemplate}}} >>>>> >>>>> For example the above uses the existing list item template to render >>>>> the list resulting from the filter, but it is no different to the default >>>>> >>>>> $:/core/ui/ListItemTemplate >>>>> <div class="tc-menu-list-item"> >>>>> <$link to={{!!title}}> >>>>> <$view field="title"/> >>>>> </$link> >>>>> </div> >>>>> >>>>> You can see how this template is quite simple;; >>>>> And lets edit it to include the description >>>>> >>>>> Tiddlername Description >>>>> <div class="tc-menu-list-item"> >>>>> <$link to={{!!title}}> >>>>> <$view field="title"/>: {{!!description}} >>>>> </$link> >>>>> </div> >>>>> >>>>> Now you can use >>>>> {{{ [all[]prefix[New Tiddler]]||Description}}} >>>>> >>>>> To list everything in the filter and its description if it exists. >>>>> >>>>> Or make the template DescriptionRow >>>>> <tr><td><$link/></td><td>{{!!description}}</td></tr> >>>>> >>>>> And use >>>>> <table> >>>>> <tr><th>Name</th><th>Description</th></tr> >>>>> {{{ [all[]prefix[New Tiddler]] ||DescriptionRow}}} >>>>> </table> >>>>> >>>>> The possibilities abound. >>>>> have fun >>>>> >>>>> Regards >>>>> Tony >>>>> >>>>> -- 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/0fea4498-022e-42c6-a5ea-310d06b72a7c%40googlegroups.com.

