Template talk:Navbox/Archive 6

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Archive 5 Archive 6 Archive 7

Incorporating improved linewrap handling code

Due to frustrating situations such as this (point 2) and this, I'd incorporate a nowrap = on parameter in this template (well, its /core) that would frame each list with a the code from the {{nowrap begin}} and {{nowrap end}} templates. Unfortunately, however, I'm only able to view the source code, so would somebody with access please make this amendment. Thank you! Sardanaphalus (talk) 05:35, 25 March 2008 (UTC)

Hi Sardanaphalus. As you might know I am the one who coded the {{nowraplinks}} template + class that is used inside {{navbox}} which fixes most of the wrapping problems in the lists inside the navboxes. And then I coded the {{nowrap begin}} for those cases where {{nowraplinks}} failed. That is, to handle the Firefox expand outside the box bug.
1: I think I disagree with your suggestion that {{nowrap begin}} should be added as default in {{navbox}}, since {{nowrap begin}} is only needed in some lists. Although I can see the advantage of forcing people to always use the {{·wrap}} or {{·w}} or one of the other {{?wrap}} templates. (They would be forced to use them, since if they didn't use {{?wrap}} then their lists would not wrap at all.) But I think we then would get a more serious problem: Editors are lazy and if an editor sees that his list fits in the window he might not bother to add wraps in it. Problem is that then it will REALLY flow outside the "box" for those users who read at a lower screen resolution. Much worse than the Firefox bug.
2: I have noticed you are having lengthy arguments with User:Emerson7. I think you both should carefully (re)read Wikipedia:Line break handling.
3: I have noticed you are on a quest to stop people from using <div> tags around lists. I disagree with you on that. (For others that might read this: We use the DIVs so we can put each list item on a separate line in the code.) The DIVs make the lists much easier to see in the code and reduces the human errors a lot. And the DIVs do not interfere with cell backgrounds and text styles etc, the only thing they "cause" is a slightly wider top and bottom margin around the list. By the way, when one uses {{nowrap begin}} and {{nowrap end}} then one doesn't need the DIVs since one can use {{nowrap begin}} and {{nowrap end}} in the same way as the DIVs. (See Wikipedia:Line break handling#nowrap begin for a code example.)
--David Göthberg (talk) 09:07, 25 March 2008 (UTC)
4:And especially for emerson7: Even though I do not recommend that you use {{nowrap}} in lists, but instead use {{nowrap begin}} + {{·w}} etc, here's an advice: The way you do it slightly break it for Firefox users. (Well, you don't break it more than {{nowraplinks}} already does, but you can do it better.) You do like this:
{{nowrap|[[Andrew Grove]] (1997)}}{{·}}
But I suggest you do like this instead:
{{nowrap|[[Andrew Grove]] (1997){{·}}}}
The difference is that the end braces for {{nowrap}} should come after the {{·}}. Then you should not get the Firefox problem. (You of course need some kind of white space after all that, like a space or a new line, or else your list will not wrap.)
But as I said in my previous message, you really should carefully (re)read Wikipedia:Line break handling.
And note, {{nowrap begin}} is not really "esoteric" or "non-standard", internally it uses the same code as {{nowrap}}. It is completely W3C standards compliant and works in all web browsers that can handle {{nowrap}}. (Even works in my old MS Internet Explorer from 2001 that I use for compatibility testing.)
--David Göthberg (talk) 09:38, 25 March 2008 (UTC)
  • Thanks for your counsel, David, and the time it must've taken to compile. Having reread Wikipedia:Line break handling, the key statement still seems to me to be "Thus {{nowrap begin}} + {{·wrap}} + {{nowrap end}} can (and should) be used on lines in the standard navboxes that fail due to the nowraplinks problems.", coming right at the end, like a climax. It's saying to me that 'if you want to avoid the problems outlined above, use {{nowrap begin}} + {{·w}} + {{nowrap end}}'. Hence my using it for template lists and encouraging emerson7 to do the same -- or at least not undo it.
