Template talk:Legend

From Wikipedia, the free encyclopedia

Contents

[edit] Image descriptions below thumbnails

This template does not work for me when used in image descriptions below thumbnails. Any idea why? —Nightstallion (?) 20:55, 7 January 2006 (UTC)

Seems to work for me. Do you have an example? Zocky 19:10, 12 January 2006 (UTC)
Erm... Pick any map, e.g. Treaty of Accession 2005 – doesn't work for me in Firefox, neither in WinXP nor in NetBSD nor in MacOS X. Works fine in IE, though, and I frankly just don't know why... —Nightstallion (?) 22:43, 15 January 2006 (UTC)
Hmmm... it works fine for me on firefox on W2K. What goes wrong for you? Zocky | picture popups 00:13, 16 January 2006 (UTC)
Well, the little boxes that should show up next to the text (in the example I linked to, the mint green and light green boxes to the left of "ratified" and "not yet ratified") don't show up at all. There's space there where they should be, but the boxes don't show up. scratches head Any idea what the problem might be? Or if not, any idea which other user and/or developer is likely to know? Thanks either way! —Nightstallion (?) 06:52, 16 January 2006 (UTC)
For the record, it works fine for me in image descriptions such as the one linked to below; just not below thumbnails. —Nightstallion (?) 11:44, 16 January 2006 (UTC)
Colors don't work here at all. There're just the 1px gray borders forming a thin rectangle, then the text. Firefox (Ubuntu) here. I can send you a screenshot, if necessary. --Hdante 00:07, 20 January 2006 (UTC)
However, if I change the " "s to some text, say "blarg", then the text appears, with a correct background. --Hdante 00:14, 20 January 2006 (UTC)
Changed one " " to a " " and it started working. THIS MAY BE A BUG in Firefox. Mozilla should be contacted, but I won't do this, since they don't seem to answer normal people. --Hdante 00:35, 20 January 2006 (UTC)

[edit] Larger version?

The size looks great for being placed inside articles, as part of the image frame. Would it be possible to have a facility to have a larger version of this, either with this template, or a twin, for the purpose of adding a legend to an Image: page? For example, see the original legend and compare with it changed to use {{legend}} at Image:Mississippi Delta Lobes.jpg. --Interiot 11:28, 16 January 2006 (UTC)

[edit] Template doesn't work (was:Subst?)

Should this be substed? on first take I'd say yes, but I'd like to hear what others think. It doesn't seem this style is likely to change therefore it doesn't need to be dynamic like some other templates. It's also too much code to remember and therefore would make it convenient to be in template form. Comments? gren グレン ? 07:18, 20 January 2006 (UTC)

It certainly should not be substed until it works for all widely used browsers. —Nightstallion (?) 07:55, 20 January 2006 (UTC)
It should be working now (with a hack, at least). However, the template must be reloaded. Try going on that page you pointed out, click on edit, then preview. --Hdante 09:30, 20 January 2006 (UTC)
Still doesn't work for me. I tried recaching the page, recaching the template, touching (blank-editting) the page, ... no success. —Nightstallion (?) 09:44, 20 January 2006 (UTC)
Changed the whitespace to a right arrow (■). Even if you don't have this glyph, you browser should draw something else (I hope). Try loading Treaty of Accession 2005 again. If this doesn't work, then I would ask you to post here the raw html page, as loaded by firefox (or wget, maybe). --Hdante 10:14, 20 January 2006 (UTC)
Well, yes, I get the right arrow, but no colour around it. —Nightstallion (?) 10:43, 20 January 2006 (UTC)
The relevant source:

<div class="thumb tright"> <div style="width:322px;"><a href="/wiki/Image:Accession2007.png" class="internal" title="Ratification status: ► ratified ► not yet ratified "><img src="http://upload.wikimedia.org/wikipedia/en/thumb/2/25/Accession2007.png/320px-Accession2007.png" alt="Ratification status: ► ratified ► not yet ratified " width="320" height="209" longdesc="/wiki/Image:Accession2007.png" /></a> <div class="thumbcaption"> <div class="magnify" style="float:right"><a href="/wiki/Image:Accession2007.png" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div> Ratification status: <p style="border:none;background:none;text-align:left;font-size:90%!important;margin:0px!important"><span style="border:solid 1px silver; background-color:#0f0;font-size:80%!important;vertical-align:middle;">►</span> ratified</p> <p style="border:none;background:none;text-align:left;font-size:90%!important;margin:0px!important"><span style="border:solid 1px silver; background-color:#9ddea5;font-size:80%!important;vertical-align:middle;">►</span> not yet ratified</p> </div> </div> </div>

