Extension:Aafigure

From MediaWiki.org
Jump to: navigation, search


MediaWiki extensions manual
Crystal Clear action run.png
Aafigure

Release status: stable

Implementation Parser extension, Tag
Description Embed ASCII art figures with aafigure
Author(s) (MarkLodatotalk)
Latest version 1.0.1 (2010-12-13)
License Expat (MIT)
Download ZIP
Source
History
Tags
<aafigure>

Translate the Aafigure extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

What can this extension do?[edit | edit source]

This extension adds an <aafigure> tag to MediaWiki for embedding an ASCII art image to be processed by the aafigure program.

Example[edit | edit source]

<aafigure textual scale=0.9 background=ffccff>
/-----------+
| MediaWiki +----+
\-----------+    |
                 v
                 o-----> Awesome!
                 ^
/-----------+    |
| aafigure  +----+
\-----------+
</aafigure>

Usage[edit | edit source]

Enclose your ASCII art image in an <aafigure> tag. You may use any of the following attributes in the tag to send to the 'aafigure' program.

format=format
Image output format, if allowed by the administrator. E.g., "png", "jpg", "svg"
scale=float
Scaling factor for image size.
aspect=float
Aspect ratio for non-text.
proportional
Use a proportional font instead of a fixed-width font.
textual
Disable fill horizontal detection. This means that fills must be at least two rows high.
foreground=hexcolor
Foreground color as six hex digits, RRGGBB.
background=hexcolor
Background color as six hex digits, RRGGBB.
fill=hexcolor
Fill color as six hex digits, RRGGBB.

The following options only work when the output format is SVG. The width and height arguments are recommended because the software does not properly figure out how large the resulting image is.

linewidth=float
Line width.
width=pixels
Width of the SVG container in pixels.
height=pixels
Height of the SVG container in pixels.

Download and Installation[edit | edit source]

  1. Install aafigure. On Ubuntu, apt-get install python-aafigure.
  2. Download the source archive.
  3. Extract it to an "Aafigure" sub-directory of your extensions directory.
  4. Add the following to your LocalSettings.php:
    require_once("extensions/Aafigure/Aafigure.php");
    
  5. Copy the content of the README file to a [[Help:Aafigure]] page.

Configuration[edit | edit source]

The following variables can be set in you LocalSettings.php file.

$wgAafigureSettings->aafigure
Path to aafigure executable. Default: "aafigure"
$wgAafigureSettings->format
Image file format, passed as --type to aafigure. Default: "png"
$wgAafigureSettings->allowed_formats
Array of image formats that users are allowed to use via the "format" option. Default: none

Bugs[edit | edit source]

SVG support is lacking in many ways. First, it does not compute the width and height automatically; if they are not given manually, the browser draws an incorrectly sized container. Second, it should use img tags on webkit rather than an object tag. Finally, it should fall back to PNG for non-SVG browsers (namely Internet Explorer).

License[edit | edit source]

This work is licensed under the Expat (aka "MIT") license.

See Also[edit | edit source]