forked from gitgitgadget/gitgitgadget.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbaseof.html
More file actions
48 lines (47 loc) · 1.58 KB
/
baseof.html
File metadata and controls
48 lines (47 loc) · 1.58 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ .Title }}</title>
<link rel="icon" href="{{ relURL "favicon.ico" }}">
{{- $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "main.scss" . | css.Sass }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{- partial "breadcrumbs.html" . -}}
</head>
<body>
{{ partial "banner.html" . -}}
{{ block "main" . }}
{{ .Content }}
{{ end }}
</body>
{{- if .Store.Get "hasGraphviz" }}
<script src="{{ relURL "js/viz-global.js" }}"> </script>
<script type="text/javascript">
let vizInstance
window.addEventListener("DOMContentLoaded", async () => {
[...document.querySelectorAll("pre[class=graphviz]")].forEach(async (x) => {
if (!vizInstance) vizInstance = await Viz.instance()
if (x.style.display === 'none') return
const options = {
format: "svg",
graphAttributes: {
bgcolor: "transparent",
},
engine: x.getAttribute("engine") || "dot",
}
const svg = vizInstance.renderString(x.innerText, options)
const img = document.createElement('img')
img.setAttribute(
'src',
`data:image/svg+xml;utf8,${encodeURIComponent(svg.substring(svg.indexOf('<svg')))}`
)
const alt = x.getAttribute("alt")
if (alt) img.setAttribute("alt", alt)
x.parentNode.insertBefore(img, x);
x.style.display = 'none'
})
})
</script>
{{- end }}
</html>