Nightstallion (?) 10:51, 20 January 2006 (UTC)

I'm sorry but I can't help you any further. There's no reason for Firefox to be ignoring the 'span' tag. The only thing that comes to my mind is that you should check if the 'always use my colors' option is set. Another work-around would be using the arrow, or a full box, like , and setting the text color, instead of the background color. --Hdante 11:29, 20 January 2006 (UTC)
The really strange thing is that it works in the examples on Template:Legend, but not in the thumbnail descriptions... sighsNightstallion (?) 11:43, 20 January 2006 (UTC)
For the record everything's fine for me in FF on XP and Linux. Anyway, Nightstalion does something simple like show up ok for you? T/wangi 12:59, 20 January 2006 (UTC)
Strange... Yes, that does work. Although we would also have to check whether that code works in thumbnail descriptions...
█ test
test
Yeah, that does work. —Nightstallion (?) 13:07, 20 January 2006 (UTC)
Hello. I'm changing the template so that it uses a full box, instead of a space. That's a rather bad solution, since white space is much more universal than the full box. However, this may be good, because more people will become aware of the issue, if the problem happens to them :-). --Hdante 03:27, 21 January 2006 (UTC)
It works now... Great work! Thanks! —Nightstallion (?) 10:26, 21 January 2006 (UTC)
Hello, again. Will you test this page, please ? The german template uses a '0', painted both in foreground and background with the same color. Their template is pretty simple. Thanks.
Bad news here. There're some pages that were screwed, like Austria-Hungary --Hdante 04:38, 21 January 2006 (UTC)

[edit] Re:Subst?

Should this be substed? on first take I'd say yes, but I'd like to hear what others think. It doesn't seem this style is likely to change therefore it doesn't need to be dynamic like some other templates. It's also too much code to remember and therefore would make it convenient to be in template form. Comments? gren グレン ? 07:18, 20 January 2006 (UTC)

Definitely not. It becomes unreadable and bulky if it's substed. Aris Katsaris 14:10, 27 January 2006 (UTC)
Yeah, why not. —Nightstallion (?) 10:28, 21 January 2006 (UTC)
I think it's a lot more readable and maintainable for most people if it's left unsubsted. Also, per Brion's comments, we don't really need to overboard with the substing. --Interiot 11:13, 21 January 2006 (UTC)

[edit] Template and Firefox (final)

