-
Notifications
You must be signed in to change notification settings - Fork 513
/
XsltSidebar.ejs
41 lines (38 loc) · 1.25 KB
/
XsltSidebar.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<%
async function renderRootItem(slug) {
const [link, title] = await getPageLinkAndTitle(slug);
return `<li class="section"><a href="${link}">${title}</a></li>`
}
async function getPageLinkAndTitle(slug) {
let link = `/${env.locale}${slug}`;
let page = await wiki.getPage(link);
if (!page.title && env.locale !== 'en-US') {
link = `/en-US${slug}`;
page = await wiki.getPage(link);
}
let title = page.short_title || page.title;
title = mdn.htmlEscape(title);
return [link, title];
}
%>
<section id="Quick_links" data-macro="XsltSidebar">
<ol>
<%- await renderRootItem("/docs/Web/XSLT") %>
<%- await template("ListSubpagesForSidebar", ['/docs/Web/XSLT/Transforming_XML_with_XSLT', 1]) %>
</ol>
<ol>
<%- await renderRootItem("/docs/Web/XSLT/Element") %>
<%- await template("ListSubpagesForSidebar", ['/docs/Web/XSLT/Element', 1]) %>
</ol>
<ol>
<%- await renderRootItem("/docs/Web/EXSLT") %>
<%- await template("ListSubpagesForSidebar", ['/docs/Web/EXSLT', 1]) %>
</ol>
<ol>
<%- await renderRootItem("/docs/Web/XPath/Functions") %>
<%- await template("ListSubpagesForSidebar", ['/docs/Web/XPath/Functions', 1]) %>
</ol>
<ol>
<%- await renderRootItem("/docs/Web/XPath/Axes") %>
</ol>
</section>