Extension:Header Tabs

This page is a translated version of the page Extension:Header Tabs and the translation is 43% complete.
Manuel des extensions MediaWiki
OOjs UI icon advanced-invert.svg
Header Tabs
État de la version : stable
Implémentation Fonction d'analyseur , Interface utilisateur
Description Affiche les titres de plus haut niveau en onglets grâce au JavaScript
Auteur(s)
Dernière version 2.2 (janvier 2022)
Politique de compatibilité Le master conserve la compatibilité arrière.
MediaWiki 1.33+
Licence Licence publique générale GNU v2.0 ou supérieur
Téléchargement
Version history
Exemple Wiki of the Month on semantic-mediawiki.org
  • $wgHeaderTabsRenderSingleTab
  • $wgHeaderTabsDisableDefaultToc
  • $wgHeaderTabsAutomaticNamespaces
  • $wgHeaderTabsNoTabsInToc
  • $wgHeaderTabsEditTabLink
  • $wgHeaderTabsGenerateTabTocs
  • $wgHeaderTabsDefaultFirstTab
  • $wgHeaderTabsUseHistory
Traduire l’extension Header Tabs sur translatewiki.net si elle y est disponible

Vérifier la matrice des utilisations et des versions.

Problèmes Tâches ouvertes · Signaler un bogue

L'extention Header Tabs transforme les titres de plus haut niveau, entourés par un unique "=" en onglets JavaScript.

Utilisation

To enable tabs on a page after you installed the extension, you need to add a ‎<headertabs /> tag into the page in place where the last tab should end (everything below this tag will be shown under the tab view). En général, la balise sera posée au bas de la page.

La page doit aussi avoir des titres définis au plus haut niveau tels que :

= Mon titre =

Each such top-level header, if it's anywhere above the ‎<headertabs /> tag, will be displayed as a tab.

Liens vers les onglets

