Extension:WebSequenceDiagram

From MediaWiki.org
Jump to: navigation, search


MediaWiki extensions manual - list
Crystal Clear action run.png
WebSequenceDiagram

Release status: beta

Implementation Parser extension
Description Render inline sequence diagrams using websequencediagrams.com
Author(s) (avajaditalk)
License GPL
Download http://opensource.kontorsplatsen.se/WebSequenceDiagram/latest.tar.bz2
Check usage and version matrix

Contents

What can this extension do? [edit]

Simplify the usage of UML diagrams.

Usage [edit]

<sequencediagram style="modern-blue"> </sequencediagram>

Download instructions [edit]

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

Installation [edit]

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

#add configuration parameters here
#setup user rights here
require_once("$IP/extensions/WebSequenceDiagram/WebSequenceDiagram.php");

Configuration parameters [edit]

Use the manuals to make your diagrams do whatever you want with the manuals you can find here - http://www.websequencediagrams.com

Code [edit]

<?php
$wgExtensionCredits['parserhook'][] = array(
        'name'         => 'WebServiceSequenceDiagram',
        'version'      => '1.0',
        'author'       => 'Eddie Olsson', 
        'url'          => 'http://www.mediawiki.org/wiki/Extension:WebSequenceDiagram',
        'description'  => 'Render inline sequence diagrams using websequencediagrams.com'
);
 
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
        $wgHooks['ParserFirstCallInit'][] = 'webSequenceDiagramSetup';
} else { // Otherwise do things the old fashioned way
        $wgExtensionFunctions[] = 'webSequenceDiagramSetup';
}
 
function webSequenceDiagramSetup() {
        global $wgParser;
        $wgParser->setHook( 'sequencediagram', 'webSequenceDiagramRender' );
       return true;
}
 
function webSequenceDiagramRender( $input, $args, $parser) {
        if( isset( $args['style'] ) )
                $style= $args['style'];
        else
                $style = 'default';
 
        $caption = '';
        if( isset( $args['caption'] ) )
                $caption = '<div class="thumbcaption">' . $args['caption'] . '</div>';
 
        return "\n" . 
                '<div class="thum tnone"><div class="thumbinner">' .
                '<div class=wsd wsd_style="' . $style . '"><pre>\n' .
                $input . "\n" . 
                '</pre></div>' . $caption . '</div></div><script type="text/javascript" src="http://www.websequencediagrams.com/service.js"></script>';
 
}
?>

See also [edit]