Template:subpagesSummary

  • Revision slug: Template:subpagesSummary
  • Revision title: Template:subpagesSummary
  • Revision id: 338285
  • Created:
  • Creator: trevorh
  • Is current revision? No
  • Comment

Revision Content

<% /* The list of template's arguments is used to know which subpages title should not be marked as code */ var notCodeElements = arguments; /* To include the subpage summary, we need to know which local slug/hash to use with wiki.page */ var summary = mdn.localString({ "en-US": "Summary", "fr": "Résumé", "ja": "概要" }); var pages = page.subpages('','1'); var str = ''; if (pages.length) { str += '
'; pages.forEach(function(item) { str += '
'; if(notCodeElements.indexOf(item.title) < 0) { str += '' + kuma.htmlEscape(item.title) + ''; } else { str += kuma.htmlEscape(item.title); } str += '
'; str += '
' + wiki.page(item.url, summary) + '
'; }); str += '
'; } %> <%- str %>

Revision Source

<%
/* The list of template's arguments is used to know which subpages title should not be marked as code */
var notCodeElements = arguments;
   
/* To include the subpage summary, we need to know which local slug/hash to use with wiki.page */
var summary = mdn.localString({
    "en-US": "Summary",
    "fr": "Résumé",
    "ja": "概要"
});
   
var pages = page.subpages('','1');
var str = '';
if (pages.length) {
    str += '<dl>';
    pages.forEach(function(item) {
        str += '<dt><a href="' + item.url + '">';
        if(notCodeElements.indexOf(item.title) < 0) {
            str += '<code>' + kuma.htmlEscape(item.title) + '</code>';
        } else {
            str += kuma.htmlEscape(item.title);
        }
        str += '</a></dt>';
        str += '<dd>' + wiki.page(item.url, summary) + '</dd>';
    });
    str += '</dl>';
}
%>
<%- str %>
Revert to this revision