Template talk:Navbox

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Utterly disable category handling[edit]

I would like to have absolutely 100% control over all of the categories on my platform, but I cannot for the life of me prevent Navboxes from being automatically categorized. I have utilized |nocat=true, and while this has worked elsewhere, isn't doing a single thing to help on my created Navbox template. I would greatly appreciate any information on how to suppress these categories(or category handler altogether, if possible.) 2602:304:CF7D:A010:AC12:8F5E:4AC2:39B6 (talk) 02:16, 26 September 2017 (UTC)

your edit history shows only this page, so it's hard to tell what exactly you are talking about. Frietjes (talk) 19:19, 26 September 2017 (UTC)


Should there be e.g. |groupnlang= parameters? Are they necessary? I tried replacing an incorrect use of {{lang}} (which uses a span tag) in {{Irish names}} with |groupnstyle=" xml:lang="ga" lang="ga but it doesn't seem ideal. Jc86035 (talk) 14:24, 24 December 2017 (UTC)

Jc86035, creative, but it's the lists that are in Gaelic, not the group labels. couldn't you also fix it by using <div>...</div> instead of <span>...</span> with the lang tagging? Frietjes (talk) 14:37, 24 December 2017 (UTC)
@Frietjes: Thanks for catching that, though the span disappears from the source because of Tidy. Maybe {{lang}} could have a |div=yes? Jc86035 (talk) 14:40, 24 December 2017 (UTC)
Jc86035, yes, it appears tidy is distributing the spans to all of the list entries. this is nice, but since tidy is being replaced with lint, so who knows what will happen then. I have replaced it with divs for now. Frietjes (talk) 14:47, 24 December 2017 (UTC)
I think this is a limited-enough case that lang parameters for each list are unnecessary. I've also removed xml:lang since that is not conformant in HTML 5. The use of the div is how I would generally mark this up. --Izno (talk) 18:32, 24 December 2017 (UTC)
indeed, the backend software adds the xml:lang to the source. Frietjes (talk) 13:27, 25 December 2017 (UTC)
@Frietjes: Tidy does that and it should go away when Tidy does. phab:T46609. --Izno (talk) 14:23, 25 December 2017 (UTC)
sure, and according to the link you provided, it's looks harmless since it has "no effect on language processing". but, if it has no effect, there is also no reason to add it. Frietjes (talk) 14:42, 25 December 2017 (UTC)

Color accessibility issue in V*T*E links on standard navbox title color[edit]

I discovered that the wikipedia red link color on the standard navbox title color does not obey the WCAG 2.0 standards for text color contrast below 18pt. Not sure what to do about this. I started a discussion about this at WT:WikiProject Accessibility#Wikipedia red link on wikipedia standard navbox title violates WCAG 2.0, feel free to join in. —hike395 (talk) 07:33, 3 January 2018 (UTC)

Tracking old style borders[edit]

after changes to this module, the "old style" css borders no longer work as expected. The fix is to replace them with box-shadow borders like this. does anyone object to adding tracking to find these? I have put some code in the sandbox. Frietjes (talk) 19:03, 8 January 2018 (UTC)

