From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png

Release status:Extension status beta

ImplementationTemplate:Extension#type Tag
DescriptionTemplate:Extension#description Shows Wolfram CDF files in wiki pages.
Author(s)Template:Extension#username TWtalk
Latest versionTemplate:Extension#version 0.2.1 (Goodge Street) (2012-04-25)
MediaWikiTemplate:Extension#mediawiki 1.18 or later (requires 'position' support in ResourceLoader)
LicenseTemplate:Extension#license GNU General Public License 3.0 or later

$wgCDFAllowExternalURLs $wgCDFShowDownloadLink

Hooks usedTemplate:Extension#hook

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

Check usage and version matrix.


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


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


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!


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.