MindTouch Deki VMware certified downloadDownload Now
MindTouch Deki Linux  packages and install guidesView Install Guide

Table of Contents

 

Getting Started

Deki Wiki "Hayes" introduces a new mechanism to add dynamic content to pages.  Dynamic content capabilities were introduced with Deki Wiki "Gooseberry", but adding custom extensions required changing the source code of the application.  With "Hayes", the dynamic content capabilities have been greatly improved and the implementation has been recast to leverage the new service-oriented architecture.  Adding extensions is now a simple registration step in the Control Panel using the Service Management pane.

Extensions are services that can either run locally or remotely.  Running an extension locally has the advantage of better bandwidth by not requiring additional network traffic.  However, in order to run an extension locally, it must be configured, which may sometimes require several steps, such as installing additional applications.  Alternatively, an extension can run remotely as a service on the intranet or internet.  In this case, it has been configured by someone else and is readily available for consumption.  A remotely running extension can be used by many Deki Wiki installations, making it easier to update the extension for all sites.

The following screen shots show how easy it is to add an extension service.

./control-panel.png
Control Panel
./service-mgmt.png
Service Management - List View
./remote-service.png
Service Management - Add Remote Service

 When adding an extension, there are several preference settings that can be applied to affect how it can be used:

  • namespace: Overrides the extension's namespace.  Setting this preference to an empty string, removes the namespace prefix from the extension functions.
  • title: Overrides the extension title in the documentation page.
  • description: Adds a custom description text to the extension in the documentation page.

What can you do with Extensions?

Deki Wiki includes several extensions out of the box, which make it easy to embed dynamic content into wiki pages.

Flickr Service
Slideshows & Badges
./flickr.png
Google Service
Google Maps with marker and pop-up bubble
./google-maps.png
Graphviz Service
Generate complex graphs
./graphviz.png
ImageMagick Service
Apply effects to images
./imagemagick.png
MathService
Advanced math formulae rendering
./math.png
Yahoo Service
Show stock information and charts
./yahoo-stock.png

How do you use Extensions?

An extension defines a set of functions, which become available when the service is enabled in the Control Panel.  These functions can be invoked in different ways.

The most common use for simple invocations is done directly inline using the double-curly brace notation {{...}}.  The following function will include a page called "My Page".

{{wiki.page("My page")}} 

Another common use is to put the invocation inside a <pre class="script"> block.  The <pre> notation has the advantage that it can span multiple lines without interference from other markup.

<pre class="script">wiki.page("My Page")</pre> 

The last notation is a bit special, but lends itself well for functions that can take a large string argument.  It also uses the <pre class="script"> notation, but adds one more attribute that specifies the function to invoke.  For example <pre class="script" function="function-name">.  The contents of the <pre> block are then passed in as a string as the first argument.

<pre class="script" function="wiki.page">My Page</pre> 

What Extensions are available?

DekiWiki ships with a dozen extensions for Google, Windows Live, Flickr, and many others.  All extensions are setup in a similar manner, but some extension have prerequisites before they can be used.  Consult the documentation for each extension to see what is needed to set it up.

What data types do Extensions support?

Extensions use a small set of data types.  They are

  • nil - the empty value (i.e. nil, null)
  • bool - a boolean value (i.e. true, false)
  • num - an integer or floating-point number (e.g. 1, -5, 0.6)
  • string - a sequence of characters (e.g. "Hello World")
  • uri - a uniform resource identifier (only used internally)
  • map - an associative array (e.g. { a : 1, b : 2 })
  • list - an indexed array (e.g. [ 1, 2, "a" ])
  • xml - an xml document (only used internally)

How do you create your own Extensions using .Net?

 Refer here for a step-by-step tutorial on creating a new extension.

How do you create your own Extensions without .Net?

Extensions use a simple document exchange protocol for registering and invocation.  This makes it possible to write extensions in any language.

Registration

When an extension is registered, it is queried for its list of functions.  Let's assume our service resides at http://ext.mindtouch.com:8080/math.  When we register it, Deki Wiki issues a GET request on this uri, resulting in the following response:

<extension>
    <title>MindTouch Deki Math Service</title>
    <copyright>Copyright (c) 2007 MindTouch, Inc.</copyright>
    <uri.help>http://doc.opengarden.org/Deki_API/Reference/Math</uri.help>
    <namespace>math</namespace>
    <function>
        <name>formula</name>
        <uri>http://ext.mindtouch.com:8080/math/formula</uri>
        <return type="xml />
        <param name="formula" type="str">formula in Latex-AMS notation</param>
    </function>
</extension>