Hence also my suggestion that the {{nowrap begin}} and {{nowrap end}} code be incorporated in the Navbox template, but as an optional switch ("nowrap = on"). Editors who aren't already aware of what "nowrap = on" would mean could still create templates that use {{·}} or other dividers without then wondering why they weren't wrapping. Similarly, editors who tried to amend a template already using "nowrap = on" and {{·w}} would see that {{·w}} is the divider to use. I've already seen a few examples of this in templates I've revisited after sorting out their linewrapping.
So, it doesn't sound to me as if you're counseling against the use of {{nowrap begin}} + {{·w}} + {{nowrap end}} or, bearing in mind its optional nature, the possibility of a "nowrap = on" Navbox parameter. Am I misunderstanding something?
Finally, as regards <div>s within templates, I hope you'll be glad to hear that I've already realized this should be no problem, as I pointed out to emerson7 here.
Thanks again for all your input. Sardanaphalus (talk) 10:17, 25 March 2008 (UTC)
  • Instead of adding a new optional nowrap parameter to the template, we could just advise users to put in "liststyle = white-space:nowrap;", which would (I think) accomplish the same thing as putting {{nowrap begin}}...{{nowrap end}} around all of the lists. This doesn't fix the DIV issue, but it does eliminate having to retype "nowrap begin" and "nowrap end" for each list. --CapitalR (talk) 13:47, 25 March 2008 (UTC)
Now I am back from my two hour ski tour. We finally did get some decent snow! :))
1: CapitalR: I have not tested it, but I think that using "liststyle = white-space:nowrap;" will cause the entire lists to not wrap at all, even if one inserts {{·w}}. So I don't think that would work.
And here's my long response for Sardanaphalus:
2: No worries, that response didn't take that much time to type up. And this is important stuff since navboxes are so widely used so it is good if we discuss these things thoroughly on this talk page. By the way, {{navbox}} is used on 567000 pages! (CapitalR, you should be proud!)
3: Haha yeah, kind of funny that you use a statement that I wrote "against me". And you are right, there is no disadvantage in "overusing" {{nowrap begin}}. But I don't like your "nowrap = on" suggestion, I think it will be confusing. That would mean that some templates would be using {{nowrap begin}} + {{·w}} + {{nowrap end}} while some would look like they were using only {{·w}}. Now that would be really confusing. Although I am going to contradict myself in a moment. (There is a very simple solution, an ugly one, perhaps too ugly to use. But I am getting to that in a moment.)
4: Here is some funny stats (or perhaps depressing): {{nowrap begin}} is used 37,264 times, but {{nowrap end}} is only used 36,151 times. That means that there is perhaps 1000 "faulty" link lists out there. (Some hundred uses of {{nowrap begin}} is of course when it is mentioned on talk pages like here, but 1113 more sounds a bit much.) But don't worry, see next section.
5: Here comes the ugly solution, or if you will the good news. (I have been thinking for some time now if I should reveal this or not, since this will cause really bad coding habits... But I guess sooner or later others will figure it out anyway.) I tested what happens when one uses {{·w}} without any surrounding {{nowrap begin}} and {{nowrap end}}, but still inside some kind of box like for instance a table cell. That is, I used the "view page source" function in my web browser to look at the XHTML source of the wiki page that MediaWiki outputs. And I tested how it wrapped. Guess what? MediaWiki is so smart that it fixes the problem! It adds the missing </span> tag at the end of the list (at the end of the surrounding box). That is the </span> tag that {{nowrap end}} should have added. And at the first occurrence of {{·w}} it cleans away the </span> tag that is in the beginning of {{·w}}. So the end result is clean XHTML and a perfectly wrapping list that only lacks nowrap protection around the first list item. But the first list item is almost always short enough to never wrap anyway. So the truth is that it doesn't matter if people forget {{nowrap begin}} and {{nowrap end}}. They can use {{·w}} alone. At least in the current version of MediaWiki. So we don't really need the "nowrap = on" option.
But note, I still think that we should use {{nowrap begin}} and {{nowrap end}} for several reasons:
  • It is cleaner coding.
  • We don't know if future versions of MediaWiki will be as good at fixing the code (although hopefully they won't make MediaWiki less good over time).
  • In some cases even the first list item might need nowrap protection.
  • {{nowrap begin}} and {{nowrap end}} works as a substitute for the DIV tags so one can put each list item on a separate line, thus greatly reducing human error when editing the list.
