Anonymous

List of Dragons: A: Difference between revisions

From All About Dragons
6,961 bytes removed ,  02:47, 18 November 2012
no edit summary
No edit summary
No edit summary
Line 14: Line 14:
* (for an article) the [[Help:Magic words|magic word]] <code><nowiki>__NOTOC__</nowiki></code> (with two underscores on either side of the word) is added to the article
* (for an article) the [[Help:Magic words|magic word]] <code><nowiki>__NOTOC__</nowiki></code> (with two underscores on either side of the word) is added to the article


===Positioning the TOC===
When either <code><nowiki>__FORCETOC__</nowiki></code> or <code><nowiki>__TOC__</nowiki></code> (with two underscores on either side of the word) is placed in the wikitext, a TOC is added even if the page has fewer than four headings.
====Floating the TOC====
The TOC can, in some instances, be floated either right or left using {{tlx|TOC right}} or {{tlx|TOC left}} when it is beneficial to the layout of the article, or when the default TOC gets in the way of other elements. Before changing the default TOC to a floated TOC, consider the following guidelines:
# If an article will be adversely affected by the change, don't float the TOC.
# If floating the TOC, it should be placed at the end of the lead section of the text, before the first section heading. Users of [[screen reader]]s do not expect any text between the TOC and the first heading, and having no text above the TOC is
===Limiting the depth of the TOC===
When an article or project page has a very large number of subsections, it may be appropriate to hide lower-level subsections from the TOC. You can specify a limit for the lowest-level section that should be displayed using {{tlx|TOC limit|<var>n</var>}}, where <code><var>n<var></code> is the number of <code>=</code> signs that are used on each side of the lowest-level section header that should be displayed (e.g. <code>3</code> to show <code><nowiki>===sub-sections===</nowiki></code> but hide <code><nowiki>====sub-sub-sections====</nowiki></code>). The <code>limit=<var>n</var></code> parameter can also be given to {{tlnull|TOC left}} or {{tlnull|TOC right}} the same way.
===Linking to the TOC===
The TOC is automatically generated with HTML <code>id="toc"</code>. You can make a link to it with <code><nowiki>[[#toc]]</nowiki></code>:
* Same page:
** wikicode: <code><nowiki>[[#toc|Contents]]</nowiki></code>
** link: [[#toc|Contents]]
* Different page:
** wikicode: <code><nowiki>[[Help:Wiki markup#toc|Contents]]</nowiki></code>
** link: [[Help:Wiki markup#toc|Contents]]
===Replacing the default TOC===
The auto-generated TOC is not maximally appropriate or useful in all article types, such as long [[WP:SAL|list articles]] and [[WP:MOSGLOSS|glossaries]], so there are [[:Category:Wikipedia table of contents templates|numerous replacement templates]]. To use one, put <code><nowiki>__NOTOC__</nowiki></code> at the top of the article, and place the alternative TOC template, such as {{tlx|CompactTOC8}} (which can be customized for many list styles) where needed.
==Section linking==
In the HTML code for each section there is "id" attribute holding the section title. This enables [[w:hyperlink|linking]] directly to sections. These section anchors are automatically used by MediaWiki when it generates a table of contents for the page, and therefore when a section heading in the ToC is clicked, it will jump to the section. Also, the section anchors can be manually linked directly to one section within a page.
To link to a section in the same page you can use <tt><nowiki>[[#section name|displayed text]]</nowiki></tt>, and to link to a section in another page <tt><nowiki>[[page name#section name|displayed text]]</nowiki></tt>.
The anchors disregard the depth of the section; a link to a subsection or sub-subsection etc. will be <tt><nowiki>[[#subsection name]]</nowiki></tt> and <tt><nowiki>[[#sub-subsection name]]</nowiki></tt> etc.
An underscore and number are appended to duplicate section names. E.g. for three sections named "Example", the names (for section linking) will be "Example", "Example_2" and "Example_3". However, after editing section "Example_2" or "Example_3" (see below), one, confusingly, arrives at section "Example" from the [[Help:edit summary|edit summary]].
If a section has a blank space as heading, it results in a link in the TOC that does not work. For a similar effect see [[Help:Parser function#NS:0|NS:0]].
To create an anchor target without a section heading, you can use the {{tl|anchor}} template or a span: <tt><nowiki><span id="anchor_name"></span></nowiki></tt>.
'''Notes:'''
* Using the [[Help:Preferences#Date format|date formatting feature]] in section headings complicates section linking.
* An internal link in a section heading does not give complications in terms of section linking, however editors who have their preferences set to edit sections by clicking on the header will not be able to click these links:
** [[#Demo a]]
** [[Help:Section#Demo http://a]]
** http://meta.wikimedia.org/wiki/Help:Section#Demo_http:.2F.2Fa
* The [[Help:Piped link#Pipe trick|pipe trick]] does not work for section links:
** <tt><nowiki>[[#section| ]]</nowiki></tt> -> [[#section| ]]
** <tt><nowiki>[[page#section| ]]</nowiki></tt> -> [[page#section| ]]
** <tt><nowiki>[[namespace:page#section| ]]</nowiki></tt> -> [[namespace:page#section| ]]
For linking to an arbitrary position in a page see [[Wikipedia:Section linking|Section linking (anchors)]].
===Section linking and redirects===
A link that specifies a section of a redirect page corresponds to a link to that section of the target of the redirect.
A [[Help:redirect|redirect]] to a section of a page will also work, try e.g. the redirect page [[Help:Section linking and redirects|Section linking and redirects]].
A complication is that, unlike renaming a page, renaming a section does not create any redirect from the old section name. Therefore incoming links to the old section name will have to be fixed.
There is no separate [[Help:What links here|What links here]] feature for sections: the list does not distinguish between links to one section or another and links to the entire page. Possible workarounds:
* Instead of linking directly to a section, link to a page that redirects to the section; when the name of the section is changed, just change the redirect target. With this method, pages linking to the section can be identified by using ''What links here'' on the redirect page. The [[tools:~dispenser/cgi-bin/rdcheck.py]] tool can be used to find existing section redirects.
* Put an anchor and link to that
* Put a comment in the wikitext at the start of a section listing pages that link to the section
* Make the section a separate page/template and either transclude it into, or just link to it from, its parent page; instead of linking to the section one can then link to the separate page.
Redirect pages can be categorized by adding a category tag after the redirect command. In the case that the target of the redirect is a section, this has to some extent the effect of categorizing the section: through the redirect the category page links to the section; however, unless an explicit link is put, the section does not link to the category. On the category page, redirects are displayed with class redirect-in-category, so they can be shown in e.g. italics; this can be defined in [[MediaWiki:Common.css]]. See also [[WP:Categorizing redirects]].


==Section editing==
==Section editing==