Template talk:Number cat

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Edit request - Fix breakage caused by changes to {{Label}}[edit]

{{Edit request}} The change to {{Label}} discussed at Module talk:Wikidata label#Better hover text (I also left a message there, but it's mostly duplicate of what is here) broke many transclusions of this template (for example, Category:100 (number)) by revealing two flaws in its current implementation. Specifically, that change broke the method that the template currently uses to retrieve the number represented by a Wikidata ID when the item for the number is missing d:Property:P1181. In such cases, the template assumes that {{Label}} returns nothing but the raw label and treats the returned label as a string representation of the number. The change to {{Label}} wrapped the returned result in <span class="plainlinks" title=''>, which means that the result can no longer be used in this way. Most numbers with Commons categories (as far as I can tell) actually do have P1181 on Wikidata, but many transclusions broke anyway because the template currently does not attempt to use P1181 at all (and instead goes straight for the label-based method) when the Wikidata ID is passed to it as a positional parameter instead of a named parameter, which appears to be the case in the majority of its transclusions. As far as I can tell, there isn't any reason for the template not to use P1181 in those cases, so this is an edit request to change that by copying the existing templates used to fetch the property to where the positional parameters are handled.

The diff, in my sandbox: [1] (copied from the current template but with a sandbox header)

I also made a fix to overcome the added <span> tags by stripping them using string processing templates (diff [2]), but that is still easily broken by further changes to {{Label}}, which is why I also mentioned the matter at the module talk there.

Both modified versions were tested by previewing transclusion of my sandbox at Category:100. Since I couldn't easily locate a Wikidata number item missing P1181, the second change was tested by temporarily modifying the template to use Latin labels and passing in d:Q15397819, Wikidata Sandbox 3, for which I changed the according label.

--wqnvlz (talk | contribs) 05:08, 26 January 2021 (UTC)[reply]

 Not done: Procedural close. @Wqnvlz: The current protection level is only semi protection. You should be able to make the changes by yourself. If you faced any problems, you can open another edit request. --A1Cafel (talk) 03:40, 6 November 2021 (UTC)[reply]

no space options[edit]

{{Edit request}}

See also Wikipedia article: pt:Usuário Discussão:!Silent#Ajuda com código no Commons.

Hi! How do works the no space options (special:diff/365583996)? @Joshbaumgartner: can you explain? I had tried (see Category:BA-099, Category:BR-116 and Category:Line 2, Salvador Metro) but it doesn't work. --Luan (talk) 19:07, 9 July 2021 (UTC)[reply]

Hello, @Luan: , seems that the no-space option needed some code fixes to get working correctly. That is now done, but in the case of Category:BA-099, it revealed a new issue. There are several "Category:BA-##" categories that are not Brazilian roads (a Soviet armored car series instead), and these are caught up in the list as well as actual Brazilian routes. I'm trying to figure how to handle series where a leading zero is required (such as this one) and exclude categories such as Category:BA-3 getting listed in this case. Josh (talk) 19:49, 9 July 2021 (UTC)[reply]

Series with leading zeros[edit]

@Joshbaumgartner: Would it be possible to handle series that include leading zeros? Currently the number input is always truncated unless you use |nt = nlz. That, however, will create an mbox for "other integers" by default. I was thinking of modex numbers in particular where we already have Category:00 (modex) and similar categories where the "series" message box does not display them correctly. De728631 (talk) 10:23, 8 December 2021 (UTC)[reply]

@Verdy p: Since Josh is not really active at the moment, do you have any ideas how to implement this? It has been a while but you were the last user to sort of overhaul this template and other templates by Josh that are being used here. I am also struggling with the use of the |serieslz= paramater in {{Number cat/layout}} as it doesn't seem to do anything but apparently was intended to handle something with regards to leading zeroes and series?! De728631 (talk) 14:47, 10 December 2021 (UTC)[reply]
@De728631: Do you propose that this should be based on the specific number, or be applied to the series as a whole? In other words, do you just want those numbers with a leading zero to show a series with leading zeros, or is this a case where the entire series should show them (for instance, '100' would show '099' as the previous number in the series even though '100' doesn't have a leading zero itself)? Josh (talk) 20:38, 10 December 2021 (UTC)[reply]
I'm only talking about those numbers that do have one or more leading zeros like 001, 00, 02, etc. When there is no leading zero in reality, we should record the number as it as. So I guess what we need is an optional parameter like |catlz=00 for the one category where the template is applied, while the series as a whole goes through the normal series procedure. De728631 (talk) 14:58, 11 December 2021 (UTC)[reply]

Broken[edit]

@R'n'B: Recent edits to the /layout subpage broke this thing (I noticed while editing one of its many transclusions). Please fix. -- Tuválkin 17:02, 22 December 2022 (UTC)[reply]