Predefinição:Documentation/doc

Da Thinkfn
< Predefinição:Documentation
Revisão das 08h56min de 15 de novembro de 2008 por Bmwmb (discussão | contribs)

Esta predefinição, {{documentation}}, transcreve e inclui (transclui) uma página de documentação para dentro da página de código de outra predefinição. Esse processo está a ocorrer neste momento: o texto que está a ler, não está na página Predefinição:Documentation, que é a página do código de {{documentation}}, mas sim na página Predefinição:Documentation/doc.

O uso de {{documentation}} dentro de uma predefinição, tal como aqui foi feito, permite que o código da predefinição seja protegido enquanto que a respectiva documentação, que está noutra página, pode continuar a ser editada pelos utilizadores.

Uso

Para usar {{documentation}} adicione o seguinte código após o código da predefinição:

<noinclude>{{documentation}}<noinclude>

Não deve ser deixado qualquer espaço ou quebra de linha antes do <noinclude> inicial, porque isso pode causar espaçamentos extra onde a predefinição for usada.

Por omissão, a página que é incluida tem o mesmo nome e o sufixo /doc. No entanto, é possível usar o parâmetro para incluir outra página:

<noinclude>{{documentation|<nome da outra página>}}<noinclude>

Best practice

This code should be added at the bottom of the template code, with no extra space before "<noinclude>" (which would cause extra space on pages where the template is used). The parameter can be used as shown above to transclude an arbitrary documentation page.

Categories and interwiki links that apply to the template itself should be added to the documentation page, inside <includeonly> </includeonly> tags. For more complex cases, see Wikipedia:Template documentation‎#Categories and interwiki links.

If the documentation page contains includeonly or noinclude tags as part of the documentation, replace the "<" with "&lt;".


In-line content

<noinclude>{{Documentation|content=This is documentation.}}</noinclude>

In-line content with [view][edit] links

<noinclude>{{Documentation
|1 = Template:any page/doc
|content ={{Template:any page/doc|parameters}}
}}</noinclude>

Customizing display

Overrides exist to customize the output in special cases:

  • {{documentation| heading = ...}} − change the text of the "documentation" heading. If this is set to blank, the entire heading line (including the first [edit] link) will also disappear.

Functions

If the documentation page doesn't exist, the "edit" link includes a preload parameter so that clicking it will pre-fill the edit form with the basic documentation page format.