Jump to content

Template talk:Infobox/Archive 3

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 1Archive 2Archive 3Archive 4Archive 5Archive 10

I'd welcome any input on a discussion about whether a website entry in an infobox should display the URL itself or a link-title such as "official website". DMacks (talk) 02:49, 3 February 2009 (UTC)

How can we add External links like this template (Template:Infobox Television)? I'm making a infobox but i couldn't add External links like as Infobox Television?--Hedda Gabler (talk) 10:47, 3 February 2009 (UTC)

Alternate row colorig

{{Infobox VG}} colors alternate rows with a darker shade. It would be a good idea to migrate that code into this template. SharkD (talk) 05:30, 14 February 2009 (UTC)

I disagree, it shouldn't be forced, many infoboxes has wrapped lines, so it would make it look unsymmetrical. It might instead be Infobox VG that should convert, at least use {{infobox}} as it's base? and isn't alternate colouring already possible to use in this template? Plus it is so widely used in multiple templates which might "break" them — CHANDLER#1009:14, 14 February 2009 (UTC)
It's not meant to look "symmetrical"; it's meant to allow readers to more easily distinguish between lines. {{Navbox}} already does this to great effect. It's trivial to migrate the VG infobox to {{infobox}}, but it'd be even better if nothing would be lost in that transition. I'm going to look into implementing this in {{infobox3cols}}, my current fork of {{infobox}}. Chris Cunningham (not at work) - talk 10:50, 14 February 2009 (UTC)

References in labels

I was helping another editor fix a template using {{infobox}} that used references in the labels and have run across an interesting issue.

As a test case, I have created {{Template talk:Infobox/Test2}}, a simple infobox coded as:

