Extension:Go diagrams

The Go diagrams extension may be used to edit and display go diagrams in MediaWiki. The output looks similar to the one on http://senseis.xmp.net but it's antialiased. SGF is also supported.

Features

 * SGF output
 * hyperlinks
 * different styles ("large", "normal", user-defined)
 * (optional) coordinate markers
 * anti-aliased output

Download

 * 10:03, 2 April 2006 (UTC) version 0.8: /godiag.php

Requirements

 * PHP + GD2 and FreeType
 * MediaWiki 1.6 or 1.5
 * License: GPL

Installation & config

 * 1) Create a directory for godiag and make it writeable by the web server and accessible via HTTP.
 * 2) Copy the file to MediaWiki's extensions directory.
 * 3) Add the following to your LocalSettings.php:

MIME
Note: You may also specify an SGF mime type so your server presents the SGF's correctly to the client. This worked for me: printf "application/sgf\t\t\tsgf" >> /etc/mime.types (restart web server)

I18n
You'll need to set a few extra vars in LocalSettings.php, if you want to use the extension in non-English wikis:


 * &mdash; this is the format of hints about additional moves in the title (e.g. "8 at 1"). The default is:
 * ,, and

Example for Bulgarian:

Go diagram styles
Godiag comes with two predefined styles, "normal" and "large". You may specify the style for a diagram by starting it with

 $$#stylename title ...

(put any options like 'W' and 'c' or board size before the '#', like ).

You may define more styles, e.g. in LocalSettings.php:

$wgGodiagStyles['mystyle'] = array( /* ... */ ); // see source for two examples $wgGodiagDefaultStyle='mystyle';                // make it default

Syntax
The syntax is in most cases compatible with http://senseis.xmp.net/ but usually less strict. There are also a few extensions. In short:


 * put things between:

 $$ title

and




 * use these symbols:

- horizontal border . unoccupied point , hoshi point X    black O    white B    black circled W    white circled @    white with square C    circled point S    point with square 0-9  numbered moves (0=10); black is first by default a-z  marked points _    empty space (useful as separator and for other effects)
 * vertical border
 * 1)     black with square

[a|WikiPageAboutMarkedPointA] [3|WikiPageAboutMarkedStone3] [C|http://link.to.example.com/circled-point.html]
 * place options after the initial '$$'
 * &mdash; black player makes move 1 (default)
 * &mdash; white player makes move 1
 * &mdash; insert a break after the image; The following text will appear below the image.
 * &mdash; draw coordinate markers
 * &mdash; float left
 * &mdash; float right (default)
 * – &mdash; specify board size (default is 19). Useful for sizes above 19 and as a hint to SGF.
 * Example:
 * you can add hyperlinks at the end, e.g.:
 * add "X at Y" hints to the SGF generator in the title, e.g. "A mysterious disappearance (9 at 3)" will create an SGF with moves 3 and 9 on the same spot.

Maintenance

 * Remove older files in godiag-dir/tmp (files used in previews, leftovers from failed generations)
 * If you want to recreate the SGF/PNG files, empty the png/sgf subdir and set  in LocalSettings.php to the current server time:.

Example 1


 $$ A simple example with extra spacing --- --- 
 * . ., . 2 . , . . |
 * . . . . 1 . . . . |
 * . ., . 2 . , . . |
 * . . . . 1 . . . . |
 * . . . . 1 . . . . |

Example 2


 $$ A complicated example with marks, numbers, hyperlinks, border just on one side [2|Wikipage] [a|http://example.com] [S|Wikipage2] [@|Wikipage3] 
 * ..1.__.2.
 * ..a.__.b.
 * ..W.__.@.
 * ..B.__.#.
 * ..C.__.S.

Example 3


 $$W White can also be first (begin with $$W) + there are shortcuts - . ..,...X. ...., .....1 ..X...,..| . . - 

Stylesheet example
Add this to MediaWiki:Monobook.css (or MediaWiki:Yourskin.css) within the wiki for a start:

.godiag-left { /* for br and div */ clear: left; } .godiag-right { /* for br and div */ clear: right; } div.godiag { /* for backwards compatibility with ver <= 0.7 */ float: right; clear: right; margin: 0 .5em .5em 1em; background-color: #f9f9f9; border: 1px solid silver; } div.godiag-left { float: left; margin: .5em 1em .5em 0; background-color: #f9f9f9; border: 1px solid silver; } div.godiag-right { float: right; margin: .5em .5em .5em 1em; background-color: #f9f9f9; border: 1px solid silver; } div.godiagi { padding: 0.5ex; } div.godiagheading { font-size: 94%; padding-top: 0.5ex; } div.godiagsgf { width: 22px; height: 9px; float: right; } div.godiagsgf a { background: url("/path/to/Download_sgf.png") 0 0 no-repeat; display: block; width: 22px; height: 9px; } Download_sgf.png =