Wikipedia:Technik/Skin/Gadgets/annotationPair

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

annotationPair


Das Gadget annotationPair unterstützt paarweise innere Verlinkungen.

Insbesondere die gegenseitige Verlinkung von Vorlage:FN und zugehörigem Vorlage:FNZ wird hergestellt.

Aktivierung

Der leichteste Weg wäre als angemeldeter Benutzer durch einfaches Ankreuzen. Wikipedia:Technik/Skin/Gadgets/!Einstellung Es kann sein, dass man das anders handhaben möchte:

  • Als nicht angemeldeter Benutzer über Greasemonkey.
  • In einem anderen Wiki oder global.
  • Nur unter bestimmten, programmatisch formulierten Bedingungen.
  • Auf Mobilgeräten; die Standard-Aktivierung des Projekts wirkt nur bei Desktop.

Aus jeder Seite der deutschsprachigen Wikipedia heraus funktioniert dann mittels JavaScript:

mw.loader.load( "ext.gadget.annotationPair" );

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" );
annotationPair
annotationPair – Unterstützung der Vorlage:FN mit Vorlage:FNZ
EigenschaftZuweisung
ResourceLoaderunterstützt
defaultVorgabe für alle
hiddenversteckt
actionsviewedit
categoriesKategorie:MediaWiki:Gadget/annotationPair
scriptsannotationPair.js
* annotationPair[ResourceLoader|default|hidden|actions=view,edit|categories=MediaWiki:Gadget/annotationPair]|annotationPair.js
Aktive Spezifikation.

Functionality

[Quelltext bearbeiten]

The purpose is to connect within a wiki page multiple groups of things that need an annotation with a corresponding remark.

  • Only vaiid 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.

There might be two tables in a page:

French
un1)
une1)
deux2)
trois3)

1) French word for number 1.
2) French word for number 2.

German
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) and 2) 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.

The things to be explained need to be equipped with a Marker:

<TAG data-annotationpair-m="ID">TEXT</TAG>

The Annotation or explanation is introduced by the following element:

<TAG data-annotationpair-a="ID">TEXT</TAG>

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.

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.

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

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.

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 -1 identifies multiple markers of same ID, and -0 is the annotation.
  • Further attributes within <TAG> will remain, but data-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.

Please see Vorlage:FN/Test.

Änderungswünsche

[Quelltext bearbeiten]

Bitte auf MediaWiki/Änderungen vorschlagen.