Extension:CodeILR

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
CodeILR

Release status: experimental

Implementation Tag
Description Adds a <codeILR> tag, which allows users to specify a code block with inline replacement parameters that are filled-in via an HTML form.
Author(s) geoff.denningtalk
Last version 0.2 (2010-05-02)
MediaWiki 1.8 to 1.15
PHP 4 or later
License GNU General Public License 3
Download Download
README
CHANGELOG
Parameters

None

Tags
<codeILR>
Hooks used
ParserFirstCallInit

ParserAfterTidy

Check usage and version matrix; stats

Contents

What can this extension do?[edit]

This extension allows you to create code blocks with replaceable tags, that can be filled-in by the end user using a standard HTML form. The resulting code can then be easily copied and pasted into a console window, source code window, etc.

Usage[edit]

Add a tag called <codeILR> to your wikitext. Add attributes that correspond to the code tags that you want to be replaceable. Use the attribute value to specify the tag caption, type, and default (or options), as follows:

  • Text Tag attributes:
    "[Caption]|text|[Default]"
    
  • Select Tag attributes:
    "[Caption]|select|[Option1]|[Option2]|..."
    

Inside the tags, enter your code and specify the replacement tags by prepending them with $. You can also optionally enclose the tag with {curly brackets}. Style is similar to that used by Apache Velocity.

Example 1[edit]

Wiki Text[edit]

<codeILR username="Username|text|epdev">
cd /home/$username/exploded_wars/
unzip /home/$username/asset_storage/search.war -d search.new
unzip /home/$username/asset_storage/cmserver.war -d cmserver.new
unzip /home/$username/asset_storage/webservices.war -d webservices.new
</codeILR>

Output[edit]

CodeILR Example1.png

Example 2[edit]

Wiki Text[edit]

<codeILR
  projectType="Project Type|select|core|storefront|cmserver|searchserver|connect"
  archetypePOMsDir="Archetype POMs Root|text|C:\Java\Archetypes"
  projectDir="Project Source Code Root|text|C:\Java\EpProject"
  >
cd ${archetypePOMsDir}\${projectType}-extension
mvn install
cd ${projectDir}
mvn archetype:generate -DarchetypeArtifactId=${projectType}-extension -DarchetypeVersion=1.0-SNAPSHOT -DarchetypeGroupId=com.elasticpath
</codeILR>

Output[edit]

CodeILR Example2.png

Download instructions[edit]

Download the extension from http://dl.dropbox.com/u/132371/CodeILR/CodeILR-0.2.zip.

Installation[edit]

Extract the downloaded zip file to $IP/extensions/CodeILR.

Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

A typical Linux command to do this is:

 sudo unzip CodeILR-0.2.zip -d /var/lib/mediawiki/extensions/CodeILR

Add the following lines to your LocalSettings.php file (near the end):

 require_once( 'extensions/CodeILR/CodeILR.php' );