Now I guess I have to go into hiding for some days since I know about a zillion coders out there that would DDoS my computer for disclosing this kind of thing and "encouraging bad coding habits". I guess I have to claim "information wants to be free". :))
--David Göthberg (talk) 14:10, 25 March 2008 (UTC)
  • Wow, yeah, I was definitely wrong there. I think it's still a little too early in the morning for me to be thinking about this problem. By the way, I'd appreciate comments and suggestions from both of you on my new navbox design, located at User:CapitalR/Navbox with a test page at User:CapitalR/Navbox/test. I worked on this about 6 months ago and left it unfinished, but finally got it in working condition last week, and am hoping to get the CSS and code into the live navbox within the next few weeks. Let me know what you think. --CapitalR (talk) 14:41, 25 March 2008 (UTC)
  • Will do. But first:
  • Don't worry, David, I won't tell anyone! -- More seriously, your MediaWiki discovery is intriguing. I've just been fiddling around with the {{nowrap begin}} and {{nowrap end}} tags and realized I'd overlooked this way of using them (I'm sure I must've tried this before, but found it not to work -- my mistake?):
emerson7 and I have just been exchanging messages and he seems happy with this simpler format. I just hope there isn't a problem with it lurking somewhere. Meanwhile, those curious stats you uncovered makes me think a bot should be comandeered to find those places without matching pairs of {{nowrap begin}} – {{nowrap end}} templates -- assuming that wouldn't be too great a hassle to set up. Sardanaphalus (talk) 17:16, 25 March 2008 (UTC)

CapitalR: Ah, so you also been on a six month wikibreak? I came back some week ago, mostly to see what happened with the templates I coded last summer. Got stuck answering questions about them (like here) and doing some updates to some of them since we learnt more since then. I'll try to squeeze in some time to look at your new navbox, don't know when though.

Sardanaphalus: I took a look at the code in your example box above, and yes, that is the best way to use {{nowrap begin}}. I have a guess what you might have done to see it "fail". You might have coded like this:

| list2 = {{nowrap begin}}[[item1]]{{·w}}
{{nowrap end}}

Just as with DIVs, if you put the first list item on the same line as the "list2 =" then you get an ugly rendering. Instead you should code like one of these two examples:

| list1 = {{nowrap begin}}
{{nowrap end}}

| list2 = 
{{nowrap begin}}
{{nowrap end}}

It doesn't matter if the {{nowrap begin}} is on the same line as the "list2 =" or not. Both works fine.

And I don't think you need to worry about any "lurking unknown problems" with {{nowrap begin}}. We have tested it for six months now, and as I told above it even mostly works correctly if you omit one or both of {{nowrap begin}} and {{nowrap end}}. There actually is one known problem with {{·w}}, as the "technical details" section in the docs at {{nowrap end}} says:

The {{·wrap}} causes problems if inside sections of bolded and/or italicised text. Do end the bold text before the {{·wrap}} and continue the bold text after it to avoid the problems. {{•wrap}} and the other helper templates only have this problem if the section is bolded and italicised at the same time.

You can see examples of what happens at Template talk:Nowrap begin#Testing with bold and italics.

By the way, I have recently come to a conclusion: Some of the templates I work with are used in so many places that the number of human editors that use them must be big. Thus it is important to document them properly, since we will never be able to talk with all the editors or correct their erroneous usage. And we need to show good examples on other pages. (I call that "marketing".) Like we should perhaps show {{nowrap begin}} usage in some of the examples in the documentation here at {{navbox}}? The reason I wrote Wikipedia:Line break handling and linked it from all relevant pages was exactly that, to spread the knowledge in a more efficient way. (As you might have seen, CapitalR wrote very nice documentation for {{navbox}}.) What I mean is that it is more important to add such examples here at the {{navbox}} than to actually fix the current errors out there in the templates. Since people will keep adding this to more and more templates in the future, faster than we can correct their errors.

And about using bots to clean up {{nowrap begin}} usage: I just checked, {{nowrap begin}} is currently "only" used in 1260 templates. (The much higher number of pages that use it is probably mostly due to those templates being on so many pages. Of course, there might also be pages that use them directly.) And {{·w}} etc is used in a similar number of templates. (Was a bit harder to count since there are several helper templates and the short names redirect to the longer names thus messing up the "what links here" list.) It would be a pretty easy thing to get those "what links here" lists (cut and paste), sort them etc and compare them to see which templates use one of the helper templates but totally lacks {{nowrap begin}} or {{nowrap end}}. Of course, that doesn't give us the cases where they are used in some weird way. For that a bot is needed, or manually checking the 1300 or so templates. I have never used any "Wikipedia bots" so I don't know how well they can be programmed. You'll have to ask around among the bot owners.

