[Some initial thoughts on what should go here in response to SteveB's remark on the form.]
With the release of Deki Wiki version 8.05 DekiScript has become a full-featured scripting language. It now includes variables (var), assignment (let), conditionals (if, if...else...), and looping (foreach).
Use Tools >>> About to see what version of Deki Wiki you are using.
For a complete list of functions and extensions available on your Deki Wiki installation, see the Extensions List link in the tab at the bottom right of the editor pane. (Obviously you need to be in the editor to see this.)
Any user with UPDATE permission can use DekiScript when editing wiki pages. Users with UNSAFE CONTENT permission can also embed JavaScript directly.
To create new DekiScript functions, write an XML extension. An extension is a mix of DekiScript, HTML, and JavaScript. To create an extension you need an XML editor (a text editor works as well, but makes it harder to write valid XML), access to the wiki, and write access to some HTTP server where the XML extension can be uploaded to. Extensions can not be added to a wiki hosted on wik.is unless you buy one of the yearly hosting options (that is, users of free and "pro" status wiki cannot add extensions).
In WYSIWYG-mode you can insert simple scripts between double curly braces:
{{ ...script... }}
For scripts of any length, use [include material from How do I...Break long Dekiscript lines? which give solutions for both before and after 8.05.1]
Another way to use DekiScript is by incorporating it with special HTML attributes. See for example [some cleaned up version of MindTouch_Deki/DekiScript/Reference/DekiScript_HTML_Attributes.]
[One of the powerful aspects of DekiScript is the elegant way XPath is incorporated. I'd make that point quite clear and point to some examples.]
[why is there a difference? legacy? Why as a user should I see this distinction? Makes it seem as if wiki functions are somehow in a different scope than DekiScript functions. Since these are the top two items in the reference section, I think some explanation or change in presentation would be useful.]
Deki_Wiki/DekiScript/Literals is blank. [That information needs to be somewhere.]
[I would highlight the availability of the map and xml datatypes.]
DekiScript makes extensive user of the map data type, an associate array. One unique way this type is used is to provide an alternate way to pass arguments to a function. For example, given this function definition:
wiki.anypage(query : str, seconds : num, max : num, linkonly : bool, titlestyle : str) : xml
You can call it one of two ways:
| Conventional function calling. | wiki.anypage("mary OR jane", 3600, 10) |
| Using map notation. Notice the use of curly braces rather than parentheses. | wiki.anypage{query: "mary OR jane", max:10} |
In both methods parameters with defualt values may be omitted, although in the conventional method only from the end of parameter list.