Uitbreiding: Teksie-afdeling Transklusie

This page is a translated version of the page Extension:Labeled Section Transclusion and the translation is 29% complete.
MediaWiki extensions manual
Labeled Section Transclusion
Release status: stable
Implementation Tag , Parser function
Description Toelaat om gemeerkde dele van di text asook te sluit
Author(s) Steve Sanbeg
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.19+
Database changes No
License GNU General Public License 2.0 or later
Download
Public wikis using 6,919 (Ranked 26th)
Translate the Labeled Section Transclusion extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

The Labeled Section Transclusion extension allows selective transclusion of marked-off sections of text, parsing wikitext as normal. Its functionality is similar to an enhanced version of the ‎<onlyinclude> tag with normal wiki transclusion, which selects sections for inclusion. It is enabled on all Wikimedia wikis.

Terwyl normale transklusie hoofsaaklik bedoel is om groot dele van klein sjablone te transkluseer, is die transklusie van gedeeltes met die etiket bedoel vir klein dele van groot bladsye.

Daar is egter' n paar verskille. In die moedertaal sjabloon transklusie, afdelings word gemerk deur gedrag; dus kan jy net een (waarskynlik nie-kontingente) afdeling om ingesluit te word of geskoop.

Hier word afdelings deur name gemerk, en gedrag word deur die beller gekies, wat afdelings kan insluit of oorskakel indien nodig. Verskillende bladsye kan geselekteerde afdelings insluit of uitsluit; daar kan willekeurige getalle afdelings wees, wat ook willekeurig oorlaai kan word.

Deur afdelings eerder deur naam as deur gedrag te merk, kan die redigeer-afdelingskakels meer geskik weergegee word om uittreksels uit groter tekste te kry, aangesien die uitbreiding nou kan rekening hou met afdelings wat aan die begin van die bladsy oorgeslaan word, sodat transklodeerde afdelings behoorlik gecompenseer kan word.

Installasie

  • Download and move the extracted LabeledSectionTransclusion folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/LabeledSectionTransclusion
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'LabeledSectionTransclusion' );
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

There is also a Gadget in use on Wikisource.org wikis that makes it possible to define sections with a simplified ## label ## syntax. Die kode kan gevind word teen Wikisource:MediaWiki:Gadget-Easy_LST.js.

Functions

Transclude any marked part

Stap 1: Baken af categories

Merk af dele in die teks met behulp van $ afdeling tags soos hierdie:

<section begin="chapter1" />this is chapter 1<section end="chapter1" />

Let daarop dat hierdie etikette nie HTML / XML is nie, en gebruik nie die normale atribuaat sintaksis nie. Om hierdie rede, en omdat die begin en einde-merkers individueel is, eerder as normale XML oop / sluit-etikette, kan dit ingeslote of oorlappende afdelings toelaat. Dit laat jou toe om afdelingsetikette in te voeg sonder om bekommerd te wees oor die interferensie met ander afdelings.MinT


Step 2a: Transclude the section

Bel die parser funksie #lst om dit te sluit, dit wil sê om 'n gedeelte genaamd $seksie te sluit van 'n bladsy genaamd articleX:MinT

{{#lst:articleX|chapter1}}

Die teikenartikel definieer die ligging van die gedeelte; sy gedrag word bepaal deur die parserfunksie.MinT

Step 2b: Transclude the page but excluding the section

To transclude a page, but exclude a specified section, use the #lstx function:

{{#lstx:articleX|chapter1}}

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

{{#lstx:articleX|chapter1|replacement_text}}

Example:

{{#lstx:articleX|chapter1|See chapter 1 in [[articleX]].}}

Die vervangende teks sal in die area verskyn waar die gedeelte oorgeslaan word (uitgesluit).

Discontiguous sections

Dit is moontlik om verskeie afdelings met dieselfde naam te hê; in hierdie geval sal elke afdeling met daardie naam ingesluit/ uitgesluit word. Dit is veral nuttig om verskeie besprekings te merk.MinT

Section ranges

These functions have an additional, optional argument to specify a section range; i.e. {{#lst:articleX|chapter1|chapter3}}, 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

Dit werk ook met vervanging; dit is selfs moontlik vir 'n artikel om 'n gedeelte van homself te vervang. Een gebruik hiervan bied 'n netjiese manier om besprekingsbladsye te argief: Merk die teks wat geargiewe moet word met behulp van <section begin=archive />, ens. Maak dan 'n argiefbladsy met die teks, met behulp {{subst:#lst:talk_page|archive}}, wat geargeerde afdelings kopieer. Ten slotte, vervang die inhoud van $ 1 met $ kode 3 om daardie afdelings te verwyder.verwyder.Maintain

wikitext

Transclude before the first heading

Privacy Checkup Effective support for open source software projects sharing your information for educational purposes about the same protections described above

{{#lsth:pagename}}

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

{{#lsth:pagename|sectionX}}

Things to note:

  1. Only the first occurrence of the sectionX is transcluded if you have more than one section with the same name.
  1. Make sure you type what the heading of sectionX is in wikitext, not how it is displayed. For example if the heading of the section is ==List of [[Extension]]==, you should type "List of [[Extension]]" not "List of Extension".
  1. When transcluding a section from a page marked for translation using the translate extension, transclude from the language-specific version.

E.g. from pagename/en rather than from pagename.

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

{{#lsth:pagename|sectionX|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.

function Engels Duits Hebreeus (RTL) Portugees
#lst #section #Abschnitt
#קטע
#trecho
#lstx #section-x #Abschnitt-x
#בלי קטע
#trecho-x
#lsth #section-h

Additionally, the tag can now be localised; currently:

Engels, Duits, Hebreeus, Portugees; i.e.:

Engels
<section begin=x/> ... <section end=x/>
Duits
<Abschnitt Anfang=x/> ... <Abschnitt Ende=x/>
Hebreeus (RTL)
<קטע התחלה=א> ... <קטע סוף=א> ("start" code to the right and "end" code to the left)
Portugees
<trecho começo=x/> ... <trecho fim=x/>

Each localization is enabled only if the page matches the respective content language.

Limitations

  • {{#lsth:pagename|sectionX}} only works on the first section if multiple sections have name sectionX. Only the first occurrence of sectionX is transcluded if an article has more than one section with the same name.
  • 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. {{#lst:}} and {{#lstx:}} work only if section tags appear directly in the wikitext of the transcluded page. This means, for instance, that these tags cannot be embedded in a template using template parameters and parser functions. The #tag magic word does not work with section tags.
  • As of 2014, section tags don't have any effect when used inside a template parameter. If page A contains a text {{B|X}}, there's no way {{#lst:A|...}} can access X.

Examples

See also