User:Joncutrer/Extensions/absHTML

From Meta, a Wikimedia project coordination wiki

Jump to: navigation, search
Blue Glass Arrow.svg MediaWiki logo.png
This page should be moved to MediaWiki.org.
Please do not move the page by hand. It will be imported by a MediaWiki.org administrator with the full edit history. In the meantime, you may continue to edit the page as normal.

ABSHTML is a very simple Extension for MediaWiki that allows you to insert HTML code within you wiki pages. This extension overcomes one of the limits of MediaWiki, the ability to use the full html tag set such as form tags and various others

MediaWiki Extensions : Joncutrer/Extensions/absHTML

ABSHTML is a very simple Extension for MediaWiki that allows you to insert HTML code within you wiki pages. This extension overcomes one of the limits of MediaWiki, the ability to use the full html tag set such as form tags and various others. See the example below. Here is the script and instructions to install, if you find this extension usefull please provide a link back here or directly to http://stockphotoss.com/


Step 1. Copy the following code and save it into your MediaWiki's extensions directory as abshtml.php.

 <?php
 # Example WikiMedia extension
 # with WikiMedia's extension mechanism it is possible to define 
 # new tags of the form 
 # <absHTML> some text </absHTML>
 # the function registered by the extension gets the text between the 
 # tags as input and can transform it into arbitrary HTML code.
 # Note: The output is not interpreted as WikiText but directly 
 #       included in the HTML output. So Wiki markup is not supported.
 # To activate the extension, include it from your LocalSettings.php
 # with: include("extensions/absHTML.php"); 
 $wgExtensionFunctions[] = "wfabsHTMLExtension";
 
 function wfabsHTMLExtension() {
     global $wgParser;
     # register the extension with the WikiText parser
     # the first parameter is the name of the new tag. 
     # In this case it defines the tag <absHTML> ... </absHTML>
     # the second parameter is the callback function for 
     # processing the text between the tags
     $wgParser->setHook( "absHTML", "renderHTML" );
 }
 
 # The callback function for converting the input text to HTML output
 function renderHTML( $input ) {
     $output =  $input;
     return $output;
 }
 ?>

Step 2. Add the following line to your LocalSettings.php file

include("extensions/abshtml.php");

Step 3. Insert some HTML in one of your pages as follows.

<absHTML>
 Link to this page.
 <textarea>
  <a href="http:://stockphotoss.com/">
   stockphotoss.com
  </a>
 </textarea>
</absHTML>

Example of Output <absHTML>

Link to this page.
<textarea>
 <a href="http:://stockphotoss.com/">
  stockphotoss.com
 </a>
</textarea>
</absHTML>