-
Notifications
You must be signed in to change notification settings - Fork 514
/
Copy pathSVGElement.ejs
28 lines (24 loc) · 956 Bytes
/
SVGElement.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
<%
// Outputs a link to an SVG element's reference page.
//
// Parameters:
// $0 SVG element name
// $1 (optional) ignoreFlawMacro
const term = $0;
// If you use this macro directly in a page like this:
//
// {{SVGElement("image")}}
//
// you *want* flaws to bubble up. E.g. a typo like `{{SVGElement("imge")}}`
// But this macro is called from another macro, like `SVGRef` then, all those
// macro calls' flaws should be "suppressed" because it's a problem with the that
// sidebar macro, not the page the current user is viewing/working on.
// So if this 2nd argument is passed, it will potentially ignore the macro flaw.
const ignoreFlawMacro = $1;
const subPath = `Element/${term}`;
const baseURL = `/${env.locale}/docs/Web/SVG`;
const url = `${baseURL}/${subPath}`;
const title = `<${term}>`;
const link = web.smartLink(url, null, `<code>${mdn.htmlEscape(title)}</code>`, subPath, baseURL, ignoreFlawMacro);
%>
<%- link %>