Extension:Labeled Section Transclusion/pt-br

Esta extensão permite transclusão seletiva de seções marcadas fora do texto. Sua funcionalidade é semelhante a uma versão melhorada da tag com transclusão wiki normal, que seleciona as seções para a inclusão. Está habilitada em todas as wikis da Wikimedia.

Enquanto a transclusão normal é destinada principalmente para transcluir grandes porções de pequenas predefinições, a transclusão etiquetadas de seções destina-se a pequenas porções de páginas grandes.

No entanto, existem algumas diferenças. Na transclusão de predefinição nativa, as seções são marcadas por comportamentos; portanto, você pode ter apenas uma seção (possivelmente não contígua) a ser incluída ou ignorada.

Aqui, as seções são marcadas por nome, e o comportamento é escolhido pelo autor da chamada, que pode incluir ou pular seções, conforme necessário. Diferentes páginas podem incluir ou excluir seções selecionadas; pode haver números arbitrários de seções, que também podem se sobrepor de forma arbitrária.

A marcação de seções por nome em vez de comportamento permite que links de edição de seção sejam processados de forma mais adequada para obter trechos de texto maiores, já que a extensão pode agora responder por seções que são ignoradas no início da página, permitindo seções transcluídas sejam compensadas de forma adequada.

Passo 1: Marque as seções
Marque as seções no texto usando tags, desta maneira:

&lt;translate>this is a chapter&lt;/translate>

Observe que ela utiliza dois marcadores individuais, em vez das tags XML normais de abertura e fechamento, o que simplifica seções aninhadas ou sobrepostas. Isso permite que você insira marcas de seção sem se preocupar com a interferência com outras seções.

Passo 2a: Transclua a seção
Chame a parser function #lst para transclui-la, p.ex. para transcluir uma seção chamada chapter1 de uma página chamada articleX:

O artigo de destino define o local da seção; o seu comportamento é determinado pela parser function.

Passo 2b: Transclua a página, mas excluindo a seção
Para transcluir uma página, porém excluindo uma seção específica, utilize a função #lstx:

Opcionalmente, você pode adicionar o texto de substituição para a seção excluída.

Exemplo:

O texto de substituição será exibido na área onde a seção é ignorada (excluída).

Seções adjacentes
It is possible to have multiple sections with the same name; in this case, every section with that name will be included/excluded. This is especially useful to mark various discussions.

Section ranges
These functions have an additional, optional argument to specify a section range; i.e., to include everything from the beginning of chapter 1 to the end of chapter 3. This allows using empty marker pairs to mark one end of the section, possibly in a template. A similar mechanism is currently used at the French Wikisource.

Substitution
This also works with substitution; it's even possible for an article to substitute a section of itself. One use of this provides a neat way to archive talk pages: Mark the text to be archived using, etc. Then create an archive page with the text, using archive , which copies archived sections. Lastly, replace the contents of talk_page with archive to remove those sections.

Transcluding sections by headings
There is optional support for transcluding sections of text marked with the normal headings, i.e. . If installed, this is done with the lsth function.

Transclude the introduction
To transclude the introduction of a page (i.e. the content before the first heading), use

Transclude a specific section
You can also transclude the whole content of the sectionX (which includes all its sub-sections but excludes the heading of sectionX itself).

Things to note:


 * 1) Only the first occurrence of the sectionX is transcluded if you have more than one section with the same name.
 * 2) Make sure you type what the heading of sectionX is in wiki code, not how it is displayed. For example if the heading of the section is  , you should type " " not " ".
 * 3) The matching is case insensitive, to prevent links from breaking due to case changes.

Transclude multiple sections
You can also transclude from the first occurrence of sectionX (excluding the heading of sectionX itself) until it reaches the next occurrence of sectionY. Note that sectionY acts as a stop point so the transclusion doesn't contain the content of sectionY.

Notes about skipped headings
Since the traditional transclusion in MediaWiki isn't intended to transclude sections, it doesn't account for skipped headings. As a result, if you were to transclude a template with multiple headings, and skip the first heading, then all of the edit sections links would point to the wrong section in the template.

When this extension is used (with MediaWiki 1.9 or later), the #lst and #lsth functions count headings in the "skipped" beginning part, and offset transcluded headings appropriately. This will allow these links to point to the correct section in the simple case.

Note that #lstx does not count skipped headings, and that skipped headings within discontiguous sections are not offset. '''But it seems it has been fixed now (likely when ported to MediaWiki's new preprocessor). The transcluded headings can be linked to the correct sections'''.

Localisation
Internally, the parser functions all use the lst prefix, for consistency with the name of the extension. Since this acronym may be confusing to non-developers, readable English variants have been introduced, so the functions can currently be called from either name.

Additionally, the tag can now be localised (currently English, German, and Hebrew), i.e.:


 * English: ...
 * German:  ... 
 * Hebrew (RTL): <קטע התחלה=א> ... <קטע סוף=א> ("start" code to the right and "end" code to the left)
 * Portuguese:  ...

Limitations

 * While it is possible to use this extension across namespaces, interwiki references are not resolved. It is not yet possible, for example, to include part of a Wikisource page into a remote MediaWiki installation.
 * Section tags cannot themselves be transcluded in order to work on other pages. This means, for instance, that these tags cannot be embedded in a template using template parameters and parser functions. The  magic word does not work with section tags.   produces balanced tags, while the section tags uses singular tags. See.

Requirements
This extension requires a MediaWiki installation with support for parser functions. This support was mature in the 1.7 series, although some 1.6 versions may also be made to work.

MediaWiki parser enhancements
Support for regression testing parser functions was added in MediaWiki 1.9alpha (17410) in order to test this extension; if you want to run the regression tests in an older installation, you'll need to apply the patch for maintenance/ParserTests.inc from 7801

Support for offsetting edit section links (so that it can detect sections that aren't transcluded, and skip them) was added in MediaWiki 1.9alpha (18218).

How to install
Copy the files of the extension from Subversion, and put it in your extensions directory. Then, include it in the LocalSettings.php:

To enable transcluding visual sections, also add

Since the code is still undergoing some restructuring in preparation for deployment on the official projects, the internal functions may change from time to time. Although there is currently no public API to call these functions, DynamicPageList2 calls some of the internal functions directly. To make this more stable, the file compat.php has been added, in order to provide a more consistent API. This file is not used by LST, and is only provided for compatibility with DPL2.

If you are using DPL2, you should also add

Examples

 * wikisource:user:sanbeg/Includer is an early demonstration that shows several of the basic features.
 * Bible/2_John/1/1 is one of the first content pages to use the extension.