Template talk:Aligned table
Template:Aligned table is permanently protected from editing because it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
Text has been copied to or from this page; see the list below. The source pages now serve to provide attribution for the content in the destination pages and must not be deleted as long as the copies exist. For attribution and to access older versions of the copied text, please see the history links below. |
colwidth, colNwidth? (rowstyle?)
[edit]Great template. Since there's already colNalign and colNnowrap, maybe colwidth and colNwidth are worthwhile? Sardanaphalus (talk) 10:11, 1 June 2014 (UTC)
PS Also rowstyle? Sardanaphalus (talk) 10:30, 1 June 2014 (UTC)
- added. Frietjes (talk) 16:20, 1 June 2014 (UTC)
- Thanks. I've just updated the documentation. Sardanaphalus (talk) 13:34, 5 June 2014 (UTC)
Non-Lua version... Just curious
[edit]I've seen Script error on non-Lua versions of the template. Could someone make a non-lua version of this? The "#invoke:aligned table|table" has created script errors. Aeverine Frathleen Nieves (talk) 15:12, 15 September 2014 (UTC)
- @Nsgaeverine: where are you seeing a script error? Frietjes (talk) 16:10, 15 September 2014 (UTC)
- @Frietjes:I saw it on other wikis (not on Wikipedia at all), but I did export this template from this wiki to another wiki I operate. I believe on the wiki I have wiki
.voteforthegirls .us /view /Category:Pages _with _script _errors that Lua is working, and it's the same wiki platform on Wikipedia. I am able to view the Pre-Lua conversions of other templates--only just this template has been troublesome.Aeverine Frathleen Nieves (talk) 20:50, 15 September 2014 (UTC) - @Nsgaeverine: it's possible to make a non-Lua version, but it will have limitations in terms of the total number of entries. if you check the pre-Lua code for template:image array, you will get an idea of the complexity. Frietjes (talk) 21:53, 15 September 2014 (UTC)
- @Frietjes: I am testing a non-Lua version of the Aligned table image based on the pre-Lua code for template:image array on another wiki I have wiki
.voteforthegirls .us /view /Template:Aligned%20table that Lua is working, and it's the same wiki platform on Wikipedia. Beta testing that wiki. --Aeverine Frathleen Nieves (talk) 23:37, 3 February 2015 (UTC)
- @Frietjes: I am testing a non-Lua version of the Aligned table image based on the pre-Lua code for template:image array on another wiki I have wiki
- @Nsgaeverine: it's possible to make a non-Lua version, but it will have limitations in terms of the total number of entries. if you check the pre-Lua code for template:image array, you will get an idea of the complexity. Frietjes (talk) 21:53, 15 September 2014 (UTC)
- @Frietjes:I saw it on other wikis (not on Wikipedia at all), but I did export this template from this wiki to another wiki I operate. I believe on the wiki I have wiki
colstyle, colspan, etc
[edit]Is it possible to implement a colstyle for this template that applies to all columns but is overriden (but not replaced) by individual columns' colNstyles – i.e. for each column, the equivalent, I think, of style="{{{colstyle|}}}{{{colNstyle|}}}"
..?
Also – or, if the above is awkward or not possible, perhaps as an alternative – the ability to declare e.g. colNstyle=colQstyle=colSstyle=(styling)
, rowMstyle=rowPstyle=(etc)
and/or even styleA.B=styleC.D etc
and the same for classX.Y might prove very useful and/or reduce redundancy – in other words, the ability to set more than one parameter to a particular value and/or to set one or more parameters' values to another already set.
A colspan option, like that used in tables, would also be welcome, if possible/practicable.
Sardanaphalus (talk) 17:52, 15 September 2014 (UTC)
Empty-parameter handling
[edit]This code...
{{Aligned table |style=margin-left:1.4em;border:1px solid #aaa; |colstyle=padding:0.1em 0.4em; | A | B |{{{1|}}} |{{{2|}}} |{{{3|}}} |{{{4|}}} |{{{5|}}} |{{{6|}}} |{{{7|}}} |{{{8|}}} |{{{9|}}} |{{{10|}}} | M | N |{{{11|}}} |{{{12|}}} |{{{13|}}} |{{{14|}}} |{{{15|}}} |{{{16|}}} |{{{17|}}} |{{{18|}}} |{{{19|}}} |{{{20|}}} | Y | Z }}
...produces: |
| ...rather than: |
|
i.e. the "empty" cells add whitespace to the table. Is there a way (that doesn't require e.g. many conditionals and/or "display:none;"s, etc) to prevent this, please..? Sardanaphalus (talk) 18:15, 21 November 2014 (UTC)
- so, you want a parameter to strip empty rows? where is this needed? Frietjes (talk) 16:18, 22 November 2014 (UTC)
- I don't know whether row-stripping and/or a parameter would be a suitable (or the only) way to achieve the above, but I've since realised my belief that it doesn't occur with e.g. wiki-markup tables seems incorrect:
{| style="border:1px solid #aaa;" | A || B </tr> | {{{1|}}} || {{{2|}}} </tr> | {{{3|}}} || {{{4|}}} </tr> | {{{5|}}} || {{{6|}}} </tr> | {{{7|}}} || {{{8|}}} </tr> | {{{9|}}} || {{{10|}}} </tr> | M || N </tr> | {{{11|}}} || {{{12|}}} </tr> | {{{13|}}} || {{{14|}}} </tr> | {{{15|}}} || {{{16|}}} </tr> | {{{17|}}} || {{{18|}}} </tr> | {{{19|}}} || {{{20|}}} </tr> | Y || Z </tr> |} |
produces: |
|
not: |
|
- Perhaps, then, what I'm asking won't/can't be uncomplicated. (I suppose the wiki-markup table could use cellspacing="0" and cellpadding="0" (and/or perhaps border-collapse/border-spacing?), but that would then be too great a constraint on non-empty cells...)
- As yet, this isn't needed anywhere, but arose while I was experimenting with the idea of a template to streamline/standardise the presentation of parameters' descriptions etc in documentation.
- Regards, Sardanaphalus (talk) 09:40, 23 November 2014 (UTC)
- I see, so you don't have any specific example where it is needed. in that case, there is no reason to add code that is never used. Frietjes (talk) 19:01, 23 November 2014 (UTC)
- and thanks for the reminder that WP:CHECKWIKI needs to start tracking where you have used </tr> instead of wikimarkup. Frietjes (talk) 19:02, 23 November 2014 (UTC)
- A template featuring an {{Aligned table}} that adds whitespace as above can be deployed quite quickly, if that's what's required..?
- and please let me know how many other uses of </tr> with wikimarkup WP:CHECKWIKI finds I've made for the past few months. ("I wonder why, then, it was used here...") I suspect the resources might be better used implementing a wikimarkup equivalent to </tr>.
- Sardanaphalus (talk) 22:20, 23 November 2014 (UTC)
- try
|-
it works very well you just have to make sure it starts on a new line, which also helps make the table more readable. Frietjes (talk) 15:33, 24 November 2014 (UTC)- And your response to my deployment question, please..? Sardanaphalus (talk) 20:02, 24 November 2014 (UTC)
- and your response to "where is this needed" is still "As yet, this isn't needed anywhere"? in which case, why bother? Frietjes (talk) 21:25, 24 November 2014 (UTC)
- And your response to my deployment question, please..? Sardanaphalus (talk) 20:02, 24 November 2014 (UTC)
- try
I apologise if my enquiry read as if a demand. Empty parameters filling otherwise empty cells seem a distinct possibility with this template, so I thought it would be of interest regardless of specific examples.
I do now have a specific example, practically ready to deploy, for consideration (although it's not the one that prompted this thread; that's currently on-hold): User:Sardanaphalus/Template:Pagelinks templates/Aligned table, as transcluded by its parent ".../Template:Pagelinks templates". The whitespace created by empty-parameter cells can be seen at the bottom of the template's "L(x) templates" and "Related" sections.
Sincerely, Sardanaphalus (talk) 11:39, 3 December 2014 (UTC)
I've now deployed the template that prompted this thread [[Template:Parameter descriptions|here]]. I'd like to stick with {{Aligned table}} as its container, but, if there's no relatively straightforward or elegant way to prevent the whitespace, I suppose the alternative is an HTML table with conditionals..? Sardanaphalus (talk) 12:28, 9 December 2014 (UTC)
- that template looks like a solution in search of a problem. I suggest we delete it. Frietjes (talk) 17:02, 9 December 2014 (UTC)
A way to reduce redundancy..?
[edit]Hello again. Is there a way to avoid redundancy when defining the same (or very similar) kind of Aligned table more than once on a page, or even across pages – in other words, to be able to use something like...
{{Aligned table [something brief (a template, class?)] | ... | (etc) }} ...... {{Aligned table [the something-brief] | ... | (etc) }} ......
...rather than (for example)...
{{Aligned table |class=nowrap |style=line-height:1.4em;overflow:auto; |col1width=[NNN]em |style1.1=padding-left:0.6em;padding-bottom:0.4em;border-bottom:1px solid #aaa;| '''[Header1]''' |style1.2=padding-left:1.6em;padding-bottom:0.4em;border-bottom:1px solid #aaa;| '''[Header2]''' |row2style=padding-top:0.6em; | ... | (etc) }} ...... {{Aligned table |class=nowrap |style=line-height:1.4em;overflow:auto; |col1width=[NNN]em |style1.1=padding-left:0.6em;padding-bottom:0.4em;border-bottom:1px solid #aaa;| '''[Header1]''' |style1.2=padding-left:1.6em;padding-bottom:0.4em;border-bottom:1px solid #aaa;| '''[Header2]''' |row2style=padding-top:0.6em; | ... | (etc) }}
(Is it to define the configuration as a class somehow/somewhere..?)
Sardanaphalus (talk) 06:17, 10 January 2015 (UTC)
Needs colCheader
[edit]The |rowRheader=
functionality badly needs a comparable |colCheader=
equivalent. There's presently no means of telling this template that the first (or whatever, but usually the first and sometimes also the last) column of row cells are <th>
elements. This is a pretty serious usability and accessibility problem. For further accessibility reasons, it needs to also correctly output both scope="row"
or scope="col"
for each table header, which ever one is applicable. While the visual look of a table header can be faked with column- or cell-specific style, this doesn't get around the semantic HTML issue; the header cells really do need to render as <th>...</th>
in the user agent. PS: If for some reason |colCheader=
would be a bear to implement, then a boolean |headerR.C=yes
would work. Having that work in addition to |colCheader=
, actually, would also allow us to override the column-wide or row-wide default applied by |rowRheader=
and |colCheader=
. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 18:23, 18 July 2015 (UTC)
- added colXXheader and scope attributes. Frietjes (talk) 16:10, 26 July 2015 (UTC)
What's up with colclass
?
[edit]Why is colclass
and its description given in parentheses and italiczed, at Template:Aligned table/doc#Parameters? That markup doesn't seem to imply anything concrete. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 19:31, 18 July 2015 (UTC)
- removed. I believe this one was wishful thinking on the part of the editor who added it to the documentation. Frietjes (talk) 16:12, 26 July 2015 (UTC)
No "rowstyle" parameter
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
The naked "rowstyle" parameter does not appear to be implemented in module:aligned table despite a row style being applied, and template:aligned table documenting such a parameter. Ideally, the unconditional row style "vertical-align:top;" could be made a proper default, or removed entirely. 87.254.79.130 (talk) 00:56, 10 June 2016 (UTC)
- Good catch, and thanks for updating the documentation page about the default.
|rowstyle=
now works with Special:Diff/724577491. I deem the spec (doc) correct and the code was just missing rowstyle customization. Testcase for|rowstyle=
is at testcases. — Andy W. (talk · ctb) 04:34, 10 June 2016 (UTC)
Whitespace stripping
[edit]@Frietjes: As Help:Template#Parameters says, whitespace is not stripped from the beginnings and ends of unnamed parameters. This apparently has a strange effect reported at Wikipedia:Help desk#Indenting issues in IPv4. Below is a simplified example.
; Bold text :This line and the following table are indented.{{aligned table| cols=2 | Cell1 | Cell2 }}
This line is not indented. All is well.
; Bold text :This line and the following table are indented.{{aligned table| cols=2 | Cell1 | Cell2 }}
This line is indented, at least for me in Firefox, because the last Cell2 is followed by a newline. Naming the parameter with 2=Cell2
will remove the indentation. PrimeHunter (talk) 02:22, 22 August 2016 (UTC)
- PrimeHunter, this template is just building the html table with very limited processing, and basically not processing of the actual cell contents. you can see the same thing if you were to use an HTML table directly:
; Bold text :This line and the following table are indented.<table><tr> <td>Cell1</td><td>Cell2 </td></tr></table>
This line is probably indented for you as well. so, it's not so much an issue with this template as it is an issue with how html tables and dl/dt lists are processed by the server and the browser. Frietjes (talk) 13:45, 22 August 2016 (UTC)
- PrimeHunter, I added functionality to strip trailing whitespace, so this version of IPv4 now renders as expected, and your example above is fixed. as far as I can tell, stripping trailing whitespace is safe for this module/template. we just can't strip leading whitespace since that could mangle lists. Frietjes (talk) 12:51, 24 August 2016 (UTC)
- Frietjes, PrimeHunter, or anyone else reading here, the above wikitext featuring indenting with a colon and a
<table>
tag on the same line, coding for a table appearing just above "This line is probably indented for you as well", generates a Multiline table in list lint error, so please don't do that. —Anomalocaris (talk) 05:55, 8 May 2019 (UTC)
- Frietjes, PrimeHunter, or anyone else reading here, the above wikitext featuring indenting with a colon and a
rightleft
[edit]This edit request to Module:Aligned table has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Would it be possible to add the following code to counterbalance leftright and to easily get the opposite effect when so desired?
- i.e. |col1align=right and |col2align=left
if isnotempty(args['rightleft']) then
colstyle[1] = 'text-align:right;'
colstyle[2] = 'text-align:left;'
end
Jay D. Easy (talk) 01:38, 19 March 2019 (UTC)
- Done -- /Alex/21 07:13, 22 March 2019 (UTC)