On Sat, Nov 14, 2009 at 2:16 PM, Eric Shulman <[email protected]> wrote: > >> > At present, transclusion only allows a list of parameters, which are >> > declared in the template as $1 to $9. I wonder if there are any plans >> > to (a) allow named parameters; and (b) support more than 9 parameters. >> I don't think it's come up before, though it might be nice. >> Having said that, it shouldn't be too hard to create a plugin (perhaps >> using supplant*), which might eventually be integrated into the core. > > Jeremy and I discussed this a very long time ago, and I've actually > implemented something *like* this in several different plugins (but > not with the <<tiddler>> macro handler). > > I also have an existing core tweak for the <<tiddler>> macro -- to fix > refresh handling for transclusions with params -- that could be > extended to add pre-processing for named params in addition to the > current $1 to $9 markers. > > For each named param (e.g., "name:foo") passed in the macro, any > instances of "$name" in the target tiddler will be replaced with the > corresponding value. Note: occurrences of "$somename" within the > tiddler will be left unchanged if "somename" is *not* used as a param > in the tiddler macro. > > Also, because of the manner in which parseParams() works, all > positional params must be specified either before or after any named > params (i.e., you can't mix named params in the middle of the > positional params). Thus: > > <<tiddler SomeTiddler with: p1 p2 p3 name1:val name2:val>> > or > <<tiddler SomeTiddler name1:val name2:val with: p1 p2 p3>> > but *NOT* > <<tiddler SomeTiddler with: p1 name1:val name2:val p2 p3>> >
Very interesting Eric. It'd be neat to see you integrate that into your patched tiddler macro. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/tiddlywikidev?hl=en -~----------~----~----~----~------~----~------~--~---
