Jump to content

Template talk:Chembox

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Template-protected edit request on 12 January 2025

[edit]

Please, replace the current content of Template:Chembox image cell to the following:

| colspan="2" style="text-align:center; padding:2px;" | {{#invoke:InfoboxImage|InfoboxImage
|center=yes <!-- when center=yes, it is rendered with the <picture> html tag instead of <span> it is important so the CSS is applied correctly -->
|image={{{par_file}}}
|size={{{par_size}}}
|sizedefault=220px
|alt={{{par_alt}}}
|title={{{par_title}}}
|class={{{par_class}}}}}{{#if:{{{par_caption|}}}|<div style="text-align:center;">{{{par_caption|}}}</div>}}
|-<noinclude>{{documentation}}</noinclude>

Explanation: The current CSS styling for dark mode selects for "figure:not(...)...", so it was currently working only for some images in the Chembox. The code above makes it work nice as intended.

Diff

Testcase examples: Template:Chembox/testcases7images#Dark mode tests

Thanks! -- Arthurfragoso (talk) 22:41, 12 January 2025 (UTC)[reply]

 DoneArthurfragoso (talk) 17:56, 14 January 2025 (UTC)[reply]

linking "IUPAC Names" parameter to pages

[edit]

I noticed the parameter "IUPAC Name" links to different pages depending on the template/page. Many link to IUPAC nomenclature of chemistry, a stub article which I think should be merged/redirected to International Union of Pure and Applied Chemistry. Some link to chemical nomenclature, which works but I feel like International Union of Pure and Applied Chemistry is better. Is there a reason for the inconsistent linking? Adding to that, if International Union of Pure and Applied Chemistry isn't the right page to link to, wouldn't IUPAC nomenclature of inorganic chemistry and IUPAC nomenclature of organic chemistry be the best options, depending on the molecule? Niodium (talk) 01:48, 4 February 2025 (UTC)[reply]

Never mind, I think I misunderstood the point of the pages being linked to. Niodium (talk) 05:35, 4 February 2025 (UTC)[reply]

Local-image parser bug

[edit]

{{Chembox}} categorizes an article in Category:Chemical pages containing a local image if |ImageFile= (or similar field) is an image that is on the local wiki rather than on commons. However, Curium(III) chloride contains the local File:Curium(III) chloride.jpg but is not in the local-image category. It looks like a general bug when the filename contains a parenthesis: switching in other random enwiki images to that article sets the cat, and other chembox articles containing local images with parens does not set the cat. DMacks (talk) 16:48, 10 February 2025 (UTC)[reply]

Bug is in {{ParmPart}}, where {{#titleparts}} doesn't like some URL-encoded strings. It's a documented WP:NCTECHNICAL#Other problematic characters limitation of that parser function. Given we can't be sure how a filename will be passed, we should probably switch to {{string split}} instead of #titleparts or maybe just {{in string}} instead of ParmPart. DMacks (talk) 16:55, 10 February 2025 (UTC)[reply]