--David Göthberg (talk) 20:05, 25 March 2008 (UTC)

Couldn't help myself. I compiled a list of the templates with obvious nowrap problems. See next section. --David Göthberg (talk) 07:39, 26 March 2008 (UTC)

Templates with nowrap problems

I have compiled a list of templates with obvious nowrap problems. (Mostly navboxes.) There are 228 templates in the list. Anyone that is in the mood is welcome to help out to fix them. See the list and read all about it at: List of templates with nowrap problems. That is in no way a complete list of the navboxes with nowrap problems, but those were the easiest to detect. They are likely to be the worst cases. If we fix those ones then other editors might learn from what they see.

--David Göthberg (talk) 07:39, 26 March 2008 (UTC)

Show / Hide

I want to simply have this [show] / [hide] function working but the template structure is too complicated. I cannot find the code that enables it. :( can somebody help me out? --Subfader (talk) 17:44, 26 March 2008 (UTC)

The show/hide function depends in CSS and javascript found in MediaWiki:Common.css (.navbox class) and MediaWiki:Common.js respectively. EdokterTalk 18:04, 26 March 2008 (UTC)
ALso see http://meta.wikimedia.org/wiki/Help:Collapsing for the USA Today version for us slow people. Mikebar (talk) 13:29, 20 May 2008 (UTC)

Change Color

how can I change the Navbox color, you know how it's kinda purple how do I change it to ...say for example blue? —Preceding unsigned comment added by Markreidyhp (talkcontribs) 11:27, 30 March 2008 (UTC)

You can use titlestyle= and groupstyle=; see the documentation on the template page. EdokterTalk 12:41, 30 March 2008 (UTC)

Defaults for infoboxes under discussion

A while back I reforged {{infobox}} in this template's image, and now that it's starting to see more widespread usage there's a discussion underway about what default styling should be used. I set the original defaults based directly off of the default styles used here in Navbox, since I presume they've undergone a very extensive debate and because I personally find them quite useful. However, there are a couple of editors who've requested that the default infobox to be colorless. I'm not deeply wedded to the current style but at the same time I'm reluctant to change it based on just a few people's requests so I'm canvassing here to see if anyone with more experience in interface usability and such would be willing to pop over to Template talk:Infobox to give some input. Bryan Derksen (talk) 16:45, 1 April 2008 (UTC)

Does anyone know...

Does anyone know why recently the text in "group" of Template:Navbox becomes smaller in appearance in some computers? -- (talk) 23:06, 2 April 2008 (UTC)

New CSS code has been introduced in preparation for the new navbox code. This may cause some temporary font-size discrepancies due to caching latencies, which should ultimately correct itself after the navbox code goes live. EdokterTalk 23:10, 2 April 2008 (UTC)
Thank you very much for your answering. I WAS worrying that is a problem of my computer. :) -- (talk) 23:18, 2 April 2008 (UTC)

Template colours

Not sure if this is the best place to raise this issue but a certain user has been going around changing [1]all the navboxes to a new style he created apart from putting the wrong images into some of the navboxes he has also changed the main links to black see this template this makes wiki linked pages show as standard text meaning users will not think to click on this, what do other users think of this new style --Barryob (Contribs) (Talk) 17:24, 9 April 2008 (UTC)

Hi I'm the apparant a certain user Barryob feels the need to talk about first of all if you are going to talk about me at least use my name. Secondaly I have never used the wrong image you just don't like my choice of image usage, however both of those two issues are more personnal than related to the actual discussion. The blacking out of the links is as you might have noticed many users have already pointed out (although not on this talk page) is so that you can see the words written. Another discussion is taking place which I suggest Baryob you take part in deciding what bandcolour to use. When that has been decided I am perfectely willing to have all links returend to their normal standard colurs. Electrobe (talk) 14:44, 13 April 2008 (UTC)
This is not a technical problem, but one of style. Since it looks like those templates are under the purview of Wikipedia:WikiProject Caribbean, you should take this discussion to that talk page for a community consensus. --— Gadget850 (Ed) talk - 14:50, 13 April 2008 (UTC)
Yes I see we had better take this to a talk page however I don't believe that Carribean woudld be the correct one to take it too as it envolves all Commonweath Realm Pms, All British Goverment Offices and most other posistion in which the Queen has authority. Electrobe (talk) 15:00, 13 April 2008 (UTC)