This is above my head but I looked at the diff between the main and sandbox modules and it looks good. However, what is the pipe doing in:
args = getArgs(frame, {wrappers = {'Template:Navbox|subgroup', 'Template:Navbox'}})
I don't use Module:Arguments enough to know whether a pipe would do anything useful. I would have thought that each string in the wrappers table had to be the name of a template. Johnuniq (talk) 23:38, 8 January 2018 (UTC)
Johnuniq, thanks for spotting the error. I had been replacing 'navbox subgroup' with 'navbox|subgroup' and forgot to turn off the script before editing the module. now corrected. by the way, if you have time to figure out how to make Template:Navbox subgroup/sandbox work with the getArgs, that would be great. you can probably experiment with "Navbox subgroup" directly since the transclusion count is low. Frietjes (talk) 00:34, 9 January 2018 (UTC)
@Frietjes: What shows that it is not working? See test at sandbox2 (permalink). Johnuniq (talk) 02:13, 9 January 2018 (UTC)
Johnuniq, I added a comparison with the live version. basically, the only parameter being passed explicitly, the border, is not recognized. Frietjes (talk) 13:50, 9 January 2018 (UTC)
@Frietjes: So the problem is that Template:Navbox subgroup/sandbox invokes Module:Navbox/sandbox and passes a border parameter. The expected behavior is that the border parameter from the template would be merged with the parameters from the parent, that is, from the wikitext in User:Johnuniq/sandbox2. The reason that is not happening is due to the use of wrappers in the module:
args = getArgs(frame, {wrappers = {'Template:Navbox subgroup', 'Template:Navbox'}})
Edit the sandbox module and change the above line to:
args = getArgs(frame)
then paste User:Johnuniq/sandbox2 into the "preview page with this module" box and Show preview. The idea of Module:Arguments is to merge arguments from the invoking template and the parent wikitext, but that is usually unnecessary overhead. Therefore wrappers can be used to specify the templates which do not pass parameters (they merely wrap the module) and which therefore do not need merging. I can't understand the documentation for Module:Arguments so experiment would be needed to determine what would happen if a border parameter was passed in the parent wikitext as well as from the template. Johnuniq (talk) 02:30, 10 January 2018 (UTC)
Johnuniq, yes, I had experimented before with removing the wrappers parameter, and found that it worked. however, I have no idea why it doesn't work with the wrappers parameter. looking at Module:Arguments it should be looping over the entries in the table of wrappers and passing them to the "matchesTitle" function? assuming that part is working, then there must be a logic mismatch between the "wrapper" and "no wrappers" branches of the code. Frietjes (talk) 15:59, 10 January 2018 (UTC)
after reading the documentation for Module:Arguments some more, I see that if it is a wrapper, then it won't parse the parent args? so, if that is the case, we definitely don't want "navbox subgroup" to be listed as a wrapper. another option would be to have a separate "subgroup" entry point into the module, but that seems a little excessive considering how few transclusions there are of "navbox subgroup" at the moment. Frietjes (talk) 16:03, 10 January 2018 (UTC)
@Frietjes: We discussed this in July 2017 here. I forget all about that, but I see that my local copy of Module:Navbox had some code to get border from the template. I don't know if I ever tried that out last August, but I put it into Module:Navbox/sandbox just now. Does that work?
Re "if it is a wrapper, then it won't parse the parent args?": Module:Args always gets the parent args (that is, the arguments from User:Johnuniq/sandbox2 in our example). There may be a way to turn that off so "always" may be a bit strong, but the cases I have seen always involve getting the parent args. The purpose of wrappers is to avoid the overhead of merging arguments from the template—if it is a wrapper, then an argument in the wikitext of the template definition will be ignored. If the template might have various arguments that should be merged, you would omit the template from wrappers. In the case we are considering, the only template parameter is border so my edit checks for that only. It should work! Johnuniq (talk) 02:48, 11 January 2018 (UTC)
Johnuniq, looks good, I have updated the main template. by the way, I hope I didn't completely mangle Module:Football manager history. immediately after I turned on the tracking, pages using that module started popping up in the "uses basic css borders" tracking category, so I changed the borders to use the 'box-shadow borders'. unfortunately, the box-shadow borders (see {{box-shadow border}}) are more complicated, but without them you don't get the visual separation between the groups/above/below etc. please let me know (or correct it) if I screwed it up. Frietjes (talk) 13:14, 11 January 2018 (UTC)
In case it's not obvious, all I did in writing Module:Football manager history was emulate what the old template did. What you have done with the border is way over my head. Re the changes to the module, they look good. In addiflist it might be better to use ipairs for consistency—that's how a list should be iterated. Also, it would be a little more efficient to have addifsubst which takes a long string rather than a table. It would replace (substitute) each occurrence of %1 with item using gsub. However, your code is good and I am just mentioning my thoughts for completeness. By the way, your script might be doing more than wanted: check diff which changed "Carson–Newman" to "Carson to Newman". I might look at it more another time. There were quite a few problems when I converted a zillion articles using the system to the syntax preferred by {{Football manager history}}. I could see the template might be useful in other cases but I was exhausted by then. Johnuniq (talk) 06:53, 12 January 2018 (UTC)
I just had a look at my contributions. It was actually 1377 templates, not articles, OMG. I think I used a Python script to do the major edit (example), then manually checked if it had worked. Johnuniq (talk) 06:59, 12 January 2018 (UTC)
Johnuniq, the six or so conversions to Template:Football manager history were done by hand using search-replace, so it's not too shocking that I screwed one up. in any event, those changes were reverted, so it's not an issue at this point. the bigger idea would be to take the simplified colouring syntax from that module and make it generic. and, even better would be to take the automatic link colouring code from Module:Team roster navbox as well. Frietjes (talk) 13:24, 12 January 2018 (UTC)
Johnuniq, I simplified my changes to Module:Football manager history as suggested. hopefully it looks better now. thank you. Frietjes (talk) 18:11, 12 January 2018 (UTC)
The module changes are great, thanks. Later I could help with your "bigger idea" if wanted, and if I could see some simple examples of what is meant. Johnuniq (talk) 01:25, 13 January 2018 (UTC)