Open main menu

Extension:WebSequenceDiagram

MediaWiki extensions manual
OOjs UI icon advanced.svg
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
Translate the WebSequenceDiagram extension if it is available at translatewiki.net
Check usage and version matrix.

Contents

What can this extension do?Edit

Simplify the usage of UML diagrams.

UsageEdit

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

Download instructionsEdit

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.

InstallationEdit

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 parametersEdit

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

CodeEdit

<?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 alsoEdit