Extension:AltTag

Main function of AltTag extension is to make it possible to create user-defined XML-style tags in any language work exactly the real tag. For example this arabic tag <مرجع اسم="test" > will work exactly such This code is 100% correct, but writing RTL with LTR makes it messy. With this extension you can do that like this: <مرجع اسم=الاسم فئة=الفئة> هنا محتوى  كبير  محتوى شيفرة  كبير   Did you see the difference?! This is the main advantage, and there are other benefits as well!

Features

 * 1) This extension processes all tags and their attributes. It will also support the tags the content of which does not change, such as pre and nowiki.
 * 2)  The processing of all of these tags and their attributes will be done before the parsing by MediaWiki. This will minimize mistakes and risk.
 * 3) It is possible to combine a real tag with an alternate attribute, and vice versa.
 * 4) It is possible to add more than one alternate tag for a single real tag.

Usage
After installing the extension, it is possible to use the alternate tag and alternate attributes in exactly the same way a real tag and real attributes would be used.

Download Instructions
Please cut and paste the code found below and place it in. ''Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php''.

Installation
To install this extension, add the following to LocalSettings.php:

Configuration
To use AltTag you should define some information. You will find it in  file under this line.

Note: next examples is in Arabic.

Alternate Tags
You will find it under this line , It's an Array Its key is the Alternate Tag and the value is the real tag.

Example : Note: You can use mere than one alternate for one tag.

Nowikis Tags
It's any tag you want to keep alternates into it without any change, such as  and   or any tag you want.

You will find this under. It's an Array and its key is the Alternate Tag and the value is the real tag.

Example : Note : You can use more than one alternate for one real tag.

Alternates Attributes
You will find this under. It's an Array and its key is the Alternate attribute and the value is the real attribute.

Example : Note: You can use mere than one alternate for one attribute.

Extra Letters
If you using any non-English letters like Arabic, Chinese, Russian etc, you must insert it here. You will find it under

.Example : Warning : should not put anything other than Letters - no dots, no spaces, no signs, or anything else.

How it works
AltTag converts the alternate tags to real ones, and then transport the product to MediaWiki; this extension process the wikiText before converting it to HTML. So, if MediaWiki brings the revised version from the displayed version (or the other way around), this extension will not operate.

For developers
It's not a good explanation, but it's enough to understand how it works.

This extension work as this following steps:


 * 1) Get all of the tags to  specifically.
 * 2) Processing the tags in the array (so far did not edit wikitext) this way:
 * 1) Check if the tag is one if Nowikis Tags. If it was one of them  will be
 * 2) If  is   any tag will be added to   untill Nowiki closing tag.
 * The tag will splitted to two parts, first part will be sent to  and anything after the tag name will be sent to   then add the resault into.
 * 3) Replacing process: Now all tags in Wikitest will be replaced by random replacement does not exist in wikitest.
 * 4) Returning process: Now the random will be replacement with fixed tag from, one time every time. This will return the tags to its correct places.
 * Why this all Replacing and Returning? Because this extension using RegEx pattern gets any tag, and it need to replace one time every time. Without using this replacements thing RegEx will working with first Tag every time.