Template:TOCSectionForTag

by 2 contributors:
<pre class="script">
/* input parameters: topic tag, section tag, [optional] template to format the entry, such as HTMLElement */
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 p1 = wiki.gettag($0);
var links = [];
foreach(var p in p1.pages) {
  if (p.language == lang) {
    var t = p.tags;
    if (map.contains(t, $1)) {
      links += [{title: p.title, path: p.path, tags: t}];
    }
  }
}
links = list.sort(links, "title");
<ul style="-moz-column-count:3; -webkit-column-count:3;">;
foreach(var l in links) {
  <li>
    if ($2) {
      wiki.template($2, {title:l.title});
    } else {
      web.link(l.path, l.title);
    }
    if (map.contains(l.tags, "HTML5")) {
      web.text(" ");
      template.HTMLVersionInline(5);
    }
    if (map.contains(l.tags, "HTML4")) {
      web.text(" ");
      template.HTMLVersionInline(4);
    }
    if (map.contains(l.tags, "Deprecated")) {
      web.text(" ");
      template.deprecated_inline();
    }
    if (map.contains(l.tags, "Obsolete")) {
      web.text(" ");
      template.obsolete_inline();
    }
  </li>
}
</ul>;
</pre>
Search for pages that use Template:TOCSectionForTag to see example use cases and how many pages use this macro.

Document Tags and Contributors

Tags: 
Contributors to this page: ethertank, Sheppy
Last updated by: ethertank,