This repository has been archived by the owner on Jun 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy pathMathMLRef.ejs
54 lines (46 loc) · 1.57 KB
/
MathMLRef.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
42
43
44
45
46
47
48
49
50
51
52
53
54
<%
function containsTag(tagList, tag) {
if (!tagList || tagList == undefined) return 0;
tag = tag.toLowerCase();
for (var i = 0, len = tagList.length; i < len; i++) {
if (tagList[i].toLowerCase() == tag) return 1;
}
return 0;
}
function safe_tags(str) {
return str.replace(/</g,'<').replace(/>/g,'>') ;
}
var s_mathml_ref_href = '/en-US/docs/Web/MathML/Element';
var s_mathml_ref_title = 'MathML Reference';
var s_mathml_element_tag = 'MathML:Element';
switch (env.locale) {
case 'de':
s_mathml_ref_href = '/de/docs/Web/MathML/Element';
s_mathml_ref_title = 'MathML Referenz';
s_mathml_element_tag = 'MathML:Element';
break;
case 'ru':
s_mathml_ref_href = '/ru/docs/Web/MathML/Element';
s_mathml_ref_title = 'Руководство MathML';
s_mathml_element_tag = 'MathML:Element';
break;
default: break;
}
// Find the pages of s_mathml_ref_href that are tagged with s_mathml_element_tag
var pageList = await page.subpagesExpand(s_mathml_ref_href); // Get subpages, including tags
var result = [];
for (aPage in pageList) {
if (containsTag(pageList[aPage].tags, s_mathml_element_tag)) {
result.push(pageList[aPage]);
}
}
%>
<section class="Quick_links" id="Quick_Links">
<ol>
<li><strong><a href="<%=s_mathml_ref_href%>"><%=s_mathml_ref_title%></a></strong>
<% for (aPage in result) { %>
<li><a href="<%-result[aPage].url%>"><%-safe_tags(result[aPage].title)%></a></li>
<% } %>
</li>
</ol>
</section>