Extension:Labeled Section Transclusion/ca

Aquesta extensió permet la transclusió selectiva de les seccions marcades fora de text (o que no es visualitzen en el lloc on són declarades). La seva funcionalitat és similar a una versió millorada de l'etiqueta amb transclusió wiki normal, que selecciona seccions per a la inclusió. Està habilitat en tots els wikis de Wikimedia.

Mentre que la transclusió normal està destinada principalment a transcloure grans porcions de plantilles petites, la transclusió de la secció etiquetada està destinada per a petites porcions de pàgines grans.

No obstant això, hi ha algunes diferències. En la transclusió de la plantilla nativa, les seccions estan marcades pel comportament; per tant podeu tenir només una secció (possiblement no contigua) per ser inclosa o saltada.

Aquí, les seccions estan marcats pel seu nom, i el comportament és elegit pel qui fa la crida, que pot incloure o ometre seccions, segons sigui necessari. Diferents pàgines poden incloure o excloure seccions seleccionades; pot haver-hi un nombre arbitrari de seccions, que també es poden solapar arbitràriament.

En marcar les seccions per nom en lloc de comportament permet enllaços de secció d'edició a ser prestats de manera més apropiada per obtenir extractes a partir de textos més grans, ja que l'extensió ara pot adonar de seccions que s'ometen en el principi de la pàgina, permetent que les seccions transcluoses es compensin adequadament.

Step 1: Mark off sections
Mark off sections in the text using tags like this:

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

Note that this uses two individual markers, rather than normal XML open/close tags, which simplifies nested or overlapping sections. This allows you to insert section tags without worrying about interfering with other sections.

Step 2a: Transclude the section
Call the parser function #lst to transclude it, i.e. to transclude a section called chapter1 from a page called articleX:

The target article defines the location of the section; its behavior is determined by the parser function.

Step 2b: Transclude the page but excluding the section
To transclude a page, but exclude a specified section, use the #lstx function:

Optionally, you may add replacement text to the excluded section.

Exemple:

The replacement text will appear in the area where the section is skipped (excluded).

Discontiguous sections
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'''.

Localització
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.:


 * Anglés: ...
 * Alemany:  ... 
 * Hebreu (RTL): <קטע התחלה=א> ... <קטע סוף=א> ("start" code to the right and "end" code to the left)
 * Portuguès:  ...

Limitacions

 * 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.
 * As of 2014, section tags don't have any effect when used inside a template parameter. If page A contains a text, there's no way  can access X.

Requisits
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:

Exemples

 * 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.

Vegeu també

 * Subversion download
 * Brion's comments on the application of the extension at Wikisource
 * The original proposal (at en.wikisource)
 * 5881 contains older versions of the extension as attachments.
 * 7995 is a Wikimedia site request to have this extension installed at Wikisource.
 * 6563 describes a limitation in template transclusion that is addressed by this extension.
 * DynamicPageList (third-party) includes a slightly modified built-in version of Labeled Section Transclusion