Show on specified article

Hi, is there a way to show a template on a specified article when it's with other templates but keep its default state as autocollaped? See the Hong Kong article for an example, I'm trying to get the Hong Kong Topics template in the See also section to be expanded, while the other templates at the bottom of the page are hidden, but keeping the Hong Kong Topics template hidden on other pages it's transcluded onto. I tried something like this on the Hong Kong article but it didn't work:

==See also==
{{Hong Kong Topics|state=show}}

I'm not sure if that feature exists or not. Many thanks --Joowwww (talk) 18:28, 9 April 2008 (UTC)

You were on the right track, but the template itself needed the "state" parameter set up as follows:
|state = {{{state<includeonly>|autocollapse</includeonly>}}}
It works now. Rgrds. --Tombstone (talk) 18:52, 9 April 2008 (UTC)
Ah! Many thanks for that. --Joowwww (talk) 18:56, 9 April 2008 (UTC)

Problem with using imageleft option

I just saw {{JamaicaPMs}} which uses the imageleft option. The problem is that this image on the left overlaps with text in the box, or at least it does on my browser (currently using IE). Can anyone explain this? 52 Pickup (deal) 15:40, 14 April 2008 (UTC)

Which version of IE? I've tidied up the markup a bit and I can't reproduce this in IE7 or IE8. Chris Cunningham (not at work) - talk 16:24, 14 April 2008 (UTC)
The problem was a |left being used within a table, which causes this know bug in IE(6). Seems to be fixed now. EdokterTalk 18:35, 14 April 2008 (UTC)
Yep, I was using IE6. After the "left" code was removed in this change, it's now fixed. 52 Pickup (deal) 06:30, 15 April 2008 (UTC)

padding for list

I would like to propose the following change:

  • |es = width:100%;font-size:95%;background:#f7f7f7;{{{liststyle|}}}{{{evenstyle|}}}


  • |es = width:100%;font-size:95%;background:#f7f7f7;padding:0 0.5em;{{{liststyle|}}}{{{evenstyle|}}}

This change provides a extra padding for the lists, making them easy to read. Also, it looks better in my opinion. eDenE 14:18, 17 April 2008 (UTC)

I don't see that much of a difference. In any event; while it may look better for text, other elements in a list, like images, may suffer from this change. EdokterTalk 14:27, 17 April 2008 (UTC)

This change may not be so good for lists starting images as shown beside. However, as long as I checked so far, there aren't any templates like that. Although a better-look is not necessarily a good motive for some changes, I don't see any potential problems with it... eDenE 15:12, 17 April 2008 (UTC)
Default padding is already "1px". As your second example shows, 0.5em padding screws with the horizontal offset of the cell's content. By the way, navbox is about to be overhauled, so any changes would have a short-term effect. EdokterTalk 15:25, 17 April 2008 (UTC)
Adding list padding won't really work as it would mess up all {{Navbox subgroup}} instances (used by a few hundred templates). The new version of the navbox code will take care of this problem and will add in a default left and right list padding that won't have an effect on the subgroups. --CapitalR (talk) 13:23, 18 April 2008 (UTC)

Standardise navigation templates colours?

Have a look at this version of Giovanni Trapattoni page, we have red,blue,black,white,purple and green ,basicly a rainbow of of colour here. Is it time to define a standard colour (most likely the pale blue,default colour) for nav boxes?Gnevin (talk) 20:33, 23 April 2008 (UTC)

I don't believe so. Trappatoni is an extreme example of the multicoloured navboxes. I think it's quite appropriate that navboxes for football clubs match the colours of the club. пﮟოьεԻ 57 22:12, 23 April 2008 (UTC)
I've ask this here Wikipedia:Village_pump_(policy)#Standardise navigation templates colours?, i will copy your reply over so we only have one discussion Gnevin (talk) 22:31, 23 April 2008 (UTC)
It gives a clear indication of who he has managed throughout his career. As above it is extreme as he has had such a long and travelled career, seemingly with a number of clubs with equally varied colours.Londo06 17:04, 2 May 2008 (UTC)