Template:ScriptDoc

    Table of contents
    1. 1. Functions
    2. 2. Script Source
    {{ web.image(logo, _, _, xml.text(script, 'title')) }}
    {{ $author ? "Author" : "Vendor" }}
    {{ $author ?? $vendor ?? "Anonymous" }}
    Type
    var tags = page.tags;
    if(#tags) {
        foreach(var t in page.tags where string.startswith(t.value, "type:", true)) {
            if(__count > 0) ", ";
            web.link("http://developer.mindtouch.com/index.php?title=Special:Tags" & { tag: t.value }, string.tocamelcase(string.substr(t.value, 5)));
        }
    } else {
        "(missing)";
    }
    Categories
    var tags = page.tags;
    if(#tags) {
        foreach(var t in page.tags where string.startswith(t.value, "category:", true)) {
            if(__count > 0) ", ";
            web.link("http://developer.mindtouch.com/index.php?title=Special:Tags" & { tag: t.value }, string.tocamelcase(string.substr(t.value, 9)));
        }
    } else {
        "(none)";
    }
    
    Requires {{ xml.text(script, "requires/@host") ?? "MindTouch Core 1.8.3" }} or later
    Status {{ $status ?? "Work-in-progress" }}
    License {{ $license ?? "Free/Open Source" }}
    Manifest {{ $uri }}

     

    Install Script
    To add  this script to your site, enter the address of your MindTouch installation (ex: http://www.mindtouch.com) and click the Add Script button.  This will open your control panel and prepopulate the necessary values.  You will still need to manually add configuration settings if required.  Note that no changes are made to your site until you confirm the action in your control panel.
    Your site address:     


    Table of Contents
    {{ page.toc }}

    var description = xml.text(script, "description");
    if(description) {
        <h2> "Description" </h2>
        <p> description </p>
    }
    

    See also How to add a script, Using the Extension Dialog, Learn about DekiScript, Extensions Directory.


    var params = script["config/param"];
    if(#params) {
        <h2> "Configuration" </h2>
        <p> "The following configuration settings are required to run this script (unless shown as optional)." </p>
        <table cellspacing="0" cellpadding="1" border="1" style="width: 100%;">
            <tr style="background-image: none; vertical-align: top; background-color: #e1e1e1; text-align: left;">
                <td><strong> "Name" </strong></td>
                <td><strong> "Type" </strong></td>
                <td><strong> "Description" </strong></td>
            </tr>
            foreach(var param in params) {
                <tr>
                    <td> xml.text(param, "@name") </td>
                    <td> xml.text(param, "@type") ?? "any" </td>
                    <td>
                        (string.compare(xml.text(param, "@optional") ?? (xml.text(param, "@default") ? "true" : "false"), "true") != 0) ? _ : "(optional) ";
                        xml.text(param);
                    </td>
                </tr>
            }
        </table>
        <br />
        <hr />
    }
    

    Functions

    var funcs = [ fn foreach var fn in script["function[not(access) or access='public']"] ];
    let funcs = list.sort(funcs, _, _, "string.compare(xml.text($left, 'name'), xml.text($right, 'name'))");
    foreach(var fn in funcs) {
        var params = fn["param"];
        // create full function signature using extension namespace, function name, and parameter names
        <h3>
            var ns = xml.text(script, "namespace");
            if(#ns) {
                ns; ".";
            }
            xml.text(fn, "name");
            "("; string.join([ xml.text(param, "@name") .. " : " .. (xml.text(param, "@type") ?? "any") foreach var param in params ], ", "); ") : ";
            var ret = xml.text(fn, "return/@type");
            if(ret == "application/x.dekiscript+xml") "xml";
            else if(ret) ret;
            else if(#fn["return/html"]) "xml";
            else "any";
        </h3>
        // function description
        <p> xml.text(fn, "description"); </p>
        // function parameters (optional)
        if(#params) {
            <p><strong> "Parameters:" </strong></p>
            <table cellspacing="0" cellpadding="1" border="1" style="width: 100%;">
                <tr style="background-image: none; vertical-align: top; background-color: #e1e1e1; text-align: left;">
                    <td><strong> "Name" </strong></td>
                    <td><strong> "Type" </strong></td>
                    <td><strong> "Description" </strong></td>
                </tr>
                foreach(var param in params) {
                    <tr>
                        <td> xml.text(param, "@name") </td>
                        <td> xml.text(param, "@type") ?? "any" </td>
                        <td>
                            (string.compare(xml.text(param, "@optional") ?? (xml.text(param, "@default") ? "true" : "false"), "true") != 0) ? _ : "(optional) ";
                            xml.text(param);
                            var def = xml.text(param, "@default");
                            if(def) {
                                " (default: "; def; ")"
                            }
                        </td>
                    </tr>
                }
            </table>
            <br />
        }
        <hr />
    }
    

    Script Source

    {{ syntax.xml(web.text($uri), true) }}

    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by