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 Script
Categories
var tags = page.tags;
if(#tags) {
    foreach(var t in page.tags) {
        if(__count > 0) ", ";
        web.link("http://developer.mindtouch.com/index.php?title=Special:Tags" & { tag: t.value }, string.tocamelcase(t.value));
    }
} else {
    "(none)";
}
Requires {{ xml.text(script, "requires/@host") ?? "MindTouch Deki 1.8.3" }} or later
Status {{ $status ?? "Work-in-progress" }}
License {{ $license ?? "Free/Open Source" }}
Manifest {{ $uri }}

 

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") 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.