SvgPlugin
Show SVG drawings as PNG pictures embedded in topics
Introduction
SvgPlugin displays SVG drawings attached in TWiki as PNG images, inline in your topics. It uses the
CPAN:Image::LibRSVG
Perl module (which uses
librsvg
), to convert your SVG drawings into PNG pictures.
Syntax Rules
-
%SVG{"drawing" parameters}%
- where
drawing is the filename of an attached SVG image.
- Parameters:
| Parameter | Description | Default value |
size | the maximum size of the picture. The picture will be generated do fit in this size. SvgPlugin will generate a picture the fits best in the given size, without distorting the image. | DEFAULTSIZE setting below |
topic | The topic to which the drawing is attached. Can be TheTopic or Web.TheTopic | current topic |
Examples
| You type: |
You should get: |
You get (if installed): |
%SVG{"TWikiBrasil.svg"}% |
|
%SVG{"TWikiBrasil.svg"}% |
%SVG{"TWikiBrasil.svg" size="400x300"}% |
|
%SVG{"TWikiBrasil.svg" size="400x300"}% |
%SVG{}% |
SvgPlugin: you must specify a drawing to display! |
%SVG{}% |
%SVG{"TWikiBrasil.svg" topic="Main.AntonioTerceiro"}% |
SvgPlugin: can't find drawing TWikiBrasil.svg attched at Main/AntonioTerceiro. |
%SVG{"TWikiBrasil.svg" topic="Main.AntonioTerceiro"}% |
Plugin Settings
Plugin settings are stored as preferences variables. To reference a plugin setting write
%<plugin>_<setting>%, i.e.
%SVGPLUGIN_SHORTDESCRIPTION%
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Show SVG drawings as PNG pictures embedded in topics
- Debug plugin: (See output in
data/debug.txt)
- Default image size:
- Set DEFAULTSIZE = 320x200
Installation Instructions
Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.
- Install the
Image::LibRSVG Perl module.
- For an automated installation, run the configure script and follow "Find More Extensions" in the in the Extensions section.
- Or, follow these manual installation steps:
- Download the ZIP file from the Plugins home (see below).
- Unzip
SvgPlugin.zip in your twiki installation directory. Content: | File: | Description: |
data/TWiki/SvgPlugin.txt | Plugin topic |
lib/TWiki/Plugins/SvgPlugin.pm | Plugin Perl module |
pub/TWiki/SvgPlugin/TWikiBrasil.svg | Sample SVG drawing |
pub/TWiki/SvgPlugin/TWikiBrasil-320-200.png | Sample picture |
pub/TWiki/SvgPlugin/TWikiBrasil-400x300.png | Sample picture |
- Set the ownership of the extracted directories and files to the webserver user.
- Install the dependencies (if any).
- Plugin configuration and testing:
- Run the configure script and enable the plugin in the Plugins section.
- Configure additional plugin settings in the Extensions section if needed.
- Test if the installation was successful: See example above.
Plugin Info
Related Topics: TWikiPreferences,
UserDocumentationCategory,
TWikiPlugins