mozilla

Revision 337475 of Template:subpagesSummary

  • Revision slug: Template:subpagesSummary
  • Revision title: Template:subpagesSummary
  • Revision id: 337475
  • 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 subPages = page.subpages('',1); var list = []; if (subPages) { list.push('
'); for (var page in subPages) { list.push('
'); if (notCodeElements.indexOf(subPages[page].title) < 0) { list.push(''); list.push(subPages[page].title); list.push(''); } else { list.push(subPages[page].title); } list.push('
'); list.push('
'); list.push(wiki.page(subPages[page].url, summary)); list.push('
'); } list.push('
'); } %> <%- list.join('') %>

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 subPages = page.subpages('',1);
var list = [];
if (subPages) {
    list.push('<dl>');
    for (var page in subPages) {
        list.push('<dt><a href="');
        list.push(subPages[page].url)
        list.push('">');
        if (notCodeElements.indexOf(subPages[page].title) < 0) {
            list.push('<code>');
            list.push(subPages[page].title);
            list.push('</code>');
        } else {
            list.push(subPages[page].title);
        }
        list.push('</a></dt>');
        list.push('<dd>');
        list.push(wiki.page(subPages[page].url, summary));
        list.push('</dd>');
    }
    list.push('</dl>');
}
%>
<%- list.join('') %>