Extension:TagContent

TagContent is an extension to define tags that wrap some content in a predefined template, usually for higher readabillity or to ease processing.

Installation

 * 1) Download TagContent.php and TagContent.i18n.php, and save them in extensions/TagContent directory on your wiki.
 * 2) Insert this line in the LocalSettings.php file:
 * 3) Adapt   and

On Wikipedia or a similar wiki the following additions will be usefull for a blacklist

A large wiki should unset blacklist and have explicit tag definitions or have very strict rules for who is allowed to edit Mediawiki:Tags-definition

Usage
Several new tags can be defined and each one of them maps to a predefined page acting like an ordinary template with the tag content as the first anonymous parameter and the attributes as named parameters. All ordinary wikisyntax are valid for the messages.

Tags can be defined in  or on a tags definition page in the message namespace if enabled. A tag on the tags definition page must not be predefined or be blacklisted. If a tag isn't predefined or defined on the tags definition page it will act as an usual tag and will possibly be stripped in the cleanup phase. If the blacklist is undefined no tag definitions will be accepted except those defined in. The reason behind this is that no blacklist is simply dangerous.

Use of "Mediawiki&#58;Tags-definition" impose a serious load during update of this page and should be avoided if possible.

The definition for a mapping can also include defaults for the named parameters. These will override the defaults given in the template as those will newer be used in this case. Multiple tags can map to the same template but with different parameters.


 * Example for LocalSettings.php


 * Example for "Mediawiki&#58;Tags-definition"

According to the previous two examples the tag "test-tag" will be transformed according to the definition. The following wikicode will then be rewritten from lorem ipsum dolor sit amet, &lt;test-tag&gt;consectetur adipisicing elit&lt;/test-tag&gt;, sed do eiusmod tempor... into the following form lorem ipsum dolor sit amet,, sed do eiusmod tempor...

The tag form can be more readable than the parser function form when marking large chuncks of text, and it is a lot easier to parse with a quick and dirty regexp expression.

Note that this extension might push evaluation from first parser pass to second parser pass and this might create run time errors.

Alternatives

 * Not known

Feedback
Use the discussion page for feedback, questions, feature requests and bug reports.