Parser diff test
From Meta
Differences
| Parser_OldPP | Parser | ||
</tr> |
</tr> |
||
<tr> |
<tr> |
||
| - |
<td>old preprocessor</td>
|
+ |
<td><a href="http://meta.wikimedia.org/w/index.php?title=Help:Table&timtest=oldpp" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Help:Table&timtest=oldpp" rel="nofollow">old preprocessor</a></td>
|
</tr> |
</tr> |
||
<tr> |
<tr> |
||
| - |
<td><a href="http://meta.wikimedia.org/w/index.php?title=Help:Table&timtest=newpp" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Help:Table&timtest=newpp" rel="nofollow">new preprocessor</a></td>
|
+ |
<td>new preprocessor</td>
|
</tr> |
</tr> |
||
<tr> |
<tr> |
||
</tr> |
</tr> |
||
</table> |
</table> |
||
| - |
<p>Although HTML table syntax also works, special <a href="/wiki/Wikicode" title="Wikicode">wikicode</a> can be used as a shortcut to create a table. The pipe (<a href="http://en.wikipedia.org/wiki/vertical_bar" class="extiw" title="w:vertical_bar">vertical bar</a>) codes function exactly the same as <a href="http://en.wikipedia.org/wiki/HTML_table" class="extiw" title="w:HTML_table">HTML table</a> markup, so a knowledge of HTML table code will help in understanding pipe code. The shortcuts are as follows:</p>
|
+ |
<p>Although HTML table syntax also works, special <a href="/wiki/Wikicode" class="mw-redirect" title="Wikicode">wikicode</a> can be used as a shortcut to create a table. The pipe (<a href="http://en.wikipedia.org/wiki/vertical_bar" class="extiw" title="w:vertical_bar">vertical bar</a>) codes function exactly the same as <a href="http://en.wikipedia.org/wiki/HTML_table" class="extiw" title="w:HTML_table">HTML table</a> markup, so a knowledge of HTML table code will help in understanding pipe code. The shortcuts are as follows:</p>
|
<ul> |
<ul> |
||
<li>The entire table is encased with curly brackets and a vertical bar character (a pipe). So use <code><b>{|</b></code> to begin a table, and <code><b>|}</b></code> to end it. Each one needs to be on its own line:</li> |
<li>The entire table is encased with curly brackets and a vertical bar character (a pipe). So use <code><b>{|</b></code> to begin a table, and <code><b>|}</b></code> to end it. Each one needs to be on its own line:</li> |
||
<p><a name="Conditional_table_row" id="Conditional_table_row"></a></p> |
<p><a name="Conditional_table_row" id="Conditional_table_row"></a></p> |
||
<h2><span class="editsection">[<a href="/w/index.php?title=Help:Table&action=edit&section=22" title="Edit section: Conditional table row">edit</a>]</span> <span class="mw-headline">Conditional table row</span></h2> |
<h2><span class="editsection">[<a href="/w/index.php?title=Help:Table&action=edit&section=22" title="Edit section: Conditional table row">edit</a>]</span> <span class="mw-headline">Conditional table row</span></h2> |
||
| - |
<p>A pipe character for a table row may be desired as part of a parameter value in the call of a template or parser function (in particular, it can be in code made optional using <a href="/wiki/ParserFunctions" title="ParserFunctions">ParserFunctions</a>). However, expansion of templates and parser functions happens before interpretation of table syntax. This causes a pipe character in a parameter value to be interpreted as a separator between parameter definitions. To avoid this these pipe characters are put with a special <span class="plainlinks"><a href="/wiki/Template:%21" title="Template:!">template:!</a> ( <small><a href="/wiki/Template_talk:%21" title="Template talk:!">talk</a> <a href="http://meta.wikimedia.org/w/index.php?title=Template:%21&action=edit" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:%21&action=edit" rel="nofollow">edit</a> <a href="http://meta.wikimedia.org/w/index.php?title=Template:%21&action=history" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:%21&action=history" rel="nofollow">history</a> <a href="http://meta.wikimedia.org/w/index.php?title=Special:Whatlinkshere/template:%21&limit=1000" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Special:Whatlinkshere/template:%21&limit=1000" rel="nofollow">links</a></small> )</span>, see <span class="plainlinks"><a href="/wiki/Template:Table_example_with_optional_row" title="Template:Table example with optional row">template:Table example with optional row</a> ( <small><a href="/wiki/Template_talk:Table_example_with_optional_row" title="Template talk:Table example with optional row">talk</a> <a href="http://meta.wikimedia.org/w/index.php?title=Template:Table_example_with_optional_row&action=edit" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:Table_example_with_optional_row&action=edit" rel="nofollow">edit</a> <a href="http://meta.wikimedia.org/w/index.php?title=Template:Table_example_with_optional_row&action=history" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:Table_example_with_optional_row&action=history" rel="nofollow">history</a> <a href="http://meta.wikimedia.org/w/index.php?title=Special:Whatlinkshere/template:Table_example_with_optional_row&limit=1000" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Special:Whatlinkshere/template:Table_example_with_optional_row&limit=1000" rel="nofollow">links</a></small> )</span>.</p>
|
+ |
<p>A pipe character for a table row may be desired as part of a parameter value in the call of a template or parser function (in particular, it can be in code made optional using <a href="/wiki/ParserFunctions" class="mw-redirect" title="ParserFunctions">ParserFunctions</a>). However, expansion of templates and parser functions happens before interpretation of table syntax. This causes a pipe character in a parameter value to be interpreted as a separator between parameter definitions. To avoid this these pipe characters are put with a special <span class="plainlinks"><a href="/wiki/Template:%21" title="Template:!">template:!</a> ( <small><a href="/wiki/Template_talk:%21" title="Template talk:!">talk</a> <a href="http://meta.wikimedia.org/w/index.php?title=Template:%21&action=edit" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:%21&action=edit" rel="nofollow">edit</a> <a href="http://meta.wikimedia.org/w/index.php?title=Template:%21&action=history" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:%21&action=history" rel="nofollow">history</a> <a href="http://meta.wikimedia.org/w/index.php?title=Special:Whatlinkshere/template:%21&limit=1000" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Special:Whatlinkshere/template:%21&limit=1000" rel="nofollow">links</a></small> )</span>, see <span class="plainlinks"><a href="/wiki/Template:Table_example_with_optional_row" title="Template:Table example with optional row">template:Table example with optional row</a> ( <small><a href="/wiki/Template_talk:Table_example_with_optional_row" title="Template talk:Table example with optional row">talk</a> <a href="http://meta.wikimedia.org/w/index.php?title=Template:Table_example_with_optional_row&action=edit" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:Table_example_with_optional_row&action=edit" rel="nofollow">edit</a> <a href="http://meta.wikimedia.org/w/index.php?title=Template:Table_example_with_optional_row&action=history" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:Table_example_with_optional_row&action=history" rel="nofollow">history</a> <a href="http://meta.wikimedia.org/w/index.php?title=Special:Whatlinkshere/template:Table_example_with_optional_row&limit=1000" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Special:Whatlinkshere/template:Table_example_with_optional_row&limit=1000" rel="nofollow">links</a></small> )</span>.</p>
|
<p>If one tries to use as conditional code for a conditional row "{{!}}-<newline>{{!}}text<newline>" the problem is that the last <newline> is ignored:</p> |
<p>If one tries to use as conditional code for a conditional row "{{!}}-<newline>{{!}}text<newline>" the problem is that the last <newline> is ignored:</p> |
||
<pre> |
<pre> |
||
</pre> |
</pre> |
||
<p><a name="Captions" id="Captions"></a></p> |
<p><a name="Captions" id="Captions"></a></p> |
||
| - |
<h3><span class="editsection">[<a href="/w/index.php?title=Help:Table&action=edit&section=30" title="Edit section: Captions">edit</a>]</span> <span class="mw-headline"><a href="/wiki/Help:Table_Caption" title="Help:Table Caption">Captions</a></span></h3>
|
+ |
<h3><span class="editsection">[<a href="/w/index.php?title=Help:Table&action=edit&section=30" title="Edit section: Captions">edit</a>]</span> <span class="mw-headline"><a href="/wiki/Help:Table_Caption" class="mw-redirect" title="Help:Table Caption">Captions</a></span></h3>
|
<p>A <caption> tag is created by</p> |
<p>A <caption> tag is created by</p> |
||
<pre> |
<pre> |
||
<td> |
<td> |
||
<div class="thumb tleft"> |
<div class="thumb tleft"> |
||
| - |
<div class="thumbinner" style="width:194px;"><a href="/wiki/Image:Some_window_blinds.JPG" class="image" title="Various window shades"><img alt="Various window shades" src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Some_window_blinds.JPG/192px-Some_window_blinds.JPG" width="192" height="256" border="0" class="thumbimage" /></a>
|
+ |
<div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Some_window_blinds.JPG" class="image" title="Various window shades"><img alt="Various window shades" src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Some_window_blinds.JPG/180px-Some_window_blinds.JPG" width="180" height="240" border="0" class="thumbimage" /></a>
|
<div class="thumbcaption"> |
<div class="thumbcaption"> |
||
<div class="magnify"><a href="/wiki/Image:Some_window_blinds.JPG" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
<div class="magnify"><a href="/wiki/Image:Some_window_blinds.JPG" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
||
<td> |
<td> |
||
<div class="thumb tleft"> |
<div class="thumb tleft"> |
||
| - |
<div class="thumbinner" style="width:194px;"><a href="/wiki/Image:Vert-blinds-2145-rs.jpg" class="image" title="Vertical blinds"><img alt="Vertical blinds" src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Vert-blinds-2145-rs.jpg/192px-Vert-blinds-2145-rs.jpg" width="192" height="256" border="0" class="thumbimage" /></a>
|
+ |
<div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Vert-blinds-2145-rs.jpg" class="image" title="Vertical blinds"><img alt="Vertical blinds" src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Vert-blinds-2145-rs.jpg/180px-Vert-blinds-2145-rs.jpg" width="180" height="240" border="0" class="thumbimage" /></a>
|
<div class="thumbcaption"> |
<div class="thumbcaption"> |
||
<div class="magnify"><a href="/wiki/Image:Vert-blinds-2145-rs.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
<div class="magnify"><a href="/wiki/Image:Vert-blinds-2145-rs.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
||
<td> |
<td> |
||
<div class="thumb tleft"> |
<div class="thumb tleft"> |
||
| - |
<div class="thumbinner" style="width:194px;"><a href="/wiki/Image:Gardine.jpg" class="image" title="This is not a blind"><img alt="This is not a blind" src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Gardine.jpg/192px-Gardine.jpg" width="192" height="256" border="0" class="thumbimage" /></a>
|
+ |
<div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Gardine.jpg" class="image" title="This is not a blind"><img alt="This is not a blind" src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Gardine.jpg/180px-Gardine.jpg" width="180" height="240" border="0" class="thumbimage" /></a>
|
<div class="thumbcaption"> |
<div class="thumbcaption"> |
||
<div class="magnify"><a href="/wiki/Image:Gardine.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
<div class="magnify"><a href="/wiki/Image:Gardine.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
||
<td> |
<td> |
||
<div class="thumb tleft"> |
<div class="thumb tleft"> |
||
| - |
<div class="thumbinner" style="width:194px;"><a href="/wiki/Image:Vorhang.jpg" class="image" title="Solid shade"><img alt="Solid shade" src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Vorhang.jpg/192px-Vorhang.jpg" width="192" height="144" border="0" class="thumbimage" /></a>
|
+ |
<div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Vorhang.jpg" class="image" title="Solid shade"><img alt="Solid shade" src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Vorhang.jpg/180px-Vorhang.jpg" width="180" height="135" border="0" class="thumbimage" /></a>
|
<div class="thumbcaption"> |
<div class="thumbcaption"> |
||
<div class="magnify"><a href="/wiki/Image:Vorhang.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
<div class="magnify"><a href="/wiki/Image:Vorhang.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
||
<td> |
<td> |
||
<div class="thumb tleft"> |
<div class="thumb tleft"> |
||
| - |
<div class="thumbinner" style="width:330px;"><a href="/wiki/Image:Jalousie-1.jpg" class="image" title="Horizonal blinds"><img alt="Horizonal blinds" src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/65/Jalousie-1.jpg/328px-Jalousie-1.jpg" width="328" height="246" border="0" class="thumbimage" /></a>
|
+ |
<div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Jalousie-1.jpg" class="image" title="Horizonal blinds"><img alt="Horizonal blinds" src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/65/Jalousie-1.jpg/180px-Jalousie-1.jpg" width="180" height="135" border="0" class="thumbimage" /></a>
|
<div class="thumbcaption"> |
<div class="thumbcaption"> |
||
<div class="magnify"><a href="/wiki/Image:Jalousie-1.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
<div class="magnify"><a href="/wiki/Image:Jalousie-1.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
||
<div align="right"><small class="plainlinks"><a href="http://meta.wikimedia.org/w/index.php?title=Template:H:f_Help&action=edit" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:H:f_Help&action=edit" rel="nofollow">+/-</a></small></div> |
<div align="right"><small class="plainlinks"><a href="http://meta.wikimedia.org/w/index.php?title=Template:H:f_Help&action=edit" class="external text" title="http://meta.wikimedia.org/w/index.php?title=Template:H:f_Help&action=edit" rel="nofollow">+/-</a></small></div> |
||
<p><a name="Links_to_other_help_pages" id="Links_to_other_help_pages"></a></p> |
<p><a name="Links_to_other_help_pages" id="Links_to_other_help_pages"></a></p> |
||
| - |
<h2><span class="editsection">[<a href="/w/index.php?title=Template:H:f_Help&action=edit&section=1" title="Template:H:f Help">edit</a>]</span> <span class="mw-headline">Links to other help pages</span></h2>
|
+ |
<h2><span class="editsection">[<a href="/w/index.php?title=Template:H:f_Help&action=edit&section=T-1" title="Template:H:f Help">edit</a>]</span> <span class="mw-headline">Links to other help pages</span></h2>
|
<dl> |
<dl> |
||
<dt><a href="/wiki/Help:Contents" title="Help:Contents">Help contents</a></dt> |
<dt><a href="/wiki/Help:Contents" title="Help:Contents">Help contents</a></dt> |
||
Output comparison
| Parser_OldPP | Parser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
This page gives you information about syntax to build wiki-tables in MediaWiki. [edit] Spreadsheet to wiki table formatTo convert from spreadsheets such as Gnumeric, MS Excel or OpenOffice.org Calc, go here. [edit] Using the toolbarYou can use the Mediawiki edit toolbar to create tables on wikipedia, and some wikimedia projects. It is helpful to generate the necessary codings. However on many MediaWiki wikis (and by default) the table tool is not available. Use the first button on the right of the toolbar to insert a table when editing a page. By default, it includes the following text:
{| class="wikitable"
|-
! header 1
! header 2
! header 3
|-
| row 1, cell 1
| row 1, cell 2
| row 1, cell 3
|-
| row 2, cell 1
| row 2, cell 2
| row 2, cell 3
|}
[edit] Pipe syntax tutorial
Although HTML table syntax also works, special wikicode can be used as a shortcut to create a table. The pipe (vertical bar) codes function exactly the same as HTML table markup, so a knowledge of HTML table code will help in understanding pipe code. The shortcuts are as follows:
{| table code goes here |}
{|
|+ caption
table code goes here
|}
{|
|+ The table's caption
|-
cell code goes here
|-
cell code goes here
|}
{|
|+ The table's caption
|-
| cell codes go here
|-
| cells in the next row go here
| more cells in the same row here
|}
{|
|+ The table's caption
|-
|Cell 1 || Cell 2 || Cell 3
|-
|Cell A
|Cell B
|Cell C
|}
{| border="1"
|-
|format modifier (not displayed)|These all |(including the pipes)|go into |the first cell
|-
|}
which is probably not what you want:
However, the format modifier is useful:
{| border="1"
|-
|Cell 1 (no modifier - not aligned)
|-
|align="right" |Cell 2 (right aligned)
|-
|}
Just remember: no more than 2 single pipes on a line!
{|
|+ The table's caption
! Column heading 1 !! Column heading 2 !! Column heading 3
|-
|Cell 1 || Cell 2 || Cell 3
|-
|Cell A
|Cell B
|Cell C
|}
{|
|+ The table's caption
! Column heading 1 !! Column heading 2 !! Column heading 3
|-
! Row heading 1
| Cell 2 || Cell 3
|-
! Row heading A
|Cell B
|Cell C
|}
{| border="1"
|+ The table's caption
! Column heading 1 !! Column heading 2 !! Column heading 3
|-
! Row heading 1
| Cell 2 || Cell 3
|-
! Row heading A
|Cell B
|Cell C
|}
The final table would display like this:
The table parameters and cell parameters are the same as in HTML, see [1] and Table (HTML). However, the A table can be useful even if none of the cells have content. For example, the background colors of cells can be changed with cell parameters, making the table into a diagram, like Template talk:Square 8x8 pentomino example. An "image" in the form of a table is much more convenient to edit than an uploaded image. Each row must have the same number of cells as the other rows, so that the number of columns in the table remains consistent. For empty cells, use the non-breaking space With colspan and rowspan cells can span several columns or rows, see the Mélange example below. However, this has the disadvantage that sorting does not work properly anymore. [edit] Examples[edit] Simple exampleBoth of these generate the same output. Choose a style based on the number of cells in each row and the total text inside each cell. Wiki markup
What it looks like in your browser
[edit] Multiplication tableWiki markup
What it looks like in your browser (see: Help:User_style)
[edit] Color; scope of parametersTwo ways of specifying color of text and background for a single cell are as follows. The first form is preferred: Wiki markup
What it looks like in your browser
Like other parameters, colors can also be specified for a whole row or the whole table; parameters for a row override the value for the table, and those for a cell override those for a row: Wiki markup
What it looks like in your browser
To make the table blend in with the background, use See : style, background, list of colors, web colors [edit] Width, heightThe width and height of the whole table can be specified, as well as the height of a row. To specify the width of a column one can specify the width of an arbitrary cell in it. If the width is not specified for all columns, and/or the height is not specified for all rows, then there is some ambiguity, and the result depends on the browser. Wiki markup
What it looks like in your browser
Note that [edit] Setting your column widthsIf you wish to force column widths to your own requirements, rather than accepting the width of the widest text element in a column's cells, then follow this example. Note that wrap-around of text is forced.
To set column widths in a table without headers, specify the width in the first cell for each column, like this:
One application of setting the widths is aligning columns of consecutive tables:
[edit] Vertical alignmentBy default data in tables is vertically centrally aligned, which results in odd-looking layouts like this:
To fix this, apply the valign="top" attribute to the rows (unfortunately it seems to be necessary to apply this individually to every single row). For example:
[edit] PositioningOne can position the table itself, and all contents in a row, and contents in a cell, but not with a single parameter for all contents in the table, see m:Template talk:Table demo. Do not, under any circumstances, use "float" to position a table. It will break page rendering at large font sizes. [edit] MélangeHere's a more advanced example, showing some more options available for making up tables. Note however that with colspan and rowspan sorting does not work properly anymore. You can play with these settings in your own table to see what effect they have. Not all of these techniques may be appropriate in all cases; just because you can add colored backgrounds, for example, doesn't mean it's always a good idea. Try to keep the markup in your tables relatively simple -- remember, other people are going to be editing the article too! This example should give you an idea of what is possible, though. Wiki markup
What it looks like in your browser
[edit] Floating tableWiki markup
What it looks like in your browser
[edit] Nested tablesFive different (blue) tables are shown nested inside the cells of a table. Automatically the two tables |A| and |B|B| are vertically aligned instead of the usual side by side of text characters in a cell. "float" is used to fix each of tables |C| and |D| to their own position within one cell of the table. This may be used for charts and schemes. Nested tables must start on a new line. Wiki markup
What it looks like in your browser
[edit] Combined use of COLSPAN and ROWSPANWiki markup
What it looks like in your browser
Note that using [edit] Centering tablesCentered tables can be achieved, but they will not "float"; that is to say, no text will appear to either side. The trick is {| style="margin: 1em auto 1em auto" Wiki markup
What it looks like in your browser
[edit] Setting parametersAt the start of a cell, add your parameter followed by a single pipe. For example width="300"| will set that cell to a width of 300 pixels. To set more than one parameter, leave a space between each one. Wiki markup
What it looks like in your browser
[edit] Decimal point alignmentA method to get columns of numbers aligned at the decimal point is as follows: Wiki markup
What it looks like in your browser
If the column of numbers appears in a table with cell padding or cell spacing, one can still align the decimal points without an unsightly gap in the middle. Embed a table in each number's cell and specify its column widths. Make the embedded tables' column widths the same for each cell in the column. (If decimal points are still misaligned using this method, the main table's column may be too narrow. Add a parameter to increase the column's width.) Wiki markup
What it looks like in your browser
In simple cases one can dispense with the table feature and simply start the lines with a space, and put spaces to position the numbers: 432.1 43.21 4.321 [edit] Style classes
In the first line of table code, after the "{|", instead of specifying a style directly one can also specify a CSS class. The style for this class can be specified in various ways:
Instead of remembering table parameters, you just include an appropriate style class after the
simply by replacing inline CSS for the table by Wiki markup
What it looks like in your browser
Notice that the table retains the gray background of the wikitable class, and the headers are still bold and centered. But now the text formatting has been overridden by the local style statement; all of the text in the table has been made italic and 120% normal size, and the wikitable border has been replaced by the red dashed border. Of course this works only for browsers supporting inline CSS, if it's important use XHTML markup like [edit] SortingTables can be made sortable by adding
A long form of abbreviated content can be put as legend outside the table. [edit] Row templateRegardless of whether wikitable format or HTML is used, the wikitext of the rows within a table, and sometimes even within a collection of tables, has much in common, e.g.:
In that case it can be useful to create a template that produces the syntax for a table row, with the data as parameters. This can have many advantages:
Example: Using Help:table/example row template (talk, backlinks, edit)
{| class="wikitable sortable"
|-
! a
! b
! a/b
{{help:table/example row template| 50|200}}
{{help:table/example row template| 8| 11}}
{{help:table/example row template|1000| 81}}
|}
gives:
[edit] Conditional table rowA pipe character for a table row may be desired as part of a parameter value in the call of a template or parser function (in particular, it can be in code made optional using ParserFunctions). However, expansion of templates and parser functions happens before interpretation of table syntax. This causes a pipe character in a parameter value to be interpreted as a separator between parameter definitions. To avoid this these pipe characters are put with a special template:! ( talk edit history links ), see template:Table example with optional row ( talk edit history links ). If one tries to use as conditional code for a conditional row "{{!}}-<newline>{{!}}text<newline>" the problem is that the last <newline> is ignored:
a{{#if:1|b
}}c
gives "abc". Thus depending on whether there is a <newline> after the condition, we could have a newline too many or too few. This is solved by using the technique of Help:Newlines and spaces#Spaces and/or newlines as value of an unnamed parameter:
{| class=wikitable
{{#if:x|{{!}}-
{{!}}true}}{{{{#if:x|1x|void}}|
}}{{#if:|{{!}}-
{{!}}true}}{{{{#if:|1x|void}}|
}}{{#if:|{{!}}-
{{!}}true}}{{{{#if:|1x|void}}|
}}{{#if:|{{!}}-
{{!}}true}}{{{{#if:|1x|void}}|
}}{{#if:x|{{!}}-
{{!}}true}}{{{{#if:x|1x|void}}|
}}{{!}}-
|unconditional
|}
gives
Each condition is used at two places; to avoid having it twice in the wikitext it can be made a template parameter for a template containing the code for conditionally producing a table row, e.g. w:template:Conditional template call with newline ( talk edit history links ), and in this case
{{#if:{{{1}}}|{{!}}-
{{!}}true}}{{{{#if:{{{1}}}|x1|void}}|
}}
[edit] Other table syntaxOther types of table syntax that MediaWiki supports:
All three are supported by MediaWiki and create (currently) valid HTML output, but the pipe syntax is the simplest. Also, HTML & wiki-<td> syntax (i.e., unclosed <td> and <tr> tags) will not necessarily remain browser-supported in the upcoming future, especially on handheld internet-accessible devices. See also Table (HTML), HTML element#Tables. Note however that the [edit] Comparison of table syntax
See also Template talk:For#Tables. [edit] Pipe syntax in terms of the HTML producedThe pipe syntax, developed by Magnus Manske, substitutes pipes (|) for HTML. There is an on-line script which converts html tables to pipe syntax tables. The pipes must start at the beginning of a new line, except when separating parameters from content or when using [edit] TablesA table is defined by {| ''params'' |} which equals <table ''params''>Insert non-formatted text here </table> [edit] Rows<tr> tags will be generated automatically for the first row. To start a new row, use |- which results in <tr> Parameters can be added like this: |- params which results in <tr params> Note:
[edit] CellsCells are generated either like this: |cell1 |cell2 |cell3 or like this: |cell1||cell2||cell3 which both equal <td>cell1</td><td>cell2</td><td>cell3</td> so "||" equals "newline" + "|" Parameters in cells can be used like this: |params|cell1||params|cell2||params|cell3 which will result in <td params>cell1</td> <td params>cell2</td> <td params>cell3</td> [edit] HeadersFunctions the same way as TD, except "!" is used instead of the opening "|". "!!" can be used instead of "||". Parameters still use "|", though! Example: !params|cell1 [edit] CaptionsA <caption> tag is created by |+ Caption which generates <caption>Caption</caption> You can also use parameters: |+ params|Caption which will generate <caption params>Caption</caption> [edit] Displaying the table code which generates a tableThe code for a simple wiki markup table inside a Code box can be seen below.
{| border="5" cellspacing="5" cellpadding="2"
| style="text-align: center;" | [[Image:gnome-system.png]]
|-
! Computer
|-
| Processor Speed: 1.8 GHz
|}
Above code produces/displays the table below:
Below code, generated and displayed the above table's Code box code itself, on the screen and web page, inside a blue colored dashed bordered rectangular box.
Note that, HTML tag <pre> was used to achieve displaying the above codes and the Code box. [edit] Other alternatives to display table codeIn most cases, when a code line is longer than the web browser window's width, then a scrolling bar appears at bottom, to let the viewer slide to the right side (and also left side) to see the rest of the codes, because, the use of <pre> tag causes the code line to remain intact, unless an EOL (CR/LF) hidden character is reached in that text line. But having to slide or scroll to the right or left for viewing the full codes is often not comfortable to many readers. To solve such problem, using the <p>, <tt> and <br /> HTML tags, are better than using the <pre> tag, as those will limit the length of a line of code according the available space in the web browser's window and therefor will not result in the need to move the scroll-bar right (or left) for viewing. By placing the codes inside the <tt>...</tt> HTML tags, codes are displayed with a fixed width text/font, (like the <pre> tag uses) for easier reading. HTML tag <br /> is used to display (or bring) next line of codes, starting from the next line. HTML tag <p> along with its CSS style properties, is used to create the blue colored dashed bordered rectangular box (Code box) around the codes, (like the HTML <pre> tag, which gets these properties from the main.css stylesheet file). An example of table code with a long line is: {| border="5" cellspacing="5" cellpadding="2" producing the below table:
Code box above the table has the auto line wrapping feature enabled. Note the long line (the sixth line from top) inside the codes, which is wrapped inside the Code box. This Code box and the codes, can be displayed by using below codes in the edit box. <p style="padding: 1em; border: 1px dashed #2f6fab; color: Black; background-color: #f9f9f9; line-height: 1.1em;"> <tt> See the above codes, note that, <nowiki>...</nowiki> tags were used to disable wiki markup codes for beginning a table ({|), ending a table (|}), start of an image displaying ([[), or a hyperlink, etc. All wiki & HTML markup codes need to be disabled by enclosing them inside the <nowiki>...</nowiki> tags. If these codes were to be displayed inside another table, then, each | (pipe) & ! (Exclamation mark) symbol also needed to be enclosed inside the <nowiki> tags. Note that, the longer line is automatically wrapped according to the width of the web browser's window, inside the Code box. Alternatively, we can replace each | (pipe symbol) character with | (HTML decimal entity code), replace each ! (exclamation mark) with ! code, replace { (beginning curly/second bracket) with { and we may replace } (closing curly/second bracket) with } code. Also replace the < (less than sign, or beginning angle bracket) with < numeric entity code or, replace it with < (HTML symbol entity code). For more on HTML decimal or hexadecimal numeric entity codes, please see w:Windows Alt codes. To display the wiki image markup code, we should replace the [ (beginning square/third bracket) with [ and we may replace ] (closing square/third bracket) with ]. When we are replacing characters with their numeric enitity codes, we are actually disabling their normal functionality, so we can display them on the web page(s). <p style="padding: 1em; border: 1px dashed #2f6fab; color: Black; background-color: #f9f9f9; line-height: 1.1em;"> <tt> See also disabling wikitext interpretation and/or reformatting. [edit] Square monitorsTo format for a square monitor or window, use a tape measure. Determine the height of your rectangular screen. Using that figure measure under the screen to determine the width your monitor’s screen would be if it were square. Mark that location using ink or tape under the screen. Drag the side of your browser’s window to that location so the window is square based on accurate measurements. Square monitors and reading windows are not able to contain tables and galleries made for rectangular and wide screens. When a table or gallery is wider than the monitor, it makes every line of text wider than the screen as well. The px amounts of the following gallery were determined after measuring the window to make sure it was square: Type this:
[edit] See also
[edit] External links
[edit] Links to other help pages | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
