diff --git a/kumascript/macros/SectionOnPage.ejs b/kumascript/macros/SectionOnPage.ejs deleted file mode 100644 index 6b040a9432f2..000000000000 --- a/kumascript/macros/SectionOnPage.ejs +++ /dev/null @@ -1,71 +0,0 @@ -<% -// Create a link to a specific section on a page. -// -// Parameters: -// -// $0 Page path -// $1 Section name -// $2 Element name to wrap the page title (not the section name) in; -// leave blank or don't specify this parameter to not wrap the title. -// Don't include the angle brackets! Only specific tags are permitted; -// they're in the allowedWrappers array. OPTIONAL. -// -// Example: -// -// {{SectionOnPage("/en-US/docs/Web/API/RTCPeerConnection", -// "RTCSignalingState enum", "code")}} - -mdn.deprecated(); - -let allowedWrappers = [ - "code", - "kbd", -]; - -let section = $1; -let lang = env.locale; -let text = ""; -let page = await wiki.getPage($0); -let title = mdn.htmlEscape(page.title); - -let commonLocalStrings = web.getJSONData("L10n-Common"); -let localize = mdn.getLocalString; - -if (!title || title == undefined || title == "undefined") { - title = localize(commonLocalStrings, "MissingPage"); -} - -let elem = $2; - -if (elem && elem != "") { - elem = elem.toLowerCase(); - - if (allowedWrappers.includes(elem)) { - title = `<${elem}>${title}`; - } -} - -let url = $0 + "#" + section; - -url = Web.spacesToUnderscores(url); -url = url.replace(":", ""); // Remove colons - -switch(lang) { - case "ja": - text = `${section}${title} 内)`; - break; - case "ru": - text = `${section} в ${title}`; - break; - case "zh-CN": - text = `${title} 中的 ${section}`; - break; - case "zh-TW": - text = `${title} 中的 ${section}`; - break; - default: - text = `${section} in ${title}`; - break; -} -%> -<%-text%>