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/64535e5c-0e6e-47a8-b492-24b86ed5c042%40googlegroups.com.

