Jump to content

Příručka:Rozšíření označení wiki

From mediawiki.org
This page is a translated version of the page Manual:Extending wiki markup and the translation is 6% complete.

MediaWiki poskytuje standardní textové značení, které lze snadno přizpůsobit. Jsou možné jak kusové, tak velkoobchodní úpravy:

  • adding standard token types: The standard approach to customized MediaWiki markup is to add new markup that looks like the built-in MediaWiki XML tags (<tag>), template ({{...}}), or link markup ([[...]]).
  • adding custom token types: Some extensions define new token types.
  • fundamental changes to the parser: A few extensions attempt to fundamentally change the parsing strategy so that markup from other sorts of wikis and content management can be used (must be used?) instead of the standard wiki markup.

Adding to the standard token types

  • Rozšíření funkcí parseru : Parser function extensions extend parameterized template processing and typically look something like this: {{#funcname ...}}. Although any "template name" can be used, custom extensions always begin the function name with a #, as in the example above. Other parser function names are reserved for use by the MediaWiki core.
    When {{#funcname ...}} is implemented as a parser function, it passes its template parameters to a PHP function instead of the usual template article. This function returns a string of wikitext that replaces the parameterized template. Parser functions are used to handle wikitext generation that involves logic that is too complex or confusing to write using normal template-writing techniques.
  • Variabilní rozšíření : Variable extensions extend parameterless template processing.
    Instead of the usual article transclusion, {{XXX}} is associated with a PHP function that returns a string of wikitext that replaces it. They are usually used to insert system information into wiki markup (e.g., the current time, the current page).
  • XML markup extensions : XML markup extensions (also known as tag extensions) define custom XML-style tags in the wikitext:
    <tagname parname="parvalue" ... parname="parvalue"> some text </tagname>
    
    The text between the tags gets passed on to a PHP function which parses the contents of the tag and returns an HTML string that replaces the tag and text. The content inside the tags may be wiki markup, straight text, or text with formatting rules specific to the tag. It is up to the extension implementer. Please check documentation of individual extensions.
  • Rozšíření značek odkazů : Link markup extensions change the way MediaWiki interprets internal links, i.e., wiki markup of the form [[...]].
  • Rozšíření rozšířené syntaxe : Extended syntax extensions, mostly Magic Word extensions, add to the list of MediaWiki Magic Words, such as __NOTOC__. Usually, a specific PHP function interprets these words, and either replaces them with something, or sets some conditions for later processing during output generation, or both. Most usually, the replacement is the empty string; that is, the Magic Word is deleted, and nothing is shown in its place. Altered processing may involve addition of an extra piece of CSS, or suppression of user preference settings during page generation, and can be almost anything.

Adding new token types

To add new token types or to change the entire markup strategy, implementers need to add functions to one or more of the various parser and page output hooks:

(odstraněno od 1.36)

(odstraněno od 1.36)

See also Kategorie:Rozšíření pomocí použití zaháčkování .

See also