Wikipedia talk:WikiProject Templates

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
WikiProject iconTemplates
WikiProject iconThis page is within the scope of WikiProject Templates, a group dedicated to improving the maintenance of Wikipedia's templates. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.

Recreate Template:Bold?[edit]

As a frequent mobile web app user, it's a massive pain to add six straight apostrophes, because the keyboard resets to the letters section every time they are added. It would actually be faster to type a template for this. Even if you really hate the idea of multiple formatting options, there are probably a few systems where the straight apostrophes can't be typed at all, and typing {{subst:bold}} would be quicker than looking up the relevant HTML code Mach61 (talk) 14:24, 28 September 2023 (UTC)[reply]

Yeah, I'll be opposed to that. Gonnym (talk) 15:22, 28 September 2023 (UTC)[reply]
That is an issue specific to your mobile keyboard.... Izno (talk) 16:40, 28 September 2023 (UTC)[reply]
I see nothing wrong with a niche template Mach61 (talk) 16:41, 28 September 2023 (UTC)[reply]
Except it's not. It's an issue with multiple input devices, be they mobile keyboards that don't recognize multiple consecutive punctuation as a use case, or an IME that autocorrects to smart quotes. Having a substitution-only template could effectively and simply bypass any of several technical limitations of input devices that interfere with Wikipedia editing. VanIsaac, GHTV contWpWS 17:27, 28 September 2023 (UTC)[reply]
Using bold HTML tags could also solve this Vghfr (talk) 21:04, 25 January 2024 (UTC)[reply]

Is there a templatespace version of a template like {{Intentionally blank}} for use on subtemplates that are partially coded fractions of fully coded blocks, that need to assembled together to make visible sense? If this is enclosed in an INCLUDEONLY, the page will appear blank. They would be so coded because fractional blocks of code are nonfunctional and appear like random text to the average non-wikicoder, or would be throwing errors. Such a not-empty template would indicate there is hidden material on the page. -- 65.92.247.66 (talk) 05:38, 5 January 2024 (UTC)[reply]

Why not actually create documentation that explains what the template does? Saying that the template is not blank isn't helpful at all. Gonnym (talk) 11:42, 5 January 2024 (UTC)[reply]
Agreed. Every template should (ideally) have documentation (be it a /doc subpage or just a {{documentation}} call), because going to a "blank" subpage is a pain in the arse, especially if the function of the underlying code isn't obvious. Primefac (talk) 18:46, 11 January 2024 (UTC)[reply]
So, just leave a {{documentation missing}} instead of a {{not blank}} or {{not empty}} then -- 65.92.247.66 (talk) 22:18, 16 January 2024 (UTC)[reply]
Sure. I think there are a couple of gnomes who check transclusions of the doc missing template to attempt to fill them in. Primefac (talk) 07:52, 17 January 2024 (UTC)[reply]

Canadian elections[edit]

I need some help with some complex template coding that surpasses my ability — I already attempted a fix myself, which failed to actually produce the desired changes at all, so I need to call in the professionals.

The issue pertains to the {{Canadian election result}} framework, a series of nested templates for making election results templates in Canadian elections. While its primary purpose has traditionally been for federal and provincial elections, it's also being used on some municipal (city or town) elections, which has undesirable side-effects: specifically, because it's designed principally for parliamentary elections, it presumes and autogenerates "YYYY [Jurisdiction] election results by riding" categories, but "by riding" is completely unapplicable to municipal council elections. Those may be conducted by ward, by borough or just at large, but there's never any such thing as a "riding" in a municipal election at all.

As things currently stand, this is a problem only affecting Montreal; there are some other cities using the framework, but they're consistently using nocat=yes to suppress the illogical categories — and other cities also aren't always using that framework as consistently as Montreal is, and are sometimes using other frameworks like the generic {{MunElec}} instead. The problem in Montreal, specifically, is that there are a lot of templates involved, to the point where subbing them by year is warranted even if the "by riding" part is still undesirable, so just nocatting them all isn't the answer. Meanwhile, no other city has enough templates that by-year subcategories would be necessary at this time, though of course this may change in the future as formatting becomes more standardized.

