Template:domxref

  • Revision slug: Template:domxref
  • Revision title: Template:domxref
  • Revision id: 56086
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 4 words added, 49 words removed

Revision Content

/* accepts as input one required parameter: DOM API to create a xref to */
/* this will first try to link to DOM:parm1, then DOM/parm1 if that doesn't exist */

/* get a page's language (Don't use page.language!) */
var u = Uri.Parts(Page.uri);
var lang = u.path[0];

/* check first parm exists */
var dest = lang + '/' + 'DOM:' + $0;
if (wiki.pageExists(dest)) {
    (web.link(wiki.uri(dest), $0));
} else {
    dest = lang + '/' + 'DOM/' + $0;
    (web.link(wiki.uri(dest), $0));
}

%>

Revision Source

<pre class="script">
/* accepts as input one required parameter: DOM API to create a xref to */
/* this will first try to link to DOM:parm1, then DOM/parm1 if that doesn't exist */

/* get a page's language (Don't use page.language!) */
var u = Uri.Parts(Page.uri);
var lang = u.path[0];

/* check first parm exists */
var dest = lang + '/' + 'DOM:' + $0;
if (wiki.pageExists(dest)) {
    <code>(web.link(wiki.uri(dest), $0))</code>;
} else {
    dest = lang + '/' + 'DOM/' + $0;
    <code>(web.link(wiki.uri(dest), $0))</code>;
}

%>
Revert to this revision