Extension:TagContent

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

Installation

 * 1) Download TagContent from SVN-repository and recreate the 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 useful 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...

An other example may be to use a tag for "new" content and one for "old" content, both may be the same template. First the examples for the necessary definitions, then what this will look like as wikitext in an article and finally what this will look like when rendered.


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


 * Example for "Template&#58;Delimit"

When the tags "old" and "new" are used in a wikitext this will look like Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

And when rendered this will be like the following Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

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.

Nesting of tags are always difficult, and as this extension makes no attempt to verify that the placement of tags are legal compared to other tags on the page, the only real help in correcting such errors are "tidy" in various incarnations. This may although give somewhat strange errors sometimes. Typically the root cause for such errors are constructs like lorem ipsum dolor sit amet, &lt;foo&gt;consectetur &lt;bar&gt;adipisicing elit&lt;/foo&gt;, sed do eiusmod&lt;bar&gt; tempor... Because parts of the wikimarkup is generated by a rather dumb parser the most common error will come from opening a tag in one paragraph and closing it in another.

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

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