Template talk:Portal box placard

Latest comment: 2 years ago by Jonesey95 in topic Bogus empty file option
WikiProject iconPortals  
WikiProject iconThis page is within the scope of WikiProject Portals, a collaborative effort to improve portals on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Template This template does not require a rating on the project's quality scale.
Note icon
See also: List of Portals

Bogus empty file option edit

Hecato: Based on Template:Portal box placard/doc, it seems that when the res-width parameter is omitted, the template generates an empty image option, which is a bogus image options lint error. Special:ExpandTemplates shows that

{{Portal box placard|1=File:Catalonia 2016 Zout Fotografie (196 van 196) (32589506286) crop.jpg|caption=test caption}}

expands to

<templatestyles src="Portal box placard/styles.css"/>
<div class=box-placard>
[[File:Catalonia 2016 Zout Fotografie (196 van 196) (32589506286) crop.jpg||test caption]]
</div>

and the the empty image option just before "test caption" needs to be fixed. —Anomalocaris (talk) 22:57, 18 November 2019 (UTC)Reply

Hecato: How did your efforts turn out? The problem seems to be escaping the pipe character for one round of parsing, so it can work as a pipe for the next round of processing. Maybe this is beyond the limits of the tools in our toolbox. Have you given up completely? —Anomalocaris (talk) 21:49, 20 April 2021 (UTC)Reply
Jonesey95: Looks like you struggled with this also. How to make a pipe escaped for the purposes of processing within the if-logic of this template, but real for the purposes of the file markup output by this template: is there a way to do that? —Anomalocaris (talk) 00:24, 21 April 2021 (UTC)Reply
It looks like I tried my usual method but reverted it because it didn't work for some reason. The easiest thing to do is probably to provide a default res-width, e.g. 500px, after the pipe inside the template variable, like {{{res-width|500px}}}. – Jonesey95 (talk) 01:55, 21 April 2021 (UTC)Reply
Jonesey95: I did what you said and it didn't solve the problem, so I did something slightly different that seems to work. Take a look! —Anomalocaris (talk) 18:39, 27 June 2021 (UTC)Reply
Looks good to me. Thanks for your diligence. – Jonesey95 (talk) 02:41, 28 June 2021 (UTC)Reply