Revision 331811 of Template:DekiScript:Page

  • Revision slug: Template:DekiScript:Page
  • Revision title: Template:DekiScript:Page
  • Revision id: 331811
  • Created:
  • Creator: lmorchard
  • Is current revision? No
  • Comment
Tags: 

Revision Content

<% module.exports = buildAPI({ initialize: function (options) { BaseAPI.prototype.initialize.call(this, options); // Incomplete list of Page vars, but probably good enough. // See also: this.setVars({ date: new Date(env.modified), id: env.id, language: env.locale, name: env.slug, path: env.path, tags: env.tags, title: env.title, uri: env.url }); }, subpages: function (locale, slug) { //var p = kuma.url.parse(env.url, true); //var url = p.protocol + '//' + p.host + '/' + locale + '/docs/' + encodeURIComponent(slug) + '$children'; //log.debug(url); //var subpages = mdn.fetchJSONResource(url); //return subpages; return "blah"; } }); %>

Revision Source

<% module.exports = buildAPI({
    
    initialize: function (options) {
        BaseAPI.prototype.initialize.call(this, options);
        
        // Incomplete list of Page vars, but probably good enough.
        // See also: <http://developer.mindtouch.com/en/docs/DekiScript/Reference/Wiki_Functions_and_Variables/Page>
        this.setVars({
            date: new Date(env.modified),
            id: env.id,
            language: env.locale,
            name: env.slug,
            path: env.path,
            tags: env.tags,
            title: env.title,
            uri: env.url
        });
    },
    
    subpages: function (locale, slug) {
        //var p = kuma.url.parse(env.url, true);
        //var url = p.protocol + '//' + p.host + '/' + locale + '/docs/' + encodeURIComponent(slug) + '$children';
        //log.debug(url);
        //var subpages = mdn.fetchJSONResource(url);
        //return subpages;
        return "blah";
    }
    
}); %>