Extension:Labeled Section Transclusion/de
Labeled Section Transclusion Freigabestatus: stabil |
|
---|---|
Einbindung | Tag , Parser-Funktion |
Beschreibung | Erlaubt das Transkludieren markierter Bereiche |
Autor(en) | Steve Sanbeg |
Kompatibilitätspolitik | Snapshots werden zusammen mit MediaWiki veröffentlicht. Der Master ist nicht abwärtskompatibel. |
MediaWiki | 1.19+ |
Datenbankänderungen | Nein |
Lizenz | GNU General Public License 2.0 oder neuer |
Herunterladen | |
Public wikis using | 6,919 (Ranked 26th) |
Übersetze die Labeled Section Transclusion-Erweiterung, wenn sie auf translatewiki.net verfügbar ist | |
Probleme | Offene Aufgaben · Einen Fehler melden |
Diese Erweiterung erlaubt das teilweise Transkludieren von markierten Textabschnitten. Die Funktionalität ähnelt der erweiterten Version des <onlyinclude>
Tags mit normaler Transklusion, die Sektionen für das Inkludieren auswählt. Diese Erweiterung ist bei allen Wikimedia-Wikis aktiviert.
While normal transclusion is primarily intended to transclude large portions of small templates, labeled section transclusion is intended for small portions of large pages.
However, there are some differences. In the native template transclusion, sections are marked by behavior; thus you can have only one (possibly non-contiguous) section to be included or skipped.
Here, sections are marked by name, and behavior is chosen by the caller, which can include or skip sections as needed. Different pages can include or exclude selected sections; there can be arbitrary numbers of sections, which can also overlap arbitrarily.
Marking sections by name rather than behavior allows edit section links to be rendered more appropriately for getting excerpts from larger texts, since the extension can now account for sections that are skipped in the beginning of the page, allowing transcluded sections to be offset appropriately.
Installation
- Die Erweiterung herunterladen und die Datei(en) in ein Verzeichnis namens
LabeledSectionTransclusion
im Ordnerextensions/
ablegen.
Entwickler und Code-Beitragende sollten stattdessen die Erweiterung von Git installieren, mit:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/LabeledSectionTransclusion - Folgenden Code am Ende deiner LocalSettings.php -Datei einfügen:
wfLoadExtension( 'LabeledSectionTransclusion' );
- Erledigt – Navigiere zu Special:Version in deinem Wiki, um zu überprüfen, ob die Erweiterung erfolgreich installiert wurde.
There is also a Gadget in use on Wikisource.org wikis that makes it possible to define sections with a simplified ## label ##
syntax.
Its code can be found at Wikisource:MediaWiki:Gadget-Easy_LST.js.
Functions
Transclude any marked part
Schritt 1: Markiere Abschnitte
Markiere Abschnitte mit dem <section>
Tag wie folgt:
<section begin="chapter1" />this is chapter 1<section end="chapter1" />
Beachte dass diese Tags kein HTML/XML sind und daher nicht die normale Syntax verwenden. Aus diesem Grund (und da Beginn- und End-Markierung einzeln existieren) sind, im Gegensatz zu normalen öffnenden/schließenden XML-Tags, auch geschachtelte oder überlappende Abschnitte erlaubt. Daher können diese Abschnitt-Tags auch eingefügt werden ohne andere bereits existierende Abschnitte zu (zer-)stören.
Step 2a: Transklusion des Bereiches
Rufe die Parser-Funktion #lst auf, um es zu transkludieren. Hier z.B. den Abschnitt namens chapter1 von Seite articleX:
{{#lst:articleX|chapter1}}
Der transkludierende Artikel definiert so den Ort des Abschnitts, das Verhalten bestimmt die Parser-Funktion.
Schritt 2b: Transklusion einer Seite ohne spezifischen Abschnitt
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}}
Beispiel:
{{#lstx:articleX|chapter1|See chapter 1 in [[articleX]].}}
The replacement text will appear in the area where the section is skipped (excluded).
Unterbrochene Bereiche
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. {{#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.
Ersetzung
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 <section begin=archive />
, etc. Then create an archive page with the text, using {{subst:#lst:talk_page|archive}}, which copies archived sections. Lastly, replace the contents of talk_page with {{subst:#lstx:talk_page|archive}} to remove those sections.
There is optional support for transcluding sections of text marked with the normal headings, i.e. ==this section==
. If installed, this is done with the lsth function.
Transclude before the first heading
To transclude the introduction of a page (i.e. the content before the first heading), use
{{#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}}
Zu beachten:
- Only the first occurrence of the sectionX is transcluded if you have more than one section with the same name.
- 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
".
- 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.
- 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.
Lokalisierung
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.
Funktion | Englisch | Deutsch | Hebräisch (RTL) | Portugiesisch |
---|---|---|---|---|
#lst | #section | #Abschnitt | #קטע |
#trecho |
#lstx | #section-x | #Abschnitt-x | #בלי קטע |
#trecho-x |
#lsth | #section-h |
Additionally, the tag can now be localised; currently:
Englisch, Deutsch, Hebräisch, Portugiesisch; z.B.:
- Englisch
<section begin=x/> ... <section end=x/>
- Deutsch
<Abschnitt Anfang=x/> ... <Abschnitt Ende=x/>
- Hebräisch (RTL)
<קטע התחלה=א> ... <קטע סוף=א>
("start" code to the right and "end" code to the left)- Portugiesisch
<trecho começo=x/> ... <trecho fim=x/>
Each localization is enabled only if the page matches the respective content language.
Beschränkungen
- {{#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.
Beispiele
- wikisource:user:sanbeg/Includer - an early demonstration that shows several of the basic features.
Siehe auch
- DynamicPageList (third-party) includes a slightly modified built-in version of Labeled Section Transclusion
Diese Erweiterung wird in einem oder mehreren Wikis von Wikimedia verwendet. Das bedeutet mit hoher Wahrscheinlichkeit, dass die Erweiterung stabil ist und gut genug funktioniert, um auf solch häufig besuchten Webseiten benutzt zu werden. Suche nach dem Erweiterungs-Namen in den Wikimedia CommonSettings.php und den InitialiseSettings.php-Konfigurations-Dateien, um nachzusehen, wo es installiert ist. Eine vollständige Liste der installierten Erweiterungen in einem bestimmten Wiki wird auf Special:Version im Wiki generiert und angezeigt. |
Diese Erweiterung ist in den folgenden Softwarepaketen enthalten und/oder wird von den folgenden Wiki-Farmen, bzw. Wiki-Hostern verwendet: Dies ist keine maßgebliche Liste. Softwarepakete und/oder Wiki-Farmen, bzw. Wiki-Hoster nutzen diese Erweiterung ggf., obwohl sie nicht in dieser Liste enthalten sind. Prüfe daher stets die Nutzung im verwendeten Softwarepaket und/oder bei der Wiki-Farm, bzw. dem Wiki-Hoster. |
- Stable extensions/de
- Tag extensions/de
- Parser function extensions/de
- GPL licensed extensions/de
- Extensions in Wikimedia version control/de
- ParserFirstCallInit extensions/de
- All extensions/de
- Extensions used on Wikimedia/de
- Extensions included in Canasta/de
- Extensions included in Fandom/de
- Extensions included in Miraheze/de
- Extensions included in MyWikis/de
- Extensions included in wiki.gg/de
- Extensions included in WikiForge/de