Revision 114474 of Template:AMInterface

  • Revision slug: Template:AMInterface
  • Revision title: Template:AMInterface
  • Revision id: 114474
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 1 words added, 5 words removed
Tags: 

Revision Content

/* accepts as input one required parameter: Addon Manager interface to create a xref to */
/* optional second parameter: method to link to in that interface */
/* get a page's language (Don't use page.language!) */
var u = Uri.Parts(Page.uri);
var lang = string.toLower(u.path[0]);
if(string.Contains(lang, "project")) {
 lang = string.Substr(lang, 8);
}
/* fall back to page.language on a user page */
else if (string.StartsWith(lang, "user:")) {
 lang = page.language;
}

var dest = lang + '/Addons/Add-on_Manager/' + $0;
var title = $0;
var target = "";

if ($1) {
  target = '#' + $1 + '()';
  title = $0 + '.' + $1 + '()';
}

if (wiki.pageExists(dest)) { /* the page exists */
    (web.link(wiki.uri(dest) + target, title));
} else { /* the page doesn't exist */
    <a rel=('internal') href=(wiki.uri(dest) + target) class=('new')>titlea>;
}

%>
      

Revision Source

<pre class="script">
/* accepts as input one required parameter: Addon Manager interface to create a xref to */
/* optional second parameter: method to link to in that interface */
/* get a page's language (Don't use page.language!) */
var u = Uri.Parts(Page.uri);
var lang = string.toLower(u.path[0]);
if(string.Contains(lang, "project")) {
 lang = string.Substr(lang, 8);
}
/* fall back to page.language on a user page */
else if (string.StartsWith(lang, "user:")) {
 lang = page.language;
}

var dest = lang + '/Addons/Add-on_Manager/' + $0;
var title = $0;
var target = "";

if ($1) {
  target = '#' + $1 + '()';
  title = $0 + '.' + $1 + '()';
}

if (wiki.pageExists(dest)) { /* the page exists */
    <code>(web.link(wiki.uri(dest) + target, title))</code>;
} else { /* the page doesn't exist */
    <code><<span class="start-tag">a</span><span class="attribute-name"> rel</span>=(<span class="attribute-value">'internal') </span><span class="attribute-name">href</span><span>=</span>(<span>wiki.uri(</span>dest<span>)</span> + target<span>) </span><span class="attribute-name">class</span>=<span class="attribute-value">('new')></span>title</<span class="end-tag">a></span></code>;
}

%>