{{Infobox
|name         = Template talk:Infobox/Test1
|title        = Template talk:Infobox/Test1

|label1   = Label1 <ref>Reference 1</ref>
|data1    = {{{data1|}}}

|label2   = Label2 <ref>Reference 2</ref>
|data2    = {{{data2|}}}

|label3   = Label3 <ref>Reference 3</ref>
|data3    = {{{data3|}}}

|label4   = Label4 <ref>Reference 4</ref>
|data4    = {{{data4|}}}
}

If we invoke this template using some of the labels, we get:

Template talk:Infobox/Test1
Label2 [1]data2
Label4 [2]data4

Now, you would think that because the label1 and label2 are suppressed that the associated references would be suppressed. But looking at the infobox, you will see that the reference links show [2] and [4], not [1] and [2] as expected. If we invoke the <references /> tag, all of the references show:

  1. ^ Reference 2
  2. ^ Reference 4

I did figure out a workaround by making the labels conditional. From test case {{Template talk:Infobox/Test2}}:

{{Infobox
|name         = Template talk:Infobox/Test2
|title        = Template talk:Infobox/Test2

|label1   =  {{#if: {{{data1|}}} |Label1 <ref>Reference 1</ref>}}
|data1    = {{{data1|}}}

|label2   = {{#if: {{{data2|}}} |Label2 <ref>Reference 2</ref>}}
|data2    = {{{data2|}}}

|label3   = {{#if: {{{data3|}}} |Label3 <ref>Reference 3</ref>}}
|data3    = {{{data3|}}}

|label4   = {{#if: {{{data4|}}} |Label4 <ref>Reference 4</ref>}}
|data4    = {{{data4|}}}
}}
Template talk:Infobox/Test2
Label2 [1]data2
Label4 [2]data4

Now the references show only the ones with defined data tags:

  1. ^ Reference 2
  2. ^ Reference 4

I have not dug into the infobox code, so I don't know if this is a bug or a feature. I don't know if it should be fixed or documented. --—— Gadget850 (Ed) talk - 15:07, 26 February 2009 (UTC)

Request for new fields

I am working on a replacement for {{Infobox Protected area}} and two additional fields are necessary to make things work.

{{#if:{{{subheader2|}}}|<tr><td colspan="2" class="{{{subheader2class|}}}" style="text-align:center; {{{subheader2style|}}}">{{{subheader2}}}</td></tr>}}

and

{{#if:{{{image2|}}}|<tr><td colspan="2" class="{{{image2class|}}}" style="text-align:center; {{{image2style|}}}"> {{{image2}}} {{#if:{{{caption2|}}}|<br />
<span style="{{{captionstyle|}}}">{{{caption2}}}</span> }}</td></tr>}}

There is sandbox version at User:Droll/infobox. The new template that depends on it is at User:Droll/template sandbox and a test page is at User:Droll/tests. I see that a similar request was denied above. I don't think there is any controversy about the code as its is just a copy of already existing fields. The names I don't care about. "subsubheader" would be a bit strange. There a number of existing infoboxes that use both an photo (image) and a map (image). There are also a couple of infoboxes that use a banner type sub-header as my example does. Thanks for your consideration. --DRoll (talk) 11:17, 7 March 2009 (UTC)

Any comments would be greatly appropriated. I can do a kludge in the new template but that would defeat the purpose of the meta-template. The changes will not effect complexity, will be transparent and not break any existing templates. --DRoll (talk) 01:34, 9 March 2009 (UTC)

Not done for now: It looks okay to me, but I'm not familiar with this template, so I'd prefer to wait a day or two to see if there are any comments or concerns. — Martin (MSGJ · talk) 10:35, 9 March 2009 (UTC)
 Not done As {{{image}}} is an open parameter, it is pretty trivial to pass two images seperated by a
. Creating an image2 parameter seems overkill for the handfull of template that would actually use it. EdokterTalk 16:45, 9 March 2009 (UTC)

One way to do it might be using the system this infobox does {{Infobox Information appliance}}, using the above as a second image. Either use above, or data1 would probably do as well. chandler · 23:03, 9 March 2009 (UTC)


Now that the edit has been denied I would like to ask for input on a better solution. Edokter is correct that the image field is open and anything can be inserted using the one field. When I studied for my CS degree we did an exercise where an entire program was written as the parameters on one c language function. It can be done but anyone who did that on a commercial project they would loss their job. Two of the goals of good coding is that it should be well documented and easy to maintain. My request helps achieve these goals. Please share your creative suggestions. --droll [chat] 01:10, 10 March 2009 (UTC)

And importantly, I'm pretty sure that WP:ACCESS frowns on the use of line breaks to make one table cell do two things. We shouldn't be encouraging it. Chris Cunningham (not at work) - talk 08:56, 10 March 2009 (UTC)
Well again, I think my solution would work pretty easy... the {{{image}}} is basicly just a data, compare the two codes (the header1 and labal1/data1 option stripped).
-->{{#if:{{{image|}}}|<tr><td colspan="2" class="{{{imageclass|}}}" style="text-align:center; {{{imagestyle|}}}"> {{{image}}} {{#if:{{{caption|}}}|<br />
<span style="{{{captionstyle|}}}">{{{caption}}}</span> }}</td></tr>}}

-->{{#if:{{{data1|}}}|<tr><td colspan="2" class="{{{class1|}}}" style="text-align:center; {{{datastyle|}}}">{{{data1|}}}</td></tr>}} }} }}<!--

So what I would do is, {{infobox | image = {{{image|}} | caption = {{{caption|}}} | data1 = {{{image2|}}} {{#if:{{{caption2|}}}|<br /><span style="{{{captionstyle2|}}}">{{{caption2}}}</span> }} etc... wouldn't be too hard? chandler · 09:06, 10 March 2009 (UTC)

I'm not seeing the arguments against having an additional parameter. — Martin (MSGJ · talk) 13:26, 10 March 2009 (UTC)
It's not needed, as in a infobox that uses this template as its base you can make up your own stuff, like a second image. chandler · 13:39, 10 March 2009 (UTC)
In refernece to the proposed compromise, please correct me if I am mistaken, it seems to me, without doing a test, that given two fields, photo and map, where photo is the first image and map is the second image that the map will not display unless the photo field is occupied. This is not trivial because the photo is a simple image while the map is generated by a template such as {{superimpose}} or {{Location map}}. See User:Droll/tests#Test of images only which depends on a modified version of Infobox at User:Droll/infobox. It is still possible to kludge even this but it would not be advisable in my opinion. One of the reasons I decided to use {{infobox}} was because each field provides optional style and class fields. These are meant to apply to only one Infobox component. Using kludges defeats the purpose of the even having such a meta-template in my opinion. A lack of adequate fields encourages users to go off and do there own thing. Consistency of appearance across articles and projects should be of paramount concern. A competing meta-template, {{Geobox}}, has been rejected through consensus by WikiProject Mountains, for which I have edited, extensively because it was thought to difficult to understand and maintain. That project has over 6,000 articles. By not listening to it user base this template could also meet the same fate. I think that meta-templates should be thought of as part of and API for template coders. It should remain backward compatible but should provide new functionality as demand dictates.
Concerning the request of an additional subheader field please see {{Infobox nrhp}} which would require more than one additional subheader field. Perhaps it would be best to concentrate on the image request at present however. --droll [chat] 23:42, 10 March 2009 (UTC)

OK, I got frustrated. I think I waited long enought for meaningful help. I created {{infobox2}} that depends on this template but provides additional fields. I don't believe this is the correct thing to do but it avoids the hurtles that I meet here. --droll [chat] 07:04, 11 March 2009 (UTC)

I gave you the easy way to implement it without creating a new template... so why did you have to go create a new one? chandler · 02:10, 12 March 2009 (UTC)
I used something very like your suggested solution in {{Infobox2}}. I wanted a meta-template that I could use across a number of projects. This way there is one place where the kludge happens and not in a number of places. I wanted a meta-template that would work for the general case. I would be glad if {{Infobox2}} and {{Infobox}} could be merged but it is not necessary. Thank for your suggestion. I was very useful to me. --droll [chat] 02:49, 12 March 2009 (UTC)
I propose we merge the two, and include additional fields in this template. Even if they are not strictly necessary, they may simplify the syntax for infobox coders and make their life easier. Droll, are you still watching this? Could we get a sandbox version with the additional fields you suggested? — Martin (MSGJ · talk) 14:30, 20 May 2009 (UTC)

Bug if data is a bulleted list

foo* bar1
  • bar2
  • bar3

If a data* field contains a bulleted list, the first item is mis-formatted...the asterisk is treated as an asterisk rather than wiki-markup for a list item. Adding whitespace or newlines doesn't help. However, putting some dummy text (even if just HTML newline or space character) works. Apparently the first non-blank (in a wiki source sense) of the data* field is placed in-line with...something...so an asterisk isn't the first character in the substituted output and therefore isn't treated as a list item.

foo
  • bar1
  • bar2
  • bar3
foo
  • bar1
  • bar2
  • bar3
foo
  • bar1
  • bar2
  • bar3
foohere we go
  • bar1
  • bar2
  • bar3
foo 
  • bar1
  • bar2
  • bar3
{{Infobox
|label1=foo
|data1=
* bar1
* bar2
* bar3
|label2=foo
|data2=


* bar1
* bar2
* bar3
|label3=foo
|data3=
<br>
* bar1
* bar2
* bar3
|label4=foo
|data4=here we go
* bar1
* bar2
* bar3
|label5=foo
|data5= 
* bar1
* bar2
* bar3
}}

NB: I've subst:'ed the first example in the text to clarify what I see now, but left the later longer demonstration of various ideas dynamic so that fixes can be observed to work. DMacks (talk) 19:12, 14 March 2009 (UTC)

foo

  • bar1
  • bar2
  • bar3
bar
Even though it's a little cheat, that doesn't give the 100% correct effect if you go:
|data1=<nowiki/>
* bar1
* bar2
It sort of works, but for me looks like a small space is created at the top, as can be seen if you compare in my example chandler · 19:27, 14 March 2009 (UTC)

Must be something to do with parsing the wikimarkup for an unordered list; the HTML markup works:

{{infobox
|label1=foo
|data1=<ul><li>bar1
<li>bar2
<li>bar3</ul>
}}
foo
  • bar1
  • bar2
  • bar3

--—— Gadget850 (Ed) talk - 20:32, 14 March 2009 (UTC)

The code for each field is laced with several spaces that can cause the problem as seen above. A possible fix would be to remove those spaces, or start every data field on a new line, so that * will be the first character. Time for some sandbox testing. EdokterTalk 00:06, 15 March 2009 (UTC)
I seems to not be a bug attributable to this template but a more general wikitext feature: --droll [chat] 07:10, 16 March 2009 (UTC)
* bar1
  • bar2
  • bar3
<table class="infobox" cellspacing="5" style="width: 22em; text-align: left; font-size: 88%; line-height: 1.5em;">
<tr><td>* bar1
* bar2
* bar3
</td></tr>
</table>

The slight drop is in the nature of both wiki and HTML unordered lists. Note:

foo

  • bar
  • bar

--droll [chat] 07:36, 16 March 2009 (UTC)

Why HTML instead of Wikitables?

Why does this template use HTML markup (<tr><th></th><td></td></tr>, etc.) for each row instead of Wikitable syntax? Both systems render the same thing, and Wikitables are much easier to understand for the average user. Also, if some text is added to one of the data rows that includes wikitable syntax (not HTML as in this code), it doesn't render correctly. I think this template should be converted to use all wikisyntax.. that is, in fact, what the syntax was created for, isn't it? --Dudemanfellabra (talk) 21:43, 23 March 2009 (UTC)

It uses HTML to avoid limitations that is inherit in wikitables. Most notably, it conflicts with pipes (|) used in parser functions. EdokterTalk 00:06, 24 March 2009 (UTC)
Is that not what the {{!}} template is for? Look at the coding of {{Infobox nrhp}}; there is no HTML in there whatsoever (other than styling and stuff like that... which is actually CSS).. all wikisyntax. The code is segmented and easy to understand in my opinion.. at least more so than this template's coding. --Dudemanfellabra (talk) 00:19, 24 March 2009 (UTC)
Even then, coding a template that way is more complicated then using HTML, and {{!}} is not without limitations, especially with nested tables or parser functions. Plus templates that are used on a lot of pages should not depend on other (small) templates if it can be avoided. EdokterTalk 14:31, 24 March 2009 (UTC)

In my opinion there is no inherent advantage to using wiki markup over HTML. The only people who have to understand the HTML are the people who maintain the template. There should be no reason a casual editor should need to examine the code other than curiosity. It should be for the most part a black box. The documentation should disclose everything a user needs to know.

If the question is about wiki markup not render correctly, I think more research needs to be done. Show me an example on my chat page and we can test it. I think you would have the same results if this template where coded in wiki markup but I'm will to prove it. If you would like I would be glad to work with you. This question has come up before and should be put to rest once and for all. I'm really interested in identifing a problem if one exists. --droll [chat] 23:47, 27 March 2009 (UTC)

Houston, we have a problem?

it seems to me that this template is really mucked up with respect to the way rows are coded. the basic row block is this:

{{#if:{{{header1|}}}|<tr><th colspan="2" style="text-align:center; {{{headerstyle|}}}">{{{header1|}}}</th></tr>| {{#if:{{{label1|}}}|{{#if:{{{data1|}}}|<tr><th style="{{{labelstyle|}}}">{{{label1|}}}</th><td class="{{{class1|}}}" style="{{{datastyle|}}}">{{{data1|}}}</td></tr>}}| {{#if:{{{data1|}}}|<tr><td colspan="2" class="{{{class1|}}}" style="text-align:center; {{{datastyle|}}}">{{{data1|}}}</td></tr>}} }} }}

what this seems to say is that label1 and data1 will only be displayed when header1 is not defined, which is patently weird. the problem is that spurious pipe character at the end of the first line (after the </th></tr>).

this would actually be a huge problem to fix - this template is massively transcluded. I might be able to work up a repair job that won't break all of the current versions (which have all doen funky things with the parameters to compensate for the problem). should I try? --Ludwigs2 05:37, 27 March 2009 (UTC)

EDIT: actually, it's probably not as bad as I thought. this change should fix the template without affecting any of the current pages:

{{#if:{{{header1|}}}|<tr><th colspan="2" style="text-align:center; {{{headerstyle|}}}">{{{header1|}}}</th></tr>}} {{#if:{{{label1|}}}|{{#if:{{{data1|}}}|<tr><th style="{{{labelstyle|}}}">{{{label1|}}}</th><td class="{{{class1|}}}" style="{{{datastyle|}}}">{{{data1|}}}</td></tr>}}|{{#if:{{{data1|}}}|<tr><td colspan="2" class="{{{class1|}}}" style="text-align:center; {{{datastyle|}}}">{{{data1|}}}</td></tr>}} }}

basically this separates the header line from the data line by closing the first IF block after the header row. all of the current templates that are structured 'header1 - data2 - header3 - data4 - ...' should still look the same, but a more normal 'header1 - data1 - header2 - data2 - ...' structure could be used as well. if other people concur, I'll run the template through some regex and change all the instances that need to be changed. while I'm at it, I could also convert it to wikitable format; what do you think? --Ludwigs2 05:50, 27 March 2009 (UTC)

It's not meant to be used with header1 and data1, its made so you set 1 thing for each row. chandler · 08:27, 27 March 2009 (UTC)
so what you're telling me is that it was designed not to make sense? ok, well, maybe that's not fair. it doesn't sense from a programming perspective, though it might make more sense from a non-technical perspective. at any rate, it bugs me, so I'm going to work up a revision in user space so we can discuss the pros and cons of it. --Ludwigs2 14:30, 27 March 2009 (UTC)

collapsible infoboxes?

following a request at Wikipedia_talk:WikiProject_Infoboxes#infobox too long, I started wondering whether it would be worth the effort to make the data section of infoboxes optionally collapsible. basically this would involve adding a conditional subtable using something like the following before the header 1 row:

{{#if:{{{collapsible|}}}|<tr><td><table class="collapsible {{{collapsed|}}}"><tr><tr><th colspan="2">Details</th></tr>}}

and closing it at the end of the data section with:

{{#if:{{{collapsible|}}}|</table></td></tr>}}

of course, it would need some CSS work as well to keep the look consistent. comments? --Ludwigs2 16:45, 30 April 2009 (UTC)

How would that print? ---— Gadget850 (Ed) talk 17:46, 30 April 2009 (UTC)
having never printed a wikipedia page, I have no idea. I tested it by printing to a pdf, and it seems that tables are printed in their current state (collapsed or uncollapsed) rather than always expanded or always collapsed. there may be a special printing class to specify that collapsed tables be printed in their uncollapsed state, but if so it's not documented anywhere obvious; I'd have to dig through the CSS files to figure it out. --Ludwigs2 18:02, 30 April 2009 (UTC)
That is what I meant- collapsed tables do not expand when printing, so how would you print the information. I am not aware of any way to expand when printing. If we can determine the CSS, we can request a new class. ---— Gadget850 (Ed) talk 18:16, 30 April 2009 (UTC)
well, you'd have to expand it first. if the table is expanded, it prints expanded; if the table is collapsed, it prints collapsed. --Ludwigs2 21:45, 30 April 2009 (UTC)
MOS:SCROLL has an exemption for infobox templates, as they shouldn't contain any unique information which isn't available in the article body. For what it's worth though, it should be trivial to make .collapsed only apply to @screen media, no? Chris Cunningham (not at work) - talk 09:45, 1 May 2009 (UTC)
well, it might be a little more complicated than that. collapsible tables work by setting the 'display' style element of individual rows to 'none' using javascript. so you'd probably need something like:
@media print { infobox table.collapsible tr {display:table-row} }
to always display collapsible tables during printing (use none to never display them), but I'd want to test it a bit. the javascript for expanding a collapsed table actually uses the display mode of the header row rather than the generic 'table-row' I used above, and I don't know if that difference makes an actual difference, if you know what I mean. but it ought to be doable. --Ludwigs2 15:34, 1 May 2009 (UTC)
New rules at common.css now expand collapsed boxes when printing. ---— Gadget850 (Ed) talk 18:53, 13 May 2009 (UTC)

Belowclass

Propose adding belowclass for the bottom cell by changing:

{{#if:{{{below|}}}|<tr><td colspan="2" style="text-align:center; {{{belowstyle|}}}">{{{below|}}}</td></tr>}}

to

{{#if:{{{below|}}}|<tr><td colspan="2" class="{{{belowclass|}}}" style="text-align:center; {{{belowstyle|}}}">{{{below|}}}</td></tr>}}

The specific purpose would be to set belowclass = noprint for infoboxes that use a portal link in the below cell. As Wikipedia navigational elements, such links should be non-printable. Currently, the contents of the below cell must be wrapped in a <span>...</span>. --—— Gadget850 (Ed) talk - 22:30, 31 March 2009 (UTC)

Yup. For reference, this came up at Template talk:Infobox Court Case#Portal - non-printable. Chris Cunningham (not at work) - talk 12:10, 1 April 2009 (UTC)
I have added this to the sandbox version and the testcases. Let me know of any issues. ---— Gadget850 (Ed) talk 15:44, 9 June 2009 (UTC)
No objection from me. — Martin (MSGJ · talk) 16:39, 9 June 2009 (UTC)
This is documented, but not implemented. Was there a problem? ---— Gadget850 (Ed) talk 02:19, 6 September 2009 (UTC)