Redirected from Deki Wiki/DekiScript
9 of 10 found this page helpful

DekiScript

  • We have highlighted your search term dekiscript for you. If you'd like to remove the search term, click here.

DekiScript Developer Documentation

Home    Beginner's Guide    Tutorials/Samples/FAQ    Reference

What is DekiScript?

DekiScript is a scripting language for mashing-up data from MindTouch, extensions, and virtually any XML/JSON web-service.  DekiScript has over 100 built-in functions for accessing and manipulating data.  With DekiScript you can read data from a wiki page, combine with data from a web-service, and generate dynamic page personalizd to the current user.  DekiScript makes it possible to automate complex reports, mash-ups, and data visualization that would otherwise require programming.

What sets DekiScript apart is that
    (a) it is safe to be used by anyone, enabling power users to customize or extend existing scripts;
    (b) it supports XML and JSON, making it easy to acccess almost any web-service;
    (c) it always generates valid XML structures, making it impossible to generate invalid content;
    (d) it is fully integrated into MindTouch, both for creating dynamic pages and even for creating extensions.

With DekiScript, you can create dynamic pages, but you can also create custom workflows or applications by leveraging the MindTouch API capabilities.  The form of DekiScript has been compared to Lua.

Hello World

Here is the "Hello World" equivalent in DekiScript.  Just open any page and type in the following text:

{{ 'Hello World' }}

The double curly braces (i.e. {{ }}) indicate to MindTouch that contents are DekiScript code.

The output is as expected: Hello World

   

Since DekiScript can be embedded side-by-side with regular content in a page, it is trivial to create dynamic content. The following code shows a personalized welcome message:

Hi {{ User.Name }}, today is {{ Date.DayName(Date.Now) }}.

Which produces this output: Hi Anonymous, today is Wednesday.

   

If you're not logged in, your name will appear as Anonymous, wich isn't a great way to greet someone.  Let's fix that.  The following code uses the ?: operator to check if the user is known or not and show the appropriate greeting.

Hi {{ User.Anonymous ? 'stranger' : User.Name }}, today is {{ Date.DayName(Date.Now) }}.

Which produces this output: Hi stranger, today is Wednesday.

Using Variables

The following example shows how to set a variable, print a variable and how to reset an existing variable.

{{
var output = "Hello World";		        // Set the output variable
output;					                // Print the output

<br/><br/>                              // Add some line breaks

let output = "Hello Universe";  	    // Reset the ouput variable
output; 				                // Print the output
}}

What's Next?

DekiScript enables you to generate dynamic content on the fly in wiki pages from virtually any data source: internal or external.  Check out the Tutorial pages to learn more.

Was this page helpful?
Tag page
You must login to post a comment.

Copyright © 2011 MindTouch, Inc. Powered by