The important parts in this response are the <namespace> and <function> elements.  The <namespace> element is optional and determines the prefix for the functions.  For example, in this case, the namespace is "math", which means that all functions from this service will be prefixed with "math.".

The <function> element describes a function in the extension.  There can be any number of <function> elements in the response document.  The crucial parts in this element are the <name> and <uri> elements.  The <name> element is the name of the function, which will be combined with the namespace prefix to create the full name; in this case "math.formula".  The <uri> element specifies where the function is located.  When Deki Wiki finds a reference to this functions, it resolves the name to this URI and the POSTs a request document to it.

The rest of the elements (<title>, <uri.help>, <param>, <access>, etc.) are only informative and do not impact registration and execution.  These elements are only used to provide guidance to users when they access extensions.

Invocation

The next step in the chain is invoking an extension function.  Keeping with the Math service, let's look at the following wiki text:

{{math.formula("\\pi=\\frac{3}{4} \\sqrt{3}+24 \\int_0^{1/4}{\\sqrt{x-x^2}dx}")}}

The parameters get converted into a list, which is then serialized to XML.

<value type="list">
    <value key="#" type="str">\pi=\frac{3}{4} \sqrt{3}+24 \int_0^{1/4}{\sqrt{x-x^2}dx}</value>
</value>

The 'key' attribute is always '#' for lists, but has an alphanumeric value for maps.  The 'type' attribute specifies the value type (e.g. nil, bool, num, str, uri, map, list, or xml).

When the function completes, it responds with the invocation result, which is also returned inside an array:

<value type="doc">
    <value key="#" type="xml">
        <html>
            <body>
                <img src="http://ext.mindtouch.com:8080/host/$store/_x002F_math/806b359f-94ef-3aae-e253-2877a0af8a8c.img" />
            </body>
        </html>
    </value>
</value>

The XML format for extensions is based on DekiScript, the built-in expression language for Deki Wiki.  The following table shows how the native DekiScript types are encoded as XML.

Type
Encoding 
nil <value type="nil" />
bool <value type="bool>true</value>
<value type="bool">false</value> ­
numbers <value type="num">123.4</value>
string <value type="str">Hello World!</value>
uri <value type="uri">http://somewhere.com</value>­
map <value type="map">...</value>
where ... contains zero or more <value> elements with a "key" attribute
list <value type="list">...</value>
where ... contains zero or more <value> elements with a "key" attribute equal to "#" (e.g. <value type="nil" key="#" />)
xml <value type="xml">...</value>
where ... contains a single xml node

Factory Included Extension Services

Service Description
Digg The Digg service embeds the "Digg It" widget.
Feed The Feed service embeds RSS and ATOM feeds.
Flickr The Flickr service emeds photo badges and slideshows.
Gabbly The Gabbly service embeds a chat room that allows users to talk with anyone else across a site.
Google The Google service embeds an interactive Google map control.
Graphviz The Graphviz service generates dynamic flowcharts using the dot graphics notation.
ImageMagick The ImageMagick service allows images to be manipulated in various ways.
Math The Math service generate representations of mathematical formulae.
Media The Media service embeds videos from YouTube, Google, VMix, and others.
MySql The MySql service embeds tables from SQL queries.
Widgetbox The Widgetbox service embeds widgets from Widgetbox.com
WindowsLive The WindowsLive service embeds an interactive Virtual Earth control.
Yahoo The Yahoo service embeds interactive stock quotes from Yahoo! Finance

  

Tag page
Viewing 4 of 4 comments: view all
The documentation for the extensions should include an introduction with, at least, a link for additional information. However, a brief explanation or introduction for the extension as to what it does and why it matters would be helpful. For example, everyone is not going to be familiar with "spoiler tags", "ADO.NET" or "PageBus". Introductions have been added to some of the extensions. Also, every extension should have a corresponding example or demo.
Posted 13:48, 20 Mar 2008
I am assuming that users are starting to write their own extensions. Is there a repository for unofficial extensions that I can take a look at?
Posted 23:38, 10 Jun 2008
Some extensions are under Community, while others are hosted offsite. We really need to consolidate all extensions in one area, regardless of origin.
Posted 14:04, 11 Jun 2008
Hi there. Are there any commercial (i.e. for sale, not free) Deki extensions? I am considering porting my Balsamiq Mockups plugin http://www.balsamiq.com/products/mockups to Deki, but I need to know if I'll be able to charge for it (are there licensing APIs...etc). Please contact me via email.
Posted 09:44, 25 Jul 2008
Viewing 4 of 4 comments: view all
You must login to post a comment.