Template:subpagesSummary

  • Revision slug: Template:subpagesSummary
  • Revision title: Template:subpagesSummary
  • Revision id: 292159
  • Created:
  • Creator: Jeremie
  • 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 = Array.prototype.slice.call(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é" }); var subPages = Page.subpages; if (subPages && subPages.length > 0) { subPages.sort(function (a, b) { return a.value.title.localeCompare(b.value.title); }) %>
<% subPages.forEach(function (thePage) { %>
<% if(notCodeElements.indexOf(thePage.value.title) < 0) { %><%= thePage.value.title %><% } else { %><%= thePage.value.title %><% } %>
<%- wiki.page(thePage.value.uri, summary) %>
<% }); %>
<% } %>

Revision Source

<%
/* The list of template's arguments is used to know which subpages title should not be marked as code */
var notCodeElements = Array.prototype.slice.call(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é"
});

var subPages = Page.subpages;

if (subPages && subPages.length > 0) {
    subPages.sort(function (a, b) {
        return a.value.title.localeCompare(b.value.title);
    })
%>
<dl>
<%
    subPages.forEach(function (thePage) {
%>
    <dt><a href="<%- thePage.value.uri %>"><%
        if(notCodeElements.indexOf(thePage.value.title) < 0) {
            %><code><%= thePage.value.title %></code><%
        } else {
            %><%= thePage.value.title %><%
        }
    %></a></dt>
    <dd><%- wiki.page(thePage.value.uri, summary) %></dd>
<%
    });
%>
</dl>
<%
}
%>
Revert to this revision