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
License GPL
Download http://opensource.kontorsplatsen.se/WebSequenceDiagram/latest.tar.bz2

Check usage (experimental)

Contents

[edit] What can this extension do?

Simplify the usage of UML diagrams.

[edit] Usage

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

[edit] Download instructions

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.

[edit] Installation

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");

[edit] Configuration parameters

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

[edit] Code

<?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>';
 
}
?>

[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox