Help:Table caption and Help:Self link: Difference between pages

(Difference between pages)
Content deleted Content added
No edit summary
 
Per talk
 
Line 1:
<languages />
{{PD Help Page}}
<translate><!--T:1--> A '''self link''' is a [[<tvar name=1>Special:MyLanguage/Help:link</tvar>|wikilink]] which targets the page where it is placed.</translate>
<translate><!--T:19--> To avoid any confusion, a self-link is not clickable: the text is only bolded (but still represented as a <tvar name=code>{{tag|a}}</tvar> tag<ref>From [[<tvar name=2>gerrit:q/343204</tvar>|2017 change]] ([[<tvar name=3>phab:T160480</tvar>|developer task]]).</ref>).</translate> <translate><!--T:24--> If the preference to underline links is set, self links are still underlined, unless this is explicitly disabled by the following CSS:</translate>
 
<syntaxhighlight lang="wikitext">
The HTML '''caption''' element is used within the [[w:HTML element#Tables|table]] element. Alternatively, in wikitext, this can also be achieved using the code <code>|+</code> within the wikitext syntax for creating [[Help:Table|tables]].
.mw-selflink { text-decoration: none !important; }
</syntaxhighlight>
 
<translate>
By default, the text within the '''caption''' element is positioned above the table. However, the position of the caption text and the table can be adjusted to the left, right, etc. of the table by using the [https://www.w3.org/TR/html401/present/graphics.html#h-15.1.2| align] parameter.
<!--T:2-->
<!-- I'm not sure the below sentences are true. The align parameter adjusts the table and the caption text, not the caption text alone. -->
Examples:
<!-- It places texts above the table, by default. Texts can also be below, at the left or at the right side of the table, based on the "align" parameter's value. -->
</translate>
* <translate><!--T:21--> <tvar name=1><code>[<nowiki/>[{{FULLPAGENAME}}]]</code></tvar> gives <tvar name=2>[[{{FULLPAGENAME}}]]</tvar></translate>
* <translate><!--T:22--> <tvar name=1><code>[<nowiki/>[{{FULLPAGENAME}}]]abc</code></tvar> gives <tvar name=2>[[{{FULLPAGENAME}}]]abc</tvar></translate>
* <translate><!--T:23--> <tvar name=1><code>[<nowiki/>[{{FULLPAGENAME}}|abc]]</code></tvar> gives <tvar name=2>[[{{FULLPAGENAME}}|abc]]</tvar></translate>
 
<translate>
{| class="wikitable"
== Utility == <!--T:3-->
|-
</translate>
| The text, '''This is a Caption''', is the caption for the table on the right side.
<translate><!--T:4--> In templates transcluded on several pages (typically navigational templates), a link can usefully become a self link when the template is transcluded on the link target page.</translate>
| width="33%" |
<translate><!--T:20--> This avoids the reader believing they will see another page when clicking on it.</translate>
{| border="1"
 
|+ This is a Caption
<translate>
! Data-Type-1 !! Data-Type-2
== Clickable self links == <!--T:5-->
|-
 
| Data-1a || Data-2a
<!--T:6-->
|-
Some kinds of self links are clickable, because they are not a simple internal link with direct target.
| Data-1b || Data-2b
 
|}
=== Full URL === <!--T:7-->
|-
| width="20%" | Wikitext:
| colspan="2" | <pre><nowiki>
{| border="1"
|+ This is a Caption
! Data-Type-1 !! Data-Type-2
|-
| Data-1a || Data-2a
|-
| Data-1b || Data-2b
|}
</nowiki></pre>
|-
| width="20%" | Html code:
| colspan="2" | <syntaxhighlight lang="html">
<table border="1">
<caption> This is a Caption </caption>
<tr>
<th> Data-Type-1 </th><th> Data-Type-2 </th>
</tr><tr>
<td> Data-1a </td><td> Data-2a </td>
</tr><tr>
<td> Data-1b </td><td> Data-2b </td>
</tr>
</table>
</syntaxhighlight>
|}
 
<!--T:8-->
To create an HTML '''&lt;caption&gt;''' tag in wikitext, you can use the below syntax:
If you use external link syntax, providing the full URL of the page, the link is always clickable.
|+ Caption
 
<!--T:9-->
It will generate the below HTML code:
E.g. <tvar name=code><code>[<nowiki/>{{fullurl:{{FULLPAGENAME}}}} abc]</code></tvar> gives <tvar name=result>[{{fullurl:{{FULLPAGENAME}}}} abc]</tvar>
&lt;caption&gt;Caption text&lt;/caption&gt;
<!-- I'm still struggling to render the below, I'm not sure how it worked on Metawiki and ended up being documented. -->
To use parameters inside a caption using wikitext, you can use the below syntax:
|+ ''params''|Caption
 
=== Link to self redirection === <!--T:10-->
It will generate the below HTML code:
&lt;caption ''params''&gt;Caption&lt;/caption&gt;
 
<!--T:11-->
The equivalent of the table caption in [[Wikipedia:Cascading Style Sheets|CSS]]:
If you link to a page which redirects to the current page, the link remains clickable and not bolded.
display: table-caption;
 
=== Link to a local section === <!--T:15-->
A caption tag can accept the following parameters:
</translate>
align = "top|bottom|left|right" (Deprecated html parameter)
{{main|Help:Link#Anchors|l1=<translate><!--T:16--> Help page about links, anchor section</translate>}}
&nbsp;&nbsp;(Html "align" is valid for ~[[Wikipedia:Internet Explorer|IE]] 6).
 
<translate>
The equivalent of the align parameter in [[Wikipedia:Cascading Style Sheets|stylesheet]]:
<!--T:17-->
style="caption-side: top|bottom|left|right|inherit;"
If the target contains a fragment, even if the link targets the current section, it remains clickable and not bolded.
{| class="wikitable"
|-
| In the table on the right, the text, '''Caption at bottom''', is displayed as the caption text at the bottom of the table.
| width="33%" |
{| border="1"
|+ align="bottom" style="caption-side: bottom" | Caption at '''bottom'''
! Data-Type-1 !! Data-Type-2
|-
| Data-1a || Data-2a
|-
| Data-1b || Data-2b
|}
|-
| width="10%" | Wikitext:&nbsp;
| colspan="2" style="border: 1px dashed #2f6fab; background-color: #f9f9f9;" | <code><nowiki>
{| border="1"</nowiki><br /><nowiki>
|+ align="bottom" style="caption-side: bottom" | Caption at '''bottom'''</nowiki><br /><nowiki>
! Data-Type-1 !! Data-Type-2</nowiki><br /><nowiki>
|-</nowiki><br /><nowiki>
| Data-1a || Data-2a</nowiki><br /><nowiki>
|-</nowiki><br /><nowiki>
| Data-1b || Data-2b</nowiki><br /><nowiki>
|}
</nowiki></code>
|}
 
<!--T:18-->
To place the caption text on the right-aligned bottom side, use:
E.g. <tvar name=code><code>[<nowiki/>[{{FULLPAGENAME}}#Link to a local section]]</code></tvar> gives <tvar name=result>[[{{FULLPAGENAME}}#Link to a local section]]</tvar>.
|+ align="bottom" style="caption-side: bottom; text-align: right;" | Caption at bottom
</translate>
 
==See alsoReferences ==
<references/>
* [[Help:Table]]
 
[[Category:Help{{#translation:}}]]
[[Category:Link{{#translation:}}]]