User:SteveChervitzTrutane/Sandbox/Gallery glitch

From Wikipedia, the free encyclopedia

This page demonstrates a rendering glitch I discovered in the Gallery template when an external link containing a '?' is included in the image description section of an entry. This leads to a "Warning:Unknown parameters: "??File?" message when previewing the rendered HTML, and lack of description shown for the image containing the link after saving the template.

See below for a demonstration of problem.

Gallery template rendering broken by link containing '?'[edit]

When editing this page/section and previewing it, you will see Warning:Unknown parameters: "??File?Mandelbrot sequenc" appear in red text below the gallery. After saving/canceling the preview, this warning message does not appear, and the description text of the image fails to appear as well.

Fixed by removing the offending link[edit]

Workaround: remove external links containing '?' from the Gallery[edit]

Here are the external links I wanted to include in the description section of the above image, but instead had to include outside of the Gallery due to the rendering bug:

While this works, it's not ideal for a large gallery containing many images. It would be much more convenient to be able to have the relevant links co-located with the image description.

In the case of YouTube links, the Gallery rendering issue can be avoided by using the shortened "youtu.be" version of the URL instead of the "youtube.com/watch?" version, but youtu.be links cannot be used in Wikipedia because they are globally blacklisted.

Status of this issue[edit]

  • 6/8/20: Created this page to demonstrate the bug. Reported issue on the Gallery template's talk page.
  • 6/16/20: Resolved, using tip "b" provided by Frietjes:

    the problem is the = in the URL, not the ?. this is a problem with all templates that use implicit number parameters (for example, see here for example). you can fix the problem by any of the following methods (a) change the = to {{=}}, (b) use {{URL|1=https://www.youtube.com/watch?v=56gzV0od6DU|2=Mandelbrot history}}, (c) use {{cite web|url=https://www.youtube.com/watch?v=56gzV0od6DU|title=Mandelbrot history}}, (d) explicitly number the parameters passed to {{gallery}} (not recommended). luckily, these errors are tracked in a tracking category for repair.