Extensión:NoTOC
Appearance
This extension stores its source code on a editable wiki page rather than in a code repository. As a result, this code may be maliciously altered. It may contain security vulnerabilities, and will not receive localisation updates from translatewiki.net. Developers are strongly encouraged to host their code in a code repository rather than a wiki page so that the extension can be properly maintained, reviewed, and kept secure. |
¡En estos momentos no hay nadie que se encargue del mantenimiento de esta extensión! Aunque todavía puede que funcione, los informes sobre errores o peticiones de nuevas funcionalidades serán probablemente ignorados. |
Estado de la versión: sin mantenimiento |
|
|---|---|
| Implementación | Extensión del analizador |
| Descripción | Turns off Table of Contents by default on all pages |
| Autor(es) | Andrew Fitzgerald (Frantikdiscusión) |
| Última versión | 0.1.1 (2013-12-11) |
| MediaWiki | |
| Cambios en la base de datos | No |
| Licencia | Licencia Pública General de GNU 2.0 o posterior |
| Descargar | See the code section |
The NoTOC extension hides the table of contents by default. The magic word __TOC__ can still be used normally.
Instalación
- Copy the code into files y extrae los archivos en el directorio «
NoTOC» dentro del directorioextensions/existente. - Añade el siguiente código en la parte final de tu archivo LocalSettings.php:
require_once "$IP/extensions/NoTOC/NoTOC.php";
Hecho – Navega a Special:Version en el wiki para verificar que la extensión se haya instalado correctamente.
Código
- NoTOC.php
<?php
/**
* NoTOC extension - Turns off the Table of Contents (TOC) by default on all pages
* @version 0.1.1 - 2013/12/11
*
* @link https://www.mediawiki.org/wiki/Extension:NoTOC Documentation
* @link https://www.mediawiki.org/wiki/Extension_talk:NoTOC Support
*
* @ingroup Extensions
* @package MediaWiki
* @author Andrew Fitzgerald (Frantik)
* @author Karsten Hoffmeyer (Kghbln)
* @copyright (C) 2010 Andrew Fitzgerald
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
*/
// check the call
if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is a MediaWiki extension and thus not a valid entry point.' );
}
// provide information
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'NoTOC',
'author' => array(
'Andrew Fitzgerald', '...'
),
'url' => 'https://www.mediawiki.org/wiki/Extension:NoTOC',
'descriptionmsg' => 'notoc-desc',
'version' => '0.1.1'
);
// show way to files
$wgExtensionMessagesFiles['NoTOC'] = dirname( __FILE__ ) . '/NoTOC.i18n.php';
// register hooks
$wgHooks['ParserClearState'][] = 'efMWNoTOC';
// perform purpose
function efMWNoTOC($parser) {
$parser->mShowToc = false;
return true;
}
- NoTOC.i18n.php
<?php
/**
* Internationalization file for the NoTOC extension.
*
* @licence GNU GPL v2+
* @author Karsten Hoffmeyer (Kghbln)
*/
$messages = array();
/** English
* @author Frantik
* @author Kghbln
*/
$messages['en'] = array(
'notoc-desc' => 'Turns off the Table of Contents (TOC) by default on all pages',
);
/** Message documentation (Message documentation)
* @author Kghbln
*/
$messages['qqq'] = array(
'notoc-desc' => '{{desc|name=NoTOC|url=https://www.mediawiki.org/wiki/Extension:NoTOC}}',
);
/** German (Deutsch)
* @author Kghbln
*/
$messages['de'] = array(
'notoc-desc' => 'Unterdrückt die automatische Generierung des Inhaltsverzeichnisses',
);
Véase también
- Extension:ForceTocOnEveryPage
- Extension:DeToc - This can be used to extract TOC HTML and to remove it or put it in some other section of the page.
