Template talk:Legend
[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)
- Hmmm... it works fine for me on firefox on W2K. What goes wrong for you? Zocky | picture popups 00:13, 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)
- 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)
- 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)
[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:
- 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)
- 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)
- 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)
<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... sighs —Nightstallion (?) 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...
-
-
-
-
-
- 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" ( ) 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 ( )
* HORIZONTAL TABULATION (	)
* CARRIAGE RETURN (
)
* LINE FEED (
)
(...)
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 ;" (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)
[edit] Broken transclusion
After the change from User:BenoniBot [2] which included the interwiki links already transcluded from Legend/doc, all the interwiki links from this template were visible in article that are transcluding this template. Somehow the double-noinclusion does not work properly. I reverted the adding of the interwiki links for the moment. I don't quite find the right point to do this permanently. Can someone see to that the bot will not destroy the template again? --FordPrefect42 00:23, 19 June 2007 (UTC)
[edit] Floating
I fiddled a bit with the border setting, hoping to make it better, so that the following example looks correct, i.e. all the boxes are the same size:
But, as we can see in the example on the right, the template isn't working exactly right. The wrapped rows shouldn't extend under the colored box. At least in my Firefox on Ubuntu, the divs in captions no longer make the text progressively smaller, so we should be able to do this correctly by inserting floating divs, as in the bottom example. Does this look correct in IE? Zocky | picture popups 14:21, 24 September 2007 (UTC)
[edit] Printing
Hi -- I just observed that the color swatches produced by this template don't show up on printouts (at least, from the most recent Safari browser on Mac 10.5). Can this be fixed? I am not, unfortunately, terribly advanced in the art of template-fu. :( Love the template, though -- it's allowed some really nice improvements to a number of articles I've worked on. -Pete (talk) 23:41, 12 September 2008 (UTC)
[edit] Image
On Commons it's mentioned that this template can take an image instead of a colour. Is this possible and if so what syntax should be used. /Lokal_Profil 20:08, 5 December 2007 (UTC)
[edit] commons:Template:Legend
This template exists on the Commons too. See commons:Template:Legend. --Timeshifter (talk) 22:09, 26 September 2008 (UTC)
[edit] nbsp
Wouldn't it be better for this template to specify the width and margin using CSS properties rather than an arbitrary number of spaces? — CharlotteWebb 14:52, 4 July 2009 (UTC)
- It would, see few sections above. The original reason that we use spaces was that nested divs in captions made the text progressively smaller. This has now been fixed in css, so we should be able to change to a saner version.
- Also, I've had some ideas on how to add patterns and symbols to legends. If anyone thinks that would be useful, let me know. Zocky | picture popups 07:05, 10 August 2009 (UTC)
[edit] Alteration?
Per Wikipedia:Colours#Using_colours_in_articles "ensure that colour is not the only way used to convey important information". Therefore wouldn't it be beneficial to add a code to allow text to be entered here. So you could have for example
* Explanation Is this a useful, viable option? Rambo's Revenge (talk) 18:06, 23 October 2009 (UTC)
- I've now mocked up code and testcases with the changes I suggested. Rambo's Revenge (talk) 12:04, 25 October 2009 (UTC)
-
- I also think this is necessary. KV5 (Talk • Phils) 19:28, 28 October 2009 (UTC)
Done, Rambo's Revenge (talk) 17:51, 3 November 2009 (UTC)
- I also think this is necessary. KV5 (Talk • Phils) 19:28, 28 October 2009 (UTC)
[edit] Unknown option
{{editprotected}} Could you replace this:
<span style="border:{{{border|{{{outline|{{{1|transparent}}}}}} solid 1px}}}; background-color:{{{1|none}}}; color:{{{1|none}}};"> </span>
with this:
{{#ifeq: {{1}} | ? | <span style="border:black solid 1px;">''' ? '''</span> | <span style="border:{{{border|{{{outline|{{{1|transparent}}}}}} solid 1px}}}; background-color:{{{1|none}}}; color:{{{1|none}}};"> </span>}}
[Please check the nbsp which are shown as spaces even tho I used the nowiki tag]
This would allow you to put "?" for the first parameter when there are different colours, no clear colour, etc. So this code {{legend|?|Hello}} would produce ? Hello. ChrisDHDR 15:28, 3 November 2009 (UTC)
Not done: This seems like an over simplification of my proposal above. However you can now reach that outcome in a different way using the above (now implemented solution).{{legend||Hello|outline=black|text=?}}gives-
? Hello
- Rambo's Revenge (talk) 17:51, 3 November 2009 (UTC)
[edit] Size change of legends
This edit has increased the size of the legends distorting the structure and arrangement of the articles it is used on. See this for example. The names used to be parallel with the images but this is no longer the case. As far as I can see this change has been undertaken without any discussion and has extensive ramifications for all articles that use it. It would be better if the changes were reverted and discussed here first to see what other editors think. Betty Logan (talk) 15:32, 17 December 2010 (UTC)
- This edit was made solve ohter problems and standardize legend layout. Legends are used to indicate meaning in a map or graphic, not for using in lists. If ever there was a wrong use of {{legend}}, List of vegetarians would be it; It should never be relied upon to format an article. I welcome discussion, but a revert is premature. — Edokter • Talk — 16:22, 17 December 2010 (UTC)
- Well, I didn't add the legends to that list, but I guess if it's there editors will always find novel uses for it regardless of whether they should or not. Can the legend size be set through a parameter so that the editor can "choose" the old size, and if not can a parameter be added so the size can be set manually? Betty Logan (talk) 16:31, 17 December 2010 (UTC)
- OK, I added a size= option. Default is 100%, use a smaller percentage to shrink the box. — Edokter • Talk — 17:12, 17 December 2010 (UTC)
- Thanks for doing that, but what exactly is the option to reinstate the previous state? Putting in 10%/50%/90% doesn't seem to make much difference. Betty Logan (talk) 17:23, 17 December 2010 (UTC)
- I don't quite follow. Here's some examples:
-
This is red, normal size.
-
This is green, 80% size.
-
This is blue, 60% size.
- I think 80% comes closest to the old size. — Edokter • Talk — 17:31, 17 December 2010 (UTC)
- I think this modification is sloppy and cause lots of problems. Adding the "size" parameter is a bad decision on top of a bad decision. 80% of what? An arbitrary size. If anything it should have been a size in pizels, or points, or mm. A better way to have implemented this would have been to make the default size the same as the old size. That way articles that never used the "size" parameter would be unaffected. As it is now, thousands of articles editors will be spending time attempting to touch up this mess. This is a bad call. --NateOceanside (talk) 04:32, 22 December 2010 (UTC)
- Thanks for doing that, but what exactly is the option to reinstate the previous state? Putting in 10%/50%/90% doesn't seem to make much difference. Betty Logan (talk) 17:23, 17 December 2010 (UTC)
- OK, I added a size= option. Default is 100%, use a smaller percentage to shrink the box. — Edokter • Talk — 17:12, 17 December 2010 (UTC)
- Well, I didn't add the legends to that list, but I guess if it's there editors will always find novel uses for it regardless of whether they should or not. Can the legend size be set through a parameter so that the editor can "choose" the old size, and if not can a parameter be added so the size can be set manually? Betty Logan (talk) 16:31, 17 December 2010 (UTC)
[edit] Weird change
I remember there was no boarder and it's smaller, is it on my computer or on wikipedia? Other languages still small without boarder.
I tried looking in the history, but it's the same as now.--125.27.45.78 (talk) 07:43, 21 December 2010 (UTC)
- There have been some changes to the template which made the icons bigger. The older pages won't show any difference because the example uses the current template, not the old one. I asked Edotker to add a size parameter so the size can be controlled (see the section above this one). Betty Logan (talk) 07:58, 21 December 2010 (UTC)
[edit] CSS class
Could a CSS class be added to the output of this template, so that custom styling can be applied? Ucucha 22:51, 18 July 2011 (UTC)
- Good idea. Classes added: .legend, .legend-color and .legend.text. — Edokter (talk) — 00:57, 19 July 2011 (UTC)
[edit] CSS3 to get striping
I was trying to figure out how to get a legend with stripes, and I ran across this article: http://lea.verou.me/2010/12/checkered-stripes-other-background-patterns-with-css3-gradients/
Does Wikipedia have a policy against using CSS3 right now (since may browsers don't support it), or could we use this technique to get striped legend entries? At the very least, since striping is a common technique on maps, we need a way to designate striping in legends --Nick2253 (talk) 19:27, 6 February 2012 (UTC)