Template:subpagesSummary

  • Revision slug: Template:subpagesSummary
  • Revision title: Template:subpagesSummary
  • Revision id: 332557
  • 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 pageSubPages = page.subpages('',1); var str = ''; if (pageSubPages) { var subPages = pageSubPages.subpages; str += '
'; for (var page in subPages) { str += '
'; if(notCodeElements.indexOf(subPages[page].title) < 0) { str += '' + subPages[page].title + ''; } else { str += subPages[page].title; } str += '
'; str += '
' + wiki.page(subPages[page].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 pageSubPages = page.subpages('',1);
var str = '';
if (pageSubPages) {
    var subPages = pageSubPages.subpages;
    str += '<dl>';
    for (var page in subPages) {
        str += '<dt><a href="' + subPages[page].url + '">';
        if(notCodeElements.indexOf(subPages[page].title) < 0) {
            str += '<code>' + subPages[page].title + '</code>';
        } else {
            str += subPages[page].title;
        }
        str += '</a></dt>';
        str += '<dd>' + wiki.page(subPages[page].url, summary) + '</dd>';
    }
    str += '</dl>';
}
%>
<%- str %>
Revert to this revision