Vous pouvez créer un lien vers l'onglet, depuis une autre page ou de l'intérieur de la page, et dans celle-ci, depuis un autre onglet ou hors des onglets. This is done using the {{#switchtablink}} parser function, which is called like this:

{{#switchtablink:Nom de l'onglet|Texte du lien|Nom de la page}}

Cela créera un lien vers l'onglet nommé "Nom de l'onglet" avec comme texte de lien : "Texte du lien". Si vous voulez un lien pointant vers un onglet d'une autre page, vous devez ajouter le troisième paramètre optionnel : "Nom de la page".

Multibyte characters was well as formatting characters e.g. bold is not permitted if you want to link to tabs in any way.

Exemple

Some text above the tab view

= First section header =
This will be displayed on the first tab

{{#switchtablink:Second section header|Click here to go to the next tab...}}

= Second section header =
This will be displayed on the second tab

<headertabs/>
= Third section header =
This will be always displayed under the tab view because it's below the <headertabs/> tag.

The header titles get automatically converted into tab titles.

Téléchargement

Vous pouvez télécharger le code de Header Tabs, dans le format .zip ici https://github.com/wikimedia/mediawiki-extensions-HeaderTabs/archive/2.2.zip

You can also download the code directly via Git from the MediaWiki source code repository. From a command line, call the following:

git clone https://phabricator.wikimedia.org/diffusion/EHET/extension-headertabs.git

To view the code online, including the version history for each file: https://phabricator.wikimedia.org/diffusion/EHET/browse/master/

Installation

  • Téléchargez et placez le(s) fichiers (s) dans un répertoire appelé HeaderTabs dans votre dossier extensions/.
  • Ajoutez le code suivant à la fin de votre fichier LocalSettings.php  :
    wfLoadExtension( 'HeaderTabs' );
    
  •   Fait – Accédez à Special:Version sur votre wiki pour vérifier que l'extension a bien été installée.

Modifications

Skin modification

To change the tabs' styling, see "Skin modification".

Paramètres de configuration

The following parameters can be modified in LocalSettings.php below the call to wfLoadExtension().

$wgHeaderTabsUseHistory

$wgHeaderTabsUseHistory defines whether tab navigation should be tracked within the browser history and within the URL, updating the hash value. By default this variable is set to true, i.e. history is used. You can disable it by adding the following:

$wgHeaderTabsUseHistory = false;

$wgHeaderTabsRenderSingleTab

The $wgHeaderTabsRenderSingleTab variable defines if Header Tabs will activate if only a single top-level header is found. By default this variable is set to false, i.e. no tabs will be shown if only one top-level header is found. You can enable this behaviour by adding the following:

$wgHeaderTabsRenderSingleTab = true;

$wgHeaderTabsAutomaticNamespaces

The $wgHeaderTabsAutomaticNamespaces variable defines the set of namespaces for which you don't need to add the <headertabs /> tag in order to enable tabs. If a namespace ID is defined in this variable, header tabs will activate automatically when you have two top-level headers (or one, if you have $wgHeaderTabsRenderSingleTab set to true) in an article. By default this variable holds no namespaces. You can add namespaces to this list by adding the following for each namespace:

$wgHeaderTabsAutomaticNamespaces[] = NS_MAIN;

$wgHeaderTabsDefaultFirstTab

The $wgHeaderTabsDefaultFirstTab variable defines whether Header Tabs puts any content before the first defined header and put it into its own tab. By default this variable is set to false. You can enable this behavior by adding the default name using the following:

$wgHeaderTabsDefaultFirstTab = 'DefaultTabName';

If using this setting, be careful not to enable $wgHeaderTabsRenderSingleTab as it will lead to tabs appearing in other parts of the UI.

$wgHeaderTabsDisableDefaultToc

The $wgHeaderTabsDisableDefaultToc variable defines whether Header Tabs will disable the MediaWiki article's table of contents (TOC) when tabs are enabled for a given article. This saves you the trouble of having to add __NOTOC__ to your article. If tabs are not enabled because of a lack of top-level headers, the table of contents will appear as usual. By default this variable is set to true, i.e. the MediaWiki TOC is disabled if header tabs are shown. You can disable this behavior by adding the following:

$wgHeaderTabsDisableDefaultToc = false;

$wgHeaderTabsNoTabsInTOC

If you want the page to have a TOC, but do not want to include the tab names in that TOC, add the following to LocalSettings.php:

$wgHeaderTabsNoTabsInTOC = true;

If, however, you only want to keep the tabs out of the TOC in some but not all pages, you can instead add the following to the top of any such pages:

<notabtoc/>

$wgHeaderTabsGenerateTabTocs

The $wgHeaderTabsGenerateTabTocs variable defines if Header Tabs will try to generate a TOC for each tab. By default this variable is set to false, i.e. no tab TOCs will be generated. You can enable this behavior by adding the following:

$wgHeaderTabsGenerateTabTocs = true;

$wgHeaderTabsEditTabLink

The $wgHeaderTabsEditTabLink variable defines if Header Tabs will add a edit link to the right of the tabs which let you edit only the tabs' text. By default this variable is set to true, i.e. a edit link for the tab will be shown. You can disable this behavior by adding the following:

$wgHeaderTabsEditTabLink = false;

Historique des versions

To see a list of changes for each version, see version history. For a list of features planned for future releases, please see roadmap.

Known limitations and issues

  • You cannot use the tag more than once. In other words, a second tag will not produce a second series of tabs.
  • Tabs render on top of infoboxes in Chrome.
  • Header Tabs will not work with the HTML Tidy tool, i.e. if $wgTidyConfig is populated.

Sections appearing outside the tabbed section

Header Tabs sections which include floated objects (such as infoboxes) may appear outside the tabs container if other content does not force the container to be large enough to hold the floated object. One resolution to this problem is to place a cleared html element at the very end of each section.

A simple, but not best-practice, means of doing this is:

<div style="clear:both"></div>

This forces this element to be considered by the browser after your floated object and thus will grow the container to fit both.

Support

The best way to seek help with this extension is to send questions to the mediawiki-l mailing list. The extension maintainers, and active users and contributors, are on this list and will be able to help you.

Contributing to the project

Bugs and feature requests

There are a number of ways to get support for Header Tabs, including questions, suggestions, bug reports and feature requests:

  • Place questions on the discussion page for Header Tabs.
  • You can submit bug reports and feature requests at MediaWiki's Phabricator site, here; enter "Header Tabs" in the "Tags" field. (The current list of known bugs and requested features for Header Tabs can be found here.)
  • Use the main MediaWiki mailing list, mediawiki-l.

Contributing patches to the project

If you found some bug and fixed it, or if you wrote code for a new feature, please either do a Git commit for it, or create a patch by going to the "HeaderTabs" directory, and typing:

git diff > descriptivename.patch

If you create a patch, please send it, with a description, to Yaron Koren.

Translating

Translation of Header Tabs is done through translatewiki.net. The translation for this extension can be found here: https://translatewiki.net/wiki/Special:Translate?group=ext-headertabs. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.

Voir aussi