Template talk:Contribs
And others
I'd like to let us add and other contributor(s) by putting "Other" either at the front of the list or the end of the list of names. But actually engineering this is a pain--anybody like to give it a shot? --Larry Sanger 11:31, 29 February 2008 (CST)
- I'll do it, but not tonight. It's not too hard, actually, if you let it be only the first argument that can be "Other". (The first argument tests for being equal to "Other"; if so, evaluate to "", otherwise evaluate as now. Then at the end add another test of the first argument; if equal to "Other", evaluate to "and other contributors", otherwise "".) Letting it be anywhere else makes it much more complicated to implement, because the "Other" can be anywhere. I'd get rid of the () because if it's just one, you can stick them instead of the "Other" argument. J. Noel Chiappa 21:37, 9 March 2008 (CDT)
- Actually, now that I think about it, probably a better way to go is to allow an "others=y" argument. That way, i) you can put it anywhere, and ii) adding "Others" doesn't count against the number of arguments supported by the template. Makes the template code slightly shorter too. Is that argument syntax OK? J. Noel Chiappa 23:24, 9 March 2008 (CDT)
Sounds plausible--I'm too sleepy to be able to articulate my worry. If you can do it, great! --Larry Sanger 23:27, 9 March 2008 (CDT)
- That's OK, just wing it, I'll see if I can work out what the issue is. (Now that you've said you've got a concern, you've made me curious!) Oh, BTW, it's trivial to tweak it so that "others=1" generates "contributor", and "others=<anything else>" generates "contributors". J. Noel Chiappa 23:55, 9 March 2008 (CDT)
OK, I added the "and others" stuff. Let me know what you think. (If I really wanted to go wild with templatology, I'd add code so that if others=1, you'd only need 4 names before you'd get a message, and if others=<whatever>, you'd only need 3, but I'll wait and see how you like this. :-) J. Noel Chiappa 11:23, 10 March 2008 (CDT)
- I think it's great. Yes, it should work such that you'd only need 4 names before you'd get a message. The exact number might change, of course, depending on the final passed resolution. --Larry Sanger 12:42, 11 March 2008 (CDT)
- Good to hear! I'll do it later (my brains are melting after trying to hack the references-on-a-subpage thing - want to go write some plain text now :-). It's a very straighforward fix; instead of just testing (at the top) for the 5th argument, we'll test the 4th (if "others=1"), or the 3rd (if "others=<something else>"). If the numbers change, it will be a simple matter of changing 5/4/3 to 6/5/4, or whatever. J. Noel Chiappa 13:25, 11 March 2008 (CDT)
- Done (and fully tested). J. Noel Chiappa 10:38, 12 March 2008 (CDT)
Removing hard limit
It ought to be possible to code this so that it doesn't have the hard limit of 10 (or however many). Templates don't support loops per se, but they do support recursion, and that can be used to 'fake' loops. Some other day, though! :-) J. Noel Chiappa 10:42, 12 March 2008 (CDT)