„Wikipedia:Technik/Skin/Gadgets/annotationPair“ – Versionsunterschied
AZ: Die Seite wurde neu angelegt: {{SeitenordnungWP.de | PageID = {{subst:PAGEID}} | Obereinordnung1 = ∆MW-Verwaltung }} |
KKeine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
{{SeitenordnungWP.de | {{SeitenordnungWP.de | ||
| PageID = | | PageID = 93211 | ||
| Obereinordnung1 = ∆MW-Verwaltung | | Obereinordnung1 = ∆MW-Verwaltung | ||
}} | }} | ||
{{../../../!header | |||
|Text={{SUBPAGENAME}} | |||
|Shortcut=WP:HW/{{SUBPAGENAME}}}} | |||
Das ''Gadget'' '''{{SUBPAGENAME}}''' unterstützt paarweise innere Verlinkungen. | |||
Insbesondere die gegenseitige Verlinkung von [[Vorlage:FN]] und zugehörigem [[Vorlage:FNZ]] wird hergestellt. | |||
{{../!Aktivierung |hidden=1}} | |||
== Profil == | |||
{{MediaWikiGadgetDefinition | |||
|ID={{SUBPAGENAME}} | |||
|ResourceLoader=1 | |||
|default=1 | |||
|hidden=1 | |||
|actions=edit,view | |||
|categories=MediaWiki:Gadget/{{SUBPAGENAME}} | |||
|scripts={{SUBPAGENAME}}.js | |||
}} | |||
== Functionality == | |||
The 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 <code>id=</code> attributes, and HTML is valid. | |||
* Duplicated <code>id=</code> is invalid HTML and LINT error since fall 2024. | |||
=== Example === | |||
There might be two tables in a page: | |||
{| class="wikitable" | |||
|+ French | |||
|- | |||
| un<sup id="back-1-1">[[#ann-1-1|1)]]</sup> | |||
|- | |||
| une<sup>[[#ann-1-1|1)]]</sup> | |||
|- | |||
| deux<sup id="back-1-2">[[#ann-1-2|2)]]</sup> | |||
|- | |||
| trois<sup>3)</sup> | |||
|} | |||
<sup id="ann-1-1">[[#back-1-1|1)]]</sup> French word for number <code>1</code>.<br /> | |||
<sup id="ann-1-2">[[#back-1-2|2)]]</sup> French word for number <code>2</code>. | |||
{| class="wikitable" | |||
|+ German | |||
|- | |||
| Eins<sup id="back-2-1">[[#ann-2-1|1)]]</sup> | |||
|- | |||
| Zwei<sup>[[#ann-2-2|1)]]</sup> | |||
|- | |||
| Zwo<sup id="back-2-2">[[#ann-2-2|2)]]</sup> | |||
|} | |||
<sup id="ann-2-1">[[#back-2-1|1)]]</sup> German word for number <code>1</code>.<br /> | |||
<sup id="ann-2-2">[[#back-2-2|2)]]</sup> German word for number <code>2</code>.<br /> | |||
<sup>3)</sup> German word for number <code>3</code>. | |||
''Please note:'' | |||
* The same markers <code>1)</code> and <code>2)</code> are used for both tables. | |||
* French ''trois'' marker is not linked since there is no explanation available. | |||
* German <code>3</code> has no backlink since no item requires an explanation. | |||
=== Syntax === | |||
The things to be explained need to be equipped with a ''M''arker: | |||
<pre> | |||
<WRAP class="reference"> | |||
<TAG data-annotationpair-m="ID">TEXT</TAG> | |||
</WRAP> | |||
</pre> | |||
The ''A''nnotation or explanation is introduced by the following element: | |||
<pre> | |||
<WRAP class="references"> | |||
<TAG data-annotationpair-a="ID">TEXT</TAG> | |||
<EXPLAIN class="reference-text">...</EXPLAIN> | |||
</WRAP> | |||
</pre> | |||
With placeholders in capital letters: | |||
<div style="margin-left:2em"> | |||
; ID | |||
: The identifier, connecting one or many <code>-m</code> items with one <code>-a</code> item. | |||
: Any URL encoded non-reserved characters may be used. | |||
; TAG | |||
: Any HTML element permitted in Wikitext. | |||
: Usually <code><sup></code> will be used, but any other may be used as well. | |||
: A different TAG may be used for any <code>-m</code> item and the corresponding <code>-a</code> 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 <code>-m</code> items and the matching <code>-a</code> 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 <code>class="reference"</code> and <code>class="references"</code> simulation of ''cite'' to support preview popups. | |||
; EXPLAIN | |||
: Arbitrary element for hosting <code style="white-space:nowrap">class="reference-text"</code> or <code style="white-space:nowrap">class="mw-reference-text"</code> to support preview popups. | |||
</div> | |||
Within one group the <code>-m</code> items may occur one or many times. | |||
* If an <code>-a</code> element is repeated within the same group, only the first one is considered. | |||
=== Grouping === | |||
Within a page, many groups of <code>-m</code> and <code>-a</code> elements may occur, which do not interfere. | |||
* They might begin with | |||
** either the <code>-m</code> annotated things, followed by corresponding <code>-a</code> explanations (“legend” mode, below), or | |||
** the <code>-a</code> annotation may precede the <code>-m</code> items (“caption” mode, on top). | |||
Every second switch between <code>-m</code> and <code>-a</code> or <code>-a</code> and <code>-m</code> 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 === | |||
Each pair of corresponding items will be linked with | |||
<pre> | |||
<a href="#annotationpair-1-ID-0" id="annotationpair-1-ID-1"><TAG>TEXT</TAG></a> | |||
</pre> | |||
and | |||
<pre> | |||
<a href="#" id="annotationpair-1-ID-0"><TAG>TEXT</TAG></a> | |||
</pre> | |||
* The first <code>-1-</code> indicates the group number. | |||
* A terminating <code>-1</code> identifies multiple markers of same ID, and <code>-0</code> is the annotation. | |||
* Further attributes within <code><TAG></code> will remain, but <code style="white-space:nowrap">data-annotationpair-*="ID"</code> are removed. | |||
* The backlink <code>href="#"</code> goes nowhere, but is superposed by event listener returning to individual marker. | |||
* The marker <code>href="#annotationpair-1-ID-0"</code> is equipped with an event listener memorizing the most recent click. | |||
* If backlink <code>href="#"</code> properties are matching the most recent click, the individual item will be the target, otherwise the <code>-1</code> marker of first mentioned item. | |||
=== Test page === | |||
Please see [[Vorlage:FN/Test]]. | |||
== Änderungswünsche == | |||
Bitte auf [[../../MediaWiki/Änderungen|MediaWiki/Änderungen]] vorschlagen. | |||
[[Kategorie:Wikipedia:Technik/Skin/Gadgets|{{SUBPAGENAME}}]] | |||
Aktuelle Version vom 28. September 2026, 07:24 Uhr
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://aufeinwort.info/w/load.php?modules=ext.gadget.annotationPair" );
Profil
| annotationPair: Unterstützung der FN-Vorlagenfamilie | |
| Eigenschaft | Zuweisung |
|---|---|
| ResourceLoader | unterstützt |
| default | Vorgabe für alle |
| hidden | versteckt |
| actions | editview |
| categories | Kategorie:MediaWiki:Gadget/annotationPair |
| scripts | annotationPair.js |
* annotationPair[ResourceLoader|default|hidden|actions=edit,view|categories=MediaWiki:Gadget/annotationPair]|annotationPair.jsFunctionality
The 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
There 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
3has no backlink since no item requires an explanation.
Syntax
The 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
-mitems with one-aitem. - 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
-mitem and the corresponding-aelement. - 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
-mitems and the matching-aitem 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
-aelement is repeated within the same group, only the first one is considered.
Grouping
Within a page, many groups of -m and -a elements may occur, which do not interfere.
- They might begin with
- either the
-mannotated things, followed by corresponding-aexplanations (“legend” mode, below), or - the
-aannotation may precede the-mitems (“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
Each 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
-1identifies multiple markers of same ID, and-0is 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-1marker of first mentioned item.
Test page
Please see Vorlage:FN/Test.
Änderungswünsche
Bitte auf MediaWiki/Änderungen vorschlagen.