Was this page helpful?

Objects

    Table of contents
    No headers

    DekiScript consists of approximately 6 structures at the moment, they are:  page, user, comment, site, tag, and file. Using these structures, you can pull information from their list of properties. However, what makes these structures special is that you can also chain them together. Meaning that you can make a series of modifier calls where each call returns the host object for further modification calls. 

     For example, page has a property called parent which will return with the page's parent information.  This is the way you would call the property without chaining:

    {{page.parent}}
    { api : "http://developer.mindtouch.com/@api/deki/pages/10432", author : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$user", comments : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagecomments", contents : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagecontents", date : "Wed, 30 Sep 2009 22:08:14 GMT", editsummary : "Reverted to earlier version; 5 words added", feed : "http://developer.mindtouch.com/@api/deki/pages/10432/feed", files : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$files", fronturi : "http://developer.mindtouch.com/en/docs/DekiScript/Reference/Wiki_Functions_and_Variables", id : 10432, ishidden : False, language : nil, mime : "application/x.deki0805+xml", name : "Wiki_Functions_and_Variables", namespace : "", parent : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$page", parents : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$parents", path : "en/docs/DekiScript/Reference/Wiki_Functions_and_Variables", properties : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pageprops", rating : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$rating", redirect : nil, revision : 58, revisions : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$revisions", subpages : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$subpages", tags : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagetags", talkuri : "http://developer.mindtouch.com/Talk:en/docs/DekiScript/Reference/Wiki_Functions_and_Variables", text : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagetext", title : "Wiki Functions and Variables", toc : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagetoc", unprefixedpath : "en/docs/DekiScript/Reference/Wiki_Functions_and_Variables", uri : "http://developer.mindtouch.com/en/docs/DekiScript/Reference/Wiki_Functions_and_Variables", viewcount : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pageviewcount", xml : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagexml" }

    An example of chaining the properties. In this case, we call the page's parent's parent:

    {{page.parent.parent}}
    { api : "http://developer.mindtouch.com/@api/deki/pages/10668", author : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$user", comments : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagecomments", contents : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagecontents", date : "Thu, 08 Apr 2010 20:45:34 GMT", editsummary : "2 words removed", feed : "http://developer.mindtouch.com/@api/deki/pages/10668/feed", files : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$files", fronturi : "http://developer.mindtouch.com/en/docs/DekiScript/Reference", id : 10668, ishidden : False, language : nil, mime : "application/x.deki0805+xml", name : "Reference", namespace : "", parent : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$page", parents : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$parents", path : "en/docs/DekiScript/Reference", properties : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pageprops", rating : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$rating", redirect : nil, revision : 21, revisions : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$revisions", subpages : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$subpages", tags : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagetags", talkuri : "http://developer.mindtouch.com/Talk:en/docs/DekiScript/Reference", text : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagetext", title : "Reference", toc : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagetoc", unprefixedpath : "en/docs/DekiScript/Reference", uri : "http://developer.mindtouch.com/en/docs/DekiScript/Reference", viewcount : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pageviewcount", xml : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$pagexml" }

      

    In this example, we call the page's parent's parent's title:

    {{page.parent.parent.title}}
    Reference

     

    You can even cross over between structures while chaining, as long as you make sure that the returned value is of the structure type that can be called by your next property call:

    Allowed Crossover:

    In this example we will get the user's page's parent's uri. the user has a property of page because a pointer to the page's mapping information exists in the value of user's page key.

    {{user}}
    
    { active : True, admin : False, anonymous : True, api : "http://developer.mindtouch.com/@api/deki/users/754", authtoken : nil, comments : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$usercomments", email : "", emailhash : "", feed : "http://developer.mindtouch.com/@api/deki/users/754/feed", fullname : nil, gravatar : "http://www.gravatar.com/avatar/no-email.png?d=http://developer.mindtouch.com/skins/common/images/default-avatar.png", groups : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$usergroups", homepage : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$page", id : 754, language : nil, metrics : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$usermetrics", name : "Anonymous", owner : nil, properties : "local://8be0fa3289404f99a6b6f218cc6cbaba/deki/$userprops", seated : nil, timezone : "GMT", uri : "http://developer.mindtouch.com/User:Anonymous" }

      

    And once you call the page property, you can see that it returns a map that contains information like a key pointing to the parent information:

    {{user.page}}
    

      

    The parent property call then returns the page information on the parent, which contains a key that will point to the parent page's uri:

    {{user.page.parent}}
    

      

       

    And finally, once you make the uri property call on the page's parent information, it will return the value of the uri key seen below:

    {{user.page.parent.uri}}
    

      

    Crossover that doesn't work:

    In this case, the call fails because site.api returns a string. Since the parent property depends on something of type page, it is not compatible with the returned site.api type. 

    {{site.api.parent}}
    
    str is not valid; expected num: /content/body/table[8]/tbody/tr/td[2]/span, line 1, column 9 (click for details)
    Was this page helpful?
    Tag page
    Viewing 1 of 1 comments: view all
    user.language would be a handy addition
    Posted 02:43, 28 Aug 2009
    Viewing 1 of 1 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by