Template talk:Tall image

Latest comment: 2 years ago by Anomalocaris in topic Optional?

Optional?

edit
In standard tuning, the C-major chord has three shapes because of the irregular major-third between the G- and B-strings.

The template documentation currently says that "The image width option is optional" and that "The box height option is optional". However, if one leaves them out an error message (<div class="thumb tright" style="width:Expression error: Unrecognised word "in".px;">) displays and the image displays quite large on the left of the page without a caption. If one leaves them blank there is no error message but the image displays even larger to the extreme right. As such it would seem that the "options" are not optional. Hyacinth (talk) 23:38, 4 September 2012 (UTC)Reply

Left out

edit
In standard tuning, the C-major chord has three shapes because of the irregular major-third between the G- and B-strings.

Left blank

edit
Extended content
In standard tuning, the C-major chord has three shapes because of the irregular major-third between the G- and B-strings.

— Preceding unsigned comment added by Hyacinth (talkcontribs) 23:38, 4 September 2012 (UTC)Reply

Candido, Andrybak, TheDJ: It's still messed up almost 10 years after User:Hyacinth's comment. The example under "Left out" generates this markup:

<div class="thumb  tright" style="width:<strong class="error">Expression error: Unrecognized word "in".</strong>px;">
<div class="thumbinner"><div class="overflowbugy" style="height:500px;overflow:auto;">[[File:Standard diagonal shifting of C major chord.png|In standard tuning, the C-major chord has three shapes because of the irregular major-third between the G- and B-strings.px|alt=A C major chord is shifted down the fretboard of a six-string guitar tuned in standard tuning E-A-D-G-B-E. The diagram shows the three shapes of the chord, a multiplicity caused by the irregular major-third interval interrupting the perfect-fourth intervals.|Use the scrollbar to see the full image.]]
</div>
</div></div>

This is all messed up.

  • "Use the scrollbar to see the full image" doesn't belong
  • it would be better if the caption parameter were last.
  • etc.

Anomalocaris (talk) 06:34, 29 March 2022 (UTC)Reply

@Anomalocaris: when leaving out positional optional parameters, you need to specify the position of later positional parameters explicitly:
{{Tall image|Standard diagonal shifting of C major chord.png|alt=Test alt|4=Note that 4 equals in wikitext}}
Note that 4 equals in wikitext
I hope this helps. —⁠andrybak (talk) 10:52, 29 March 2022 (UTC)Reply
To illustrate the difference between "leaving out" and "blank" parameters, an example with Template:3x, which repeats its first parameter three times:
Leave out:
aaa{{3x}}aaa

aaa{{{1}}}{{{1}}}{{{1}}}aaa
Blank:
bbb{{3x|}}bbb

bbbbbb
—⁠andrybak (talk) —⁠andrybak (talk) 14:07, 29 March 2022 (UTC)Reply
andrybak: OK. You're saying that the errors in Hyacinth's examples are because of the missing 4=. But your example,
{{Tall image|Standard diagonal shifting of C major chord.png|alt=Test alt|4=Note that 4 equals in wikitext}}
produces a missing end tag and stripped tag for <div>...</div>. So, either there is some additional change required in the markup, or the template doesn't work as intended. And it would be great if the template failed more gracefully, so that Hyacinth's examples generate clean error messages instead of lint errors. —Anomalocaris (talk) 20:38, 29 March 2022 (UTC)Reply
Anomalocaris, I'm not sure what you mean by missing end tag and stripped tag for <div>...</div>. I've tried checking template transclusion
{{Tall image|Standard diagonal shifting of C major chord.png|alt=Test alt|4=Note that 4 equals in wikitext}}
on Special:ExpandTemplates and it seems to produce proper wikitext with balanced HTML tags. Empty <nowiki> </nowiki> inside of attribute "class" of the outermost <div> is confusing, but shouldn't cause any issues. —⁠andrybak (talk) 20:54, 29 March 2022 (UTC)Reply

andrybak: You are correct that the markup line in question does not produce lint errors, but it does produce a missing end tag and stripped tag for <div>...</div> when preceded by a colon, which is what I saw here and that explains my previous message. Now let's do Hyacinth's Left out example, but inserting the missing 4=:

In standard tuning, the C-major chord has three shapes because of the irregular major-third between the G- and B-strings.

With 4=, there are no lint errors and the display is reasonable. What's left to do is to improve the template to generate clean error messages in case of bollixed parameters. —Anomalocaris (talk) 23:18, 29 March 2022 (UTC)Reply