mozilla

Revision 479277 of Template:MathMLRef

  • Revision slug: Template:MathMLRef
  • Revision title: Template:MathMLRef
  • Revision id: 479277
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment

Revision Content

<% 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; } var s_mathml_href = '/en-US/docs/Web/MathML'; var s_mathml_title = 'MathML'; 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_href = '/de/docs/Web/MathML'; s_mathml_title = 'MathML'; s_mathml_ref_href = 'de/docs/Web/MathML/Element'; s_mathml_ref_title = 'MathML Referenz'; 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 = page.subpagesExpand(s_mathml_ref_href); // Get subpages, including tags log.debug(pageList); var result = []; for (aPage in pageList) { if (containsTag(pageList[aPage].tags, s_mathml_element_tag) { result.push(pageList[aPage]); } } <% if (s_mathml_href) { %> <%}%>

Revision Source

<%
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;
}

var s_mathml_href = '/en-US/docs/Web/MathML';
var s_mathml_title = 'MathML';
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_href = '/de/docs/Web/MathML';
        s_mathml_title = 'MathML';
        s_mathml_ref_href = 'de/docs/Web/MathML/Element';
        s_mathml_ref_title = 'MathML Referenz';
        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 = page.subpagesExpand(s_mathml_ref_href);   // Get subpages, including tags
log.debug(pageList);
var result = [];

    for (aPage in pageList) {
        if (containsTag(pageList[aPage].tags, s_mathml_element_tag) {
            result.push(pageList[aPage]);
        }
    }

<% if (s_mathml_href) {  %>
    <section class="Quick_links" id="Quick_Links">
    <ol>
        <li><a href="<%=s_mathml_ref_href%>"><%=s_mathml_ref_title%></a>

        <% for (aPage in result) { %>
            <li><a href="<%-result[aPage].url%>"><%-result[aPage].title%></a></li>
        <% } %>
        
        </li>  
    </ol>
    </section>
<%}%>