Wikipedia:Technik/Skin/Gadgets/annotationPair
annotationPair
Das Gadget annotationPair unterstützt paarweise innere Verlinkungen.
Insbesondere die gegenseitige Verlinkung von Vorlage:FN und zugehörigem Vorlage:FNZ wird hergestellt.
Das Gadget kann nicht über Helferlein-Einstellungen individuell aktiviert oder deaktiviert werden. Aus anderen Wikis – insbesondere global – (und auch außerhalb der WMF) ist möglich:
mw.loader.load( "https://de.wikipedia.org/w/load.php?modules=ext.gadget.annotationPair" );
Profil
BearbeitenannotationPair: Unterstützung der FN-Vorlagenfamilie | |
Eigenschaft | Zuweisung |
---|---|
ResourceLoader | unterstützt |
default | Vorgabe für alle |
hidden | versteckt |
actions | view edit |
categories | Kategorie:MediaWiki:Gadget/annotationPair |
scripts | annotationPair.js |
* annotationPair[ResourceLoader|default|hidden|actions=view,edit|categories=MediaWiki:Gadget/annotationPair]|annotationPair.js
actions
view edit edit viewFunctionality
BearbeitenThe purpose is to connect within a wiki page multiple groups of things that need an annotation with a corresponding remark.
- Only valid pairs shall be equipped, and the same marker may be used within different groups.
- It shall be possible to jump back from explanation to the annotation mark.
- Valid HTML is produced.
- As long the gadget was not executed there are no links nor
id=
attributes, and HTML is valid. - Duplicated
id=
is invalid HTML and LINT error since fall 2024.
Example
BearbeitenThere might be two tables in a page:
un1) |
une1) |
deux2) |
trois3) |
1) French word for number 1
.
2) French word for number 2
.
Eins1) |
Zwei1) |
Zwo2) |
1) German word for number 1
.
2) German word for number 2
.
3) German word for number 3
.
Please note:
- The same markers
1)
and2)
are used for both tables. - French trois marker is not linked since there is no explanation available.
- German
3
has no backlink since no item requires an explanation.
Syntax
BearbeitenThe things to be explained need to be equipped with a Marker:
<WRAP class="reference"> <TAG data-annotationpair-m="ID">TEXT</TAG> </WRAP>
The Annotation or explanation is introduced by the following element:
<WRAP class="references"> <TAG data-annotationpair-a="ID">TEXT</TAG> <EXPLAIN class="reference-text">...</EXPLAIN> </WRAP>
With placeholders in capital letters:
- ID
- The identifier, connecting one or many
-m
items with one-a
item. - Any URL encoded non-reserved characters may be used.
- TAG
- Any HTML element permitted in Wikitext.
- Usually
<sup>
will be used, but any other may be used as well. - A different TAG may be used for any
-m
item and the corresponding-a
element. - TEXT
- Any text which may be used as link text.
- This is every text without links and image transclusion, nor breaks.
- Inline markup is possible.
- To avoid confusion, the TEXT of
-m
items and the matching-a
item will be more or less the same. However, this is no software requirement. - Probably TEXT and ID have the same content.
- WRAP
- Arbitrary element for hosting
class="reference"
andclass="references"
simulation of cite to support preview popups. - EXPLAIN
- Arbitrary element for hosting
class="reference-text"
orclass="mw-reference-text"
to support preview popups.
Within one group the -m
items may occur one or many times.
- If an
-a
element is repeated within the same group, only the first one is considered.
Grouping
BearbeitenWithin a page, many groups of -m
and -a
elements may occur, which do not interfere.
- They might begin with
- either the
-m
annotated things, followed by corresponding-a
explanations (“legend” mode, below), or - the
-a
annotation may precede the-m
items (“caption” mode, on top).
- either the
Every second switch between -m
and -a
or -a
and -m
repectively will create a limitation.
- The first detected element decides upon the rhythm.
- A single (unpaired) block remaining will be ignored.
Grouping is administrated by the gadget.
Effect
BearbeitenEach pair of corresponding items will be linked with
<a href="#annotationpair-1-ID-0" id="annotationpair-1-ID-1"><TAG>TEXT</TAG></a>
and
<a href="#" id="annotationpair-1-ID-0"><TAG>TEXT</TAG></a>
- The first
-1-
indicates the group number. - A terminating
-1
identifies multiple markers of same ID, and-0
is the annotation. - Further attributes within
<TAG>
will remain, butdata-annotationpair-*="ID"
are removed. - The backlink
href="#"
goes nowhere, but is superposed by event listener returning to individual marker. - The marker
href="#annotationpair-1-ID-0"
is equipped with an event listener memorizing the most recent click. - If backlink
href="#"
properties are matching the most recent click, the individual item will be the target, otherwise the-1
marker of first mentioned item.
Test page
BearbeitenPlease see Vorlage:FN/Test.
Änderungswünsche
BearbeitenBitte auf MediaWiki/Änderungen vorschlagen.