Hello. I think I have a conclusion about Firefox not correctly rendering this template. The unchanged version (id 35788705) used two "em spaces" (&emsp;) filled with the desired background color. The expected output was a little box with a customized color and border. There were two problems: mine was that the spaces inside the border didn't appear, so that there were just the borders with a zero area inside (it appeared like a thin gray '|'). Nightstallion's was that neither the inside nor the borders of the box appeared, if it was inserted inside an image box. I didn't really understand Nighstallion bug, it seemed that the 'span' tag was being ignored as if the browser didn't recognize the attribute specification (it seems to be possible for the browser to ignore, say, an invalid font or color, but I couldn't reproduce that specific problem). On the other hand, I've found some text about the XHTML specification listing which characters are considered whitespaces:

 (...)
 White space is handled according to the following rules. The following
 characters are defined in [XML] white space characters:

    * SPACE (&#x0020;)
    * HORIZONTAL TABULATION (&#x0009;)
    * CARRIAGE RETURN (&#x000D;)
    * LINE FEED (&#x000A;)
 (...)
 C.15. White Space Characters in HTML vs. XML

 Some characters that are legal in HTML documents, are illegal in XML
 document. For example, in HTML, the Formfeed character (U+000C) is treated
 as white space, in XHTML, due to XML's definition of characters, it is illegal.

Those whitespace characters are typically compressed so as to keep just a single space between words and to remove the leading and trailing spaces. And that's what Firefox seemed to be doing here — it was most likely treating emspaces as white spaces and compressing them (if I remember well, wget downloaded the page with two emspaces, while Firefox 'view source' showed the page with no space at all). Again, I still think that this is a BUG IN FIREFOX. That's so, because:

  • Zocky and Nightstallion were able to render the box in Internet Explorer
  • I was able to render the box in Konqueror
  • I was able to render the box in Firefox 1.5, which I've just downloaded

Since I believe that this is a Firefox bug, I see no reason why we shouldn't revert back to the original box or, for the sake of current Firefox users, use a combination of, say, emspace and nbspace so that the old bugged Firefox isn't able to compress them. As for Nightstallion, I can only ask that he update his browser and try again.

My browser is up-to-date, I'm afraid. —Nightstallion (?) 19:17, 22 January 2006 (UTC)

The Firefox bug may be stated in the template main page. I'm using Firefox 1.0.7-0ubuntu20 (breezy).

As for the variable sized box. We can disscuss them here, since I can see the boxes now :-).

   Africa

   America

   Oceania

   Europa

   Asia

--Hdante 22:48, 21 January 2006 (UTC)

Well, much better than that, here is the actual code pointed out by Interiot.
 
Salé-Cypremort   4600 years BP
 
Cocodrie 4600-3500 years BP
 
Teche 3500-2800 years BP
 
St. Bernard 2800-1000 years BP
 
Lafourche 1000-300 years BP
 
Plaquemine 750-500 years BP
 
Balize 550 years

--Hdante 22:53, 21 January 2006 (UTC)

[edit] Next attempt

Does using █ work for everyone, or are there issues with this? It shows up perfectly for me now. —Nightstallion (?) 10:40, 26 January 2006 (UTC)

Seems to work fine, provided that the template is used exactly as instructed. It's whitespace problems again, but different from what was noticed before. Many people like adding extra spaces around separators, which breaks this template for some. Example:      {{legend|#f00|used as instructed}}       {{ legend | #f00 | used with spaces }} MediaWiki translates trailing whitespace in template parameters to HTML character entities. Here the CSS property in the second test is given to the browser as "color: #f00&#160;;" (where 160 is the same as nbsp). IE parses this incorrect value and shows what may have been intended, but Firefox goes by the specs and ends up with a meaningless value, rendering it black. I'm not sure if this is really a MediaWiki problem, maybe leading or trailing whitespace is actually necessary somewhere, and all templates where parameters are directly used for CSS should be accompanied with a note to drop the spaces. --para 21:00, 19 April 2006 (UTC)

[edit] Striped colours?

hi, i made this pic Image:World map hdtv standard 50hz 60hz.svg and want to use this fine legend templete. but i used a pattern with blue and red stripes in it, so i can not directly use this template. so it is possible to use mulitcolour or shaped boxes for the legend or could please somebody add this feature? greets, --Andreas -horn- Hornig 10:41, 1 August 2006 (UTC)

[edit] tooltips: colors don't work

Since tooltips (at least in Mozilla FF 1.5) do not show colors, the tooltips for images using this template are useless. For one example, see Driving on the left or right; the tooltip for the top image (the map) has two black boxes... not very useful. Any way to fix this? -Grick(talk to me!) 00:00, 13 August 2006 (UTC)

I understand it'd be good that the tooltips included the legends... But to be honest what's the real issue? The tooltip is duplicating the text which is used to annotate the image under the thumbnail - therefor it's already displayed correctly on the page. Regardless I think we're stuck with a browser limitation here. Thanks/wangi 00:12, 13 August 2006 (UTC)
I... don't think there's any remotely easy way to fix this, no. Even if it were, and it required very much finagling at all, I'd say it's not worth it. Besides the point that wangi brought up, that alt-text is typically primarily meant to be used when the image isn't displayed, and if the image isn't displayed, then what's the point of explaining to the user what the exact colors used in that image are? --Interiot 09:20, 13 August 2006 (UTC)

[edit] images?

Documentation says:

color is passed to the css background property, so it can also include images. The optional border argument is passed to the css border property.

first looking the code this is not what code does + as much I have tested, searched, CSS background-image is one thing that doesn't work in page code, so the second part of the text is misleading. Or can somebody expalin opposite? --TarmoK 09:34, 29 October 2006 (UTC)

No, I think it's pretty clear that background-image doesn't work anywhere on this specific wiki at least. It's possible it would work on other MediaWiki wikis, but not this one. --Interiot 18:59, 29 October 2006 (UTC)
I fixed the documentation to reflect that. Zocky | picture popups 03:09, 7 November 2006 (UTC)

[edit] Non block element

I've recently created a version of this template which does not force a block element / new line after it's use, see: {{legend2}}. It would be good if this functionality could be incorporated here so we could avoid a fork - is it doable? Thanks/wangi 00:35, 28 January 2007 (UTC)

[edit] Version that doesn't mess with font size?

This template is used here[1], but I think it would look better if a legend template that didn't modify the font size was used. The text becomes too small because it is nested within two templates, both which tries to modify font size. —Tokek 14:03, 3 February 2007 (UTC)