MediaWiki extensions manual
Release status: unmaintained
Implementation Tag
Description Shows Wolfram CDF files in wiki pages.
Author(s) TW~mediawikiwikitalk
Latest version 0.2.1 (Goodge Street) (2012-04-25)
MediaWiki 1.18+ (requires 'position' support in ResourceLoader)
License GNU General Public License 3.0 or later
  • $wgCDFAllowExternalURLs
  • $wgCDFShowDownloadLink

Description edit

Allows Wolfram CDF files (interactive content generated by Wolfram Mathematica) to be shown in wiki pages.

Usage edit

The basic syntax for the cdf extension is:

<cdf width="width in pixels" height="height in pixels">filename</cdf>

When specifying the filename, you do not need to include the `File:` namespace in the filename - it will work with or without it. If enabled, you may also provide an absolute URL instead of a filename to show a CDF file from another server.


<cdf width="650" height="400">SomeExample.cdf</cdf>
<cdf width="565" height="589">http://demonstrations.wolfram.com/HobermanCube/HobermanCube.cdf</cdf>

Note that the second example above will only work if $wgCDFAllowExternalURLs is set to true; the default is to not show external URLs.

Download instructions edit

To download the extension, you may obtain a zip of the latest code from the download link in the infobox. Alternatively, you may clone the git repository with the following command:

git clone git://github.com/TheWatcher/wolfram_cdf.git

Installation edit

To install this extension, place the wolfram_cdf directory in your extensions directory, and add the following to LocalSettings.php :


Note that, in order to actually upload and use .cdf files, you will need to ensure that file uploads are enabled ($wgEnableUploads is true) and cdf extensions are allowed. For example:

$wgEnableUploads  = true;
$wgUseImageMagick = true;
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'txt', 'cdf' );

You may also need to either ensure that your webserver serves up .cdf files as application/x-netcdf or, if that is not possible, you may need to modify $IP/includes/mime.types to contain

text/plain txt cdf

This should only be done in exceptional circumstances, however!

Parameters edit

The following parameters can be set in the LocalSettings.php file:

If this is set to true (the default is false) then <cdf> tags may contain URLs to load .cdf files from other web servers. This should be enabled with caution, as it may have security implications!
If set to true (the default is false), the extension will place a 'Click here to download this CDF' link beneath each CDF box to allow users to save a copy of the CDF for offline use.

For example, your LocalSettings.php file may contain:

$wgCDFAllowExternalURLs = false;
$wgCDFShowDownloadLink = true;

The following css classes can also be used to apply styling to the html generated by this extension:

Each CDF box is contained within a div with this class
If $wgCDFShowDownloadLink is true, the CDF download link is placed in a div with this class.