Wiki Functions and Variables

DekiScript Developer Documentation

Home    Tutorials    Reference    Samples/FAQ


The following functions and variables are part of the Deki Wiki runtime environment and are only available within wiki pages.  Hence, these functions and variables cannot be accessed from by XML extensions.

Wiki Functions

All wiki functions generate embeddable content, such as the contents of another wiki page, search results, page hierachy, or localized text.

Function Description
Wiki.AnyPage Show the contents of a random page selected from the query's result set.
Wiki.Api Get an XML document from the API using the current user's credentials.
Wiki.Contributors Insert a list of top or most recent contributors on the site.
Wiki.Create Insert a link or button to create a new page.
Wiki.Directory Insert an alphabetical directory of all pages found by the search query.
Wiki.Edit Insert a link or button to open the editor.
Wiki.GetPage Get page object at wiki page path.
Wiki.GetSearch Get list of found page and file objects.
Wiki.GetTag Get specified tag.
Wiki.GetUser Get user object for user name or id.
Wiki.Inclusions Get list of pages that form the current inclusion chain.  The first item is the outermost page that is being loaded.  The last item is the current page, unless the current page is a template and templates are excluded (see parameter below).
Wiki.Languages Displays a page's versions written in other languages.
Wiki.Localize Retrieve a localized resource string. For more information on available resource names and the parameters that they take, please refer to the
Wiki.Page Include a wiki page.
Wiki.PageCount Insert the total number of pages that exist.
Wiki.PageExists Check if the given wiki page exists.
Wiki.PagePermissions Get the effective permissions for a user and page.
Wiki.Popular Show list of popular pages.
Wiki.Search Insert a list of search results.
Wiki.TagButton Insert button linking to all tagged pages. (IN PROGRESS)
Wiki.Template Insert dynamically a wiki template with parameters.
Wiki.Text Retrieve the text contents for an entire or part of another wiki page
Wiki.Toc Insert table of contents of a wiki page.
Wiki.Tree Insert a wiki page's subpage tree.
Wiki.Uri Retrieve the full uri of a given wiki page.
Wiki.UserCount Get number of wiki users.
Wiki.Version Get the current version of Deki

Wiki Variables

Variables are used to access the current page object, user object, and site object.

Variable Type Description
Page page : map Access the current page object (Note: if page property is used inside a template, it refers to the nearest non-template page this is including the template).
Site site : map Access the site object.
User user : map Access the current user object.
__mode str One of "view", "edit", or "save".  Indicates during what operation the script is being executed.
__include bool Indicates if the page is being included into another page.
__request map Request map containing query arguments for the page. (8.05.1 or later)
__safe bool Check if page contents are executed in safe mode. (9.02 or later)

Wiki Objects

Objects are like maps, but have a known structure.  Deki Wiki defines several objects corresponding to various items inside the wiki.

Comment Object

The comment object contains the text of the comment, the user ID, the home page of the user, and other information.

Field Type Description
Author  user : map User that wrote the comment.
Text  str Text contents of the comment.
Date  str Date in UTC format of the comment.
Mime  str Mime type of the comment.
Page  page : map Page on which the comment is located on.

File Object

The file object contains the name of the file, the description of the file, the date when the file was attached, and other information.

Field Type Description
Description str Description of the file attachment.
Name str File name of the file attachment.
Size num Size in bytes of the file attachment.
Page page : map Page object to which the file is attached to.
Mime str Mime type of the file attachment.
Date str Date in UTC format when the file was attached.
Author user User who attached the file.
Api str API for operation on the file attachment.
Uri str URI to retrieve the file attachment.
ImageWidth int Width of the image, if the file is an image (9.02 or later)
ImageHeight int Height of the image, if the file is an image (9.02 or later)
ImageFrames int Frames contained in the image, if the file is an image (9.02 or later)
ThumbUri uri URI to the Thumbnail of the image, if the file is an image (9.02 or later)
WebViewUri uri URI to the web preview of the image, if the file is an image (9.02 or later)

Page Object

The page object contains the date the page was last modfied, the page ID, the attaches files, and other information.

Function Description
Api The API of the current page.
Author The users that created the current page name and information.
Comments The comments for the current page.
Date Date-time in GMT when the current page was last modified.
EditSummary Change summary associated with last edit operation.
Feed Retrieve the RSS/Atom feed uri of the page.
Files The files attached to the current page.
FrontUri URI to access front page of current page (regardless if current page is front page or not).
Id ID of the current page.
Language The language on the current page.
Mime The mime type of the current page.
Name Name of the current page.
Namespace Namespace of the current page.
Parent The parent of the current page.
Parents The hierarchical parents of the current page.
Path Path of the current page.
Properties Returns the values from the property page for a given page.
Revisions The revisions of the page
Subpages The subpages that stem from the current page.
Tags The tags attached to the current page.
TalkUri URI to access talk page of current page (regardless if current page is talk page or not).
Text Raw text contents of the page.
Title Title of the current page.
Toc Table of content for the current page.
UnprefixedPath Path of the page without namespace prefix.
Uri URI of the current page.
ViewCount View counter for the current page. (this replaces page.counter which is obsolete)
Xml The raw XML contents of the current page.

Site Object

The site object contains the host name of the site, the language of the site, and other information.

Function Description
Api Site API URI.
Feed Retrieve the RSS/Atom feed uri of the site.
HomePage The home page of the site.
HostName Site name.
Language Site
PageCount Number of pages on the site.
Tags All tags defined for the site
Uri Site URI.
UserCount Number of users on the site.
Users All users of the site

Tag Object

The tag object contains the name of the tag, the type of the tag, the list of tagged pages, and other information.

Field Type Description
Name  str Full name with prefix of tag.
Prefix  str Prefix of tag.
Type  str Types of tags (one of "text", "date, ", "user", or "define").
Value  str Value of tag.
Pages [ page ] : list List of tagged pages.
Definition page : map Tag's definition page object.

User Object

The user object contains the name of the user, the user ID, the home page of the user, and other information.

Function Description
Admin Determine whether the user is an administrator or not
Anonymous User object represents the anonymous user.
Api The uri of the current user.
Authtoken The Authtoken used to authenticate the user. Only populated for the current user.
EmailHash The MD5 hash-value of the user's email address.
Feed Retrieve the RSS/Atom feed uri for the user.
Gravatar The Gravatar URI for the user object.
HomePage The home page of the user.
Id ID of the current user.
Name Name of the current user.
Timezone Determine a user's timezone
Uri URI for user's page.
Tag page
You must login to post a comment.