On 11-04-11 12:05 AM, Alex Brollo wrote:
2011/4/11 Daniel Friesenlists@nadir-seen-fire.com
Side thought... why a #switch library? What happened to the old {{Foo/{{{1}}}|...}} trick?
Simply, {{Foo/{{{1}}}|...}} links to different pages, while {{Foo|{{{1}}}|...}} points to the same page. I had been frustrated when I tried to use Labeled Section Transclusion to build template libraries :-), that would be an excellent way to build "collection of objects" into a wiki page, both of "methods" and "attributes"... ... but #lst doesn't parse raw wiki code "from scratch". If it would (t.i.: if #lst would read wiki code "as it is", before any parsing of it, ignoring at all the code outside labelled section: t.i. ignoring noinclude, html comment tags... anything) interesting scenarios would raise.
But, if there's no performance gain with {{Foo|{{{1}}}|...}} trick, I'll use {{Foo/{{{1}}}|...}} for sure. KISS is always a good guide line. :-)
Alex
Pointing to different pages is essentially the point of the trick. [[Template:Library]] = {{#ifexist:Library/{{{1}}}|{{Library/{{{1}}}|...}}|There is no library function by the name "{{{1}}}".}} [[Template:Library/a]] = Do a [[Template:Library/b]] = Do b
{{library|a}} => "Do a" {{library|b}} => "Do b"
It essentially works the same as: [[Template:Library]] = {{#switch:{{{1}}}|a=Do a|b=Do b|There is no library function by the name "{{{1}}}".}}
Except you don't create an obscenely large preprocessed hierarchy which is cloned in it's entirety to multiple places and expanded multiple times just to get access to multiple pieces of the library.
Though, when we're talking about stuff this complex... that line about using a REAL programming language comes into play... Would be nice if there was some implemented-in-php language script language we could use that would work on any wiki. I "had" a project playing around with that idea but it's dead.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]