Manual:Tabela de conteúdo

From mediawiki.org
This page is a translated version of the page Manual:Table of contents and the translation is 27% complete.
This page is about tables of contents in wiki pages. For the contents page of the MediaWiki technical manual, see Manual:Conteúdos .

Por padrão, uma tabela de conteúdo (por vezes abreviada para TDC) é gerada automaticamente em uma página quando mais de três títulos de seção são usados.

Normalmente, a tabela reproduz e enumera estes títulos.

All HTML in the headings is stripped in the TOC, except the following tags:

  • ‎<sup>, ‎<sub>[1]
  • ‎<i>[2]
  • ‎<b>[3]
  • ‎<bdi>[4]
  • <span dir="rtl">, <span dir="ltr">[5]
  • ‎<s>, ‎<strike>[6]
  • ‎<q>[7]

The table of contents is not generated for section headings that are found within html tags (Manual:$wgRawHtml ).

Ocultando a TDC

Place __NOTOC__ anywhere you want on the page to hide its TOC.

Using certain templates, such as Template:Compact ToC (found on English Wikipedia), will replace the regular Table of Contents functionality.

Posicionando a TDC

A posição default da TDC é diretamente acima do primeiro título de seção. Qualquer texto anterior vem antes da TDC. Para colocar em qualquer outro lugar, utilize a palavra mágina __TOC__ na posição da página.

A skin may remove or move the table of contents to another section of the page using Extension:DeToc .

Adicionando a TDC

Se você tem três seções ou menos, mas quer ter uma TDC, escreva a palavra mágica __FORCETOC__ em qualquer lugar da página para mostrar no local padrão, ou __TOC__ no local desejado.

Personalizando a TDC

Width

An extenuating circumstance may require the width of a TOC width to be adjusted as a percentage of a page. For example: {{TOC left|width=30%}}

Nível

The maximum level of headings displayed on the TOC is defined in $wgMaxTocLevel . To customize this for individual pages, the TOC can be enclosed in an element with class toclimit-<limit>, if the appropriate CSS rules are defined in the pages CSS.

See Template:TOC and the relevant rules at Template:TOC/limit-styles.css for an example implementation.

Auto-numbering

By default, the TOC automatically numbers the sections. The section headings themselves aren't numbered. This behavior of the table of contents can be customised in several ways:

  • It is possible to suppress the auto-generated section numbers in the TOC, if the proper class exists locally at MediaWiki:Common.css, defined as .tocnumber { display: none; }.

To do this selectively, a wrapper element can be placed around the TOC, as in <div class="noautonum">__TOC__</div> on the page, and .noautonum .tocnumber { display: none; } at MediaWiki:Common.css.

It is also possible to add numbering to headings themselves using JavaScript, as explained at Snippets/Auto-number headings .

Internacionalização

Different languages have different ways of expressing TOCs and how its (sub)section numbering is done. Also, the different style guides of many languages differ in what style of TOC and TOC (sub)section numbering scheme they recommend for writers to use.

The different w:style guides of each language sometimes recommend different typographic conventions to follow.

It's important to note that most languages don't even have any style guide for writing in that language (and many languages don't have a written form entirely), so people usually use the most common style based on existing written convention (not prescribed, but simply 'standard' due to popular usage), which makes the written use of many languages have a sort of 'fluid' punctuation, spelling/orthography and even [personal changes of the very] grammar [of that particular language]. w:Westernization has influenced alphabet and non-alphabet writing systems, with many languages simply copying or being artificially converted to European-style typographic and w:punctuational conventions.

An example on how to change the style of a TOC to a localized one is given below:

Some languages put a dot after a (sub)section ordinal number, e.g. they do not use the following TOC style:

Contents
1 Section [1]
1.1 Subsection [1.1]
2 Section [2]
2.1 Subsection [2.1]
3 Section [3]
3.1 Subsection [3.1]
3.1.1 Subsubsection [3.1.1]
3.1.2 Subsubsection [3.1.2]

But use one like so:

Contents
1. Section [1.]
1.1. Subsection [1.1.]
2. Section [2.]
2.1. Subsection [2.1.]
3. Section [3.]
3.1. Subsection [3.1.]
3.1.1. Subsubsection [3.1.1.]
3.1.2. Subsubsection [3.1.2.]

(Notice the addition of dots after ordinal numerals before the section names!)

It's possible to produce that effect using w:CSS. Put the following CSS code in a shared CSS file of your MediaWiki installation and it should work:

.tocnumber:after { content: '.' }

where the symbol between the single quotation marks is the sign after a (sub)section number.

Also, see bugzilla:43494 and bugzilla:33450 for details on related i18n problems of TOCs.

Floating

The TOC can be made to display as a floating element on the page, with text flowing around it.

For this, enclose the TOC in an element with the CSS style float:left; or float:right;.

Veja Template:TOC para um exemplo de implementação.

Extensões

The behavior of the table of contents can be further adjusted using extensions.

Veja Category:TOC extensions para uma lista.

Links externos

  1. From MediaWiki 1.11 (setembro de 2007). See phab:T10393.
  2. From MediaWiki 1.19 (novembro de 2011). See phab:T28375.
  3. From MediaWiki 1.19 (dezembro de 2011). See phab:T28375.
  4. From MediaWiki 1.25/wmf14 (). See phab:T74884.
  5. From MediaWiki 1.21/wmf1 (). See phab:T37167.
  6. From MediaWiki 1.28/wmf.21 (). See phab:T35715.
  7. From MediaWiki 1.39.0-wmf.6 (). See phab:T251672.