DekiScript is jam packed hundreds of extensions, properties and native functions designed to make building your apps in MindTouch a breeze.  Below is a short list of some of the many DekiScript Functions and Variable

    For information on how to get started writing DekiScript please reference the Getting Started Guide below.

    Date Functions

    These functions demonstrate how to work with and manipulate the date for your MindTouch applications.

    DekiScript Description
    {{ date.now }}
    Output todays date and time:  Mon, 06 Sep 2010 03:54:18 GMT
    {{ date.Date(date.now) }}
    Output todays date :  Mon, 06 Sep 2010
    {{ date.Time(date.now) }}
    Output the current time:  03:54
    {{ date.DiffDays(date.now, "01/01/2000") }} 
    Calculate the number of days difference between two dates:  979.162708333333

    List Functions

    These functions demonstrate how to use lists to manage and manipulate groups of data.

    DekiScript Description
    {{var demolist = ['MindTouch','San Diego','DekiScript'];}}
    Define a new list
    {{ list.contains(demolist, "MindTouch") }} 
    Determines whether a list contains a given value

    Map Functions

    These functions will demonstrate how to utilize maps to store structured sets of data.

    DekiScript Description
    {{ var demomap = {company:'MindTouch',city:'San Diego'}; }}
    Define a map
    {{map.values(demomap) }}
    Output only the values from the map

    Meta Functions

    These functions will demonstrate how to modify the meta data of a given page.  Note: the meta.* functions require UNSAFECONTENT permission.

    DekiScript Description
    {{meta.author("John Doe") }} 
    Change the <meta name="author"> of the current page to "John Doe"
    {{meta.custom("Shared Rights", "Joe Schmoe") }} 
    Add a custom <meta name="Shared Rights"> tag to the current page

    Web Functions

    These functions will demonstrate how to embed and work with content from other websites.

    DekiScript Description
    {{ web.image("http://assets.mindtouch.com/mdc_header/images/logo.png"); }}
    Insert an image into a page
    {{ web.text("http://www.mindtouch.com") }}
    Convert source to text and optionally fetching and parsing it.

    XML Functions

    These functions will demonstrate how to work with XML inside and outside your MindTouch.

    DekiScript Description
    {{ xml.format(wiki.api(page.api)["//user.author"]) }}
    Convert the XML document to a formatted string. Xml.Format provides three formatting options: plain, xhtml, and indented.
    {{ xml.text(page.xml, "//span[@id='sample-text']") }}
    Get the the text value of an XML node.  The XML node can be optionally selected using an XPath expression with XML namespaces.  Xml.Text captures the text value of its first child node, which must be a text node.  This means that if the XML node has mixed content (i.e. sub-elements and text nodes), then only the text up to the first sub-element is returned.  Alternatively, Xml.Text can return the XML string representation of the selected node.
    Was this page helpful?
    Tag page (Edit tags)
    You must login to post a comment.
    Powered by MindTouch 2010
    Powered by MindTouch 2010