[14:31:50] T13|needsCoffee: Hey dude. If you have the time, I could use some advice on template & document structure on meta. [14:33:21] Sure [14:34:07] Sec [14:34:19] Sure. [14:34:49] So I'm trying to solve a problem where there are many things that you'd call "projects" and "proposals" on meta. [14:35:01] Shoot [14:35:05] So I'm trying to solve a problem where there are many things that you'd call "projects" and "proposals" on meta. [14:35:14] Some are research, some are grants, etc. [14:35:49] They all use an infobox like template to track critical metadata. And for most of these projects, the metadata is identical. [14:36:00] link? [14:36:02] Also, project tend to jump between types. [14:36:09] https://meta.wikimedia.org/wiki/Template:Project [14:36:42] So, I have two questions. One is, why isn't my current {{#switch:}} working? The second is, should I even design this template this way? [14:39:37] Cleaning it up.. just a sec. [14:39:41] k [14:40:29] I like your style. I think I'll adopt it. :) [14:40:45] Template:Basic project doesn't exist [14:41:14] Yeah. I'm still working on that. [14:41:18] :) [14:41:45] https://meta.wikimedia.org/w/index.php?title=Template%3AProject&diff=5876184&oldid=5876137 should make it work when [[Template:Basic project]] exists for #default [14:42:55] It looks like it works now. Before it was just dumping out the {{#switch:}} How come? [14:43:06] was some of the whitespace you added necessary? [14:43:20] because you didn't close the switch }} [14:43:29] lol Damn it. [14:43:33] You're right. [14:43:34] Bah [14:43:37] Your }} at the end closed the template call. [14:43:55] There's a reason I'm {{Guy}} you know... :p [14:43:59] haha. [14:44:21] So now, for my strategy. I want all projects/proposals to use the {{Project}} template with a "type" field. [14:44:22] The whitespace is only needed to make it easier for us silly humans to read. [14:44:33] :P [14:44:39] I figured. [14:44:57] That's fine, just make sure that you consider differences in human nature. [14:45:21] make sure your switch is case and space insensitive as best you can. [14:45:58] Good call. Is there a better way to pass parameters than I'm already doing? [14:46:14] "type= ieg proposal" will fail as is... so will "type= IEG proposal.. [14:46:47] First, make it case insensitive inside the switch... {{lc:{{{type|}}}}} [14:47:17] Can you find and replace "_" then? [14:47:25] Or rather " " [14:47:32] then, make all of the possible inputs space insensitive as best you can... |ieg_proposal|ieg proposal= [14:48:07] |iegproposal|ieg_proposal|ieg proposal= [14:48:13] even more insensitive... [14:48:42] I didn't know that just lining them up like that worked. [14:49:22] yep [14:49:52] https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#Grouping_results [14:50:20] Oh... It ruins the pretty formatting :P [14:51:35] sh [14:56:07] Thanks for your help :) [14:59:19] Any more questions? [14:59:40] * Technical_13 thinks he should finish his course on creating and working on templates he started... [15:04:15] Looking good... :) [15:05:55] I'm crazy about good whitespace. Thats one of the reasons I find myself frustrated with the edit pane. [15:06:16] I really appreciate seeing yours in practice. [15:07:20] Yeah, sometimes the wiki parser complains about whitespace too... Sooo.... becomes important in those cases. [15:07:48] Yeah. I end up using that a lot when I'm formatting divs into a page. E.g.: [15:08:01] !link :meta:Research:L2 [15:08:08] :( [15:08:22] https://meta.wikimedia.org/wiki/Research:L2 [15:09:08] @link [[meta:Research:L2]] [15:09:08] https://meta.wikimedia.org/wiki/Research:L2 [15:09:13] ;) [15:50:58] Can you do the multiple matches switch style in an {{#ifeq:}}? [15:51:29] In the #switch, it was ||... = {{foo}} [15:51:44] But in an ifeq, the whole thing breaks down. [15:52:16] {{#ifeq: {{{my_param|}}}|foo|Foo|}} [15:52:21] Or does it? [15:52:28] Technical_13: ^^ [15:52:41] Nope.. Can't do that. [15:52:47] Boo. [15:52:50] https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23ifeq [15:53:01] If you want to do that, you have to nest them... [15:53:15] * halfak gags a little [15:53:27] I think I might just go with the switch again. [15:53:30] It should be cleaner. [15:53:33] {{#ifeq: {{{my_param|}}}|foo||}} [15:53:48] Yep, usually is... [15:54:01] Although sometimes nesting it the only option... [17:55:29] Still working on that template? lol [17:56:32] I see some of the sub-templates are developing... Be careful with expansion size and depth... They can be a pain... [17:56:38] halfak: ^^^^ [17:57:16] Not sure what you mean. I assume that it has to do with performance? [17:57:37] Kind of... [17:57:57] The wiki parser doesn't really like templates inside of templates inside of templates... [17:58:19] It has a max depth to 40 and a max inclusion size of about 2m iirc... [17:58:37] Gotcha. I'm 16/40 right now. [18:04:09] Huh.. [18:11:32] Hi {{Guy}} [18:11:48] <{{Guy}}> Hi [18:12:11] wat [18:12:26] <{{Guy}}> Huh? [18:22:11] Did my wifi crap out again?