Extension:CharInsert

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
CharInsert

Release status: stable

Implementation Tag, Page action
Description Enables the creation of JavaScript character insert boxes.
Author(s) Brion Vibber
Download SVN

CharInsert is an extension that enables the creation of JavaScript links which, when clicked, insert predefined text into the text box.

These links are usually used in MediaWiki:Edittools system message (for an example, see Wikipedia:MediaWiki:Edittools).

Contents

[edit] Syntax

Use <charinsert> tags with a space-separated list of characters or tags for which you wish to allow insertion.

You can use + sign inside a tag to define a place to:

  • insert selected text or
  • place cursor if no text was selected.

You have to enclose templates and spaces inside <nowiki>:

<charinsert><nowiki>== + ==</nowiki> <nowiki>{{stub}}</nowiki></charinsert>

[edit] Sample output

Note that clicking the links will have no effect since there is no text box.

Á á Ć ć É é Í í Ĺ ĺ Ń ń Ó ó Ŕ ŕ Ś ś Ú ú Ý ý Ź ź

[edit] Notes

  • Generated JavaScript links also work in other areas around edit window, e.g. in MediaWiki:Copyrightwarning or MediaWiki:Newarticletext, on the page preloaded with Inputbox, and even from the text preview.
  • They can also be used in MediaWiki:Uploadtext to insert image description templates.
  • Generated JavaScript links use insertTags() from wikibits.js.
  • Unlike toolbar buttons on top, this extension doesn't provide a way to specify inserted "sample text".

[edit] Installation

  • Download CharInsert.php and CharInsert.i18n.php from the SVN repository and put them into the extensions directory of your MediaWiki project.
  • Put the following line near the end of your LocalSettings.php file:
    require_once("$IP/extensions/CharInsert.php");
    

This extension is being used on one or more of Wikimedia's wikis. It means that the extension is stable and works well enough to be used by such high traffic websites. A full list of the extensions installed on a particular wiki is produced by Special:Version on that wiki.

Personal tools