So what I need is for that framework's category generation function to split municipal elections off to a separate category handler from provincial or federal elections, so that pages which are using municipal jurisdiction codes like MTL, TOR, OTT or VAN just produce "results" categories and not "results by riding" categories. Also, if possible, they should have the option of producing either "YYYY...results" or just undated "results", so that cities which have enough templates to support YYYY subcategories can have them while cities that don't need them can avoid them.

But again, when I tried to implement this myself, I completely failed to make the framework actually stop generating "by riding" categories on the municipal templates. So could somebody with actual skills help out? Thanks. Bearcat (talk) 20:42, 17 January 2024 (UTC)[reply]

So, as far as I can tell, it's a pretty simple fix. What you want to do is go into {{Canadian election result/top}} and alter the instances at the bottom, replacing by riding with by {{{riding_type|riding}}}. That will enable you to specify something like {{Canadian election result/top|MTL|2008|Anjou|riding_type=borough}} that should populate the category of "Montreal election results by borough". If you have a better parameter name than "riding_type", please go with it, but that's what came off the top of my head. VanIsaac, GHTV contWpWS 23:37, 17 January 2024 (UTC)[reply]
The thing is, Montreal has both boroughs and wards (it's a complicated system!), and the mayoral templates (which are just at-large, and neither "by borough" nor "by ward" are applicable at all) also have to be accounted for — and if the standardization project that's been underway lately ever gets all the way west to Vancouver, its city council doesn't have wards or boroughs at all, and just elects the entire council at large. So I want municipal election templates to be categorized as just plain "results" by nothing. Bearcat (talk) 14:39, 18 January 2024 (UTC)[reply]
{{Election table}}? Primefac (talk) 14:46, 18 January 2024 (UTC)[reply]
I haven't gone digging into the matter, so apologies if I'm speaking nonsense, but there are other election templates; if there is one not-Canada-specific but still accurate enough for the municipal elections, use that instead? Otherwise VanIsaac's suggestion seems reasonable, though I would sandbox it first just to make sure nothing breaks. Primefac (talk) 12:36, 18 January 2024 (UTC)[reply]
I'm not the one going around actually converting municipal elections templates to the Canadian election result framework, though — if I went around converting them all back to some other framework that isn't creating nonsensical "by riding" categories, the other editors who actually are doing this would just come along later and convert them back to Canadian election result again. Bearcat (talk) 20:54, 18 January 2024 (UTC)[reply]
Ah, a classic case of people only looking at the name of a template and not actually considering whether it's the right template for the job. Sounds like maybe they should be informed of that fact. Also, it might be worth possibly changing the name of the Canadian election template to indicate it should only used for national/subnational elections? Primefac (talk) 11:08, 19 January 2024 (UTC)[reply]
Or, alternatively, given how time-consuming user education can be — and the fact that no matter how many existing users get said education, some future new user who hasn't already received said education yet can come along to repeat the same error and thus start the whole cycle over from scratch — could we just, like, do what I asked for anyway so that the problem doesn't recur regardless of what else we do about it? Bearcat (talk) 18:24, 26 January 2024 (UTC)[reply]
Probably. Number 57 is pretty well-versed in election templates, pinging for opinions. Primefac (talk) 18:43, 26 January 2024 (UTC)[reply]
Perhaps a more fundamental question – why do these templates still exist? In many areas of Wikipedia, templates of this type have been largely deprecated in favour of having the information on one agreed page, and then transcluded elsewhere. Taking {{2018 Ontario general election/Ottawa West—Nepean}} as an example, it would make sense for that table to be hardcoded on Ottawa West—Nepean (provincial electoral district) and then transcluded from there to any other page where it was wanted. This avoids having a large amount of material in template space, which has a tiny number of watchers compared to article space and so is significantly more prone to unspotted vandalism. Number 57 00:48, 27 January 2024 (UTC)[reply]

Kind of excited for this, as it makes one of the most difficult templates out there into something very easy to use. {{CSS image crop}} literally requires you to do math - somewhat complicated math at that - for basic things like "making the cropped image slightly smaller" or "wanting to leave the bottom of the image in the crop".

With this one?


{{Easy CSS image crop
|Image                 = Theodore Roosevelt by the Pach Bros.jpg
|crop_left_perc        = 10
}}

... is a perfectly viable and functional way to say I want to crop 10 percent from the left of the image, using the default 220px width for the end result. And if I want to make it bigger? I could add |desired_width = 300 ...and it will scale, keeping the same crop, whereas with {{CSS image crop}} I need to apply scaling ratios to every single numerical value, and I certainly wouldnðt be able to have only one

Now, I've not put it in articles yet. (I have tested it) so this is a good time to decide if any parameters should be renamed, if anything could be simplified further, or anything else like that. But I am right in thinking this actually makes it much more useful, right?

I've made a centralised discussion over on the Village Pump Adam Cuerden (talk)Has about 8.8% of all FPs. 11:02, 31 January 2024 (UTC)[reply]

There is a requested move discussion at Template talk:User access levels#Requested move 30 January 2024 that may be of interest to members of this WikiProject. ❯❯❯ Raydann(Talk) 17:34, 7 February 2024 (UTC)[reply]

Unified table cell templates[edit]

In what sense are the templates in Category:Unified table cell templates "unified"? Can someone add some documentation to this category page? The category was created by Crissov in 2014. I thought perhaps it referred to templates with shared documentation at Template:Table cell templates/doc, but that does not appear to be the case, eg. Template:Hell no. Perhaps it refers to templates created using the instructions at Template:Table cell templates/doc § Creating new templates Daask (talk) 19:26, 14 February 2024 (UTC)[reply]

Yes, I had introduced centralized documentation and discussion back then and also did a lot of harmonization of the source code and colors used. Some templates may have deviated from that path in the past ten years, or never truly became part of the set. I have not been actively monitoring all of them, especially not newly created ones. — Christoph Päper 22:47, 14 February 2024 (UTC)[reply]
I think they are "unified" in the sense that they are all supposed to use the same syntax when they are inserted into a table. You don't have to create a new table cell for some and not others, for example. – Jonesey95 (talk) 04:25, 16 February 2024 (UTC)[reply]

Invalid detection of infinite template loop with only one level of nest[edit]

Project members may be interested in this VPT discussion concerning template loop detection. Mathglot (talk) 22:13, 22 February 2024 (UTC)[reply]

Broke template, please help restore without erasing new information[edit]

Template:Education in Lamar County, Texas BurgeoningContracting 16:40, 28 February 2024 (UTC)[reply]

 Fixed. You missed a }. Primefac (talk) 16:48, 28 February 2024 (UTC)[reply]

Discussion re buggy auto-generating short descriptions[edit]

I started a discussion at Wikipedia talk:Short description § Bug report: Template code to auto-generate short descriptions fails to work. Maybe it should have been better placed here. If anyone is familiar with "coding" inside templates, please check out the discussion. Thank you.   ▶ I am Grorp ◀ 20:31, 5 March 2024 (UTC)[reply]

Sidebar to horizontal navbox question[edit]

Hello. I have a question. Can a sidebar be turned into a horizontal navbox? If so, is there guidance about it? I noticed the sidebar in the article Chairman of the National Assembly of Vietnam is causing issues because there is a table that causes a big unsightly blank space before it. A horizontal navbox would better serve the page. Sincerely, --Thinker78 (talk) 20:08, 9 March 2024 (UTC)[reply]

The syntax is pretty similar so it's just changing one template type into another. I will note that Template:Vietnam topics already exists. I will also note that changing a sidebar into a navbox to fix a single article is not the right way to go about doing so. Primefac (talk) 20:11, 9 March 2024 (UTC)[reply]
Thank you for your reply. I don't know how such templates work, so my idea was turning the sidebar into a navbox only for the article at hand. Sincerely, Thinker78 (talk) 20:16, 9 March 2024 (UTC)[reply]

Input requested[edit]

There is a discussion that may be of your interest, at Template talk:GeoTemplate#Splitting Global/Trans-national services. Your input is welcomed. Sincerely, Thinker78 (talk) 23:15, 17 March 2024 (UTC)[reply]