Skip to content

Commit 9b9ea22

Browse files
committed
Initial commit
0 parents  commit 9b9ea22

File tree

4 files changed

+113
-0
lines changed

4 files changed

+113
-0
lines changed

docs.Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM alpine
2+
3+
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin
4+
5+
COPY requirements.txt /mkdocs/
6+
WORKDIR /mkdocs
7+
8+
RUN apk --update upgrade \
9+
&& apk --no-cache --no-progress add py-pip \
10+
&& rm -rf /var/cache/apk/* \
11+
&& pip install --user -r requirements.txt

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mkdocs>=0.17.2
2+
pymdown-extensions>=1.4
3+
mkdocs-bootswatch>=0.4.0
4+
mkdocs-material>=2.2.6

structor-menu.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@media only screen and (min-width:76.25em) {
2+
.md-nav__item--version {
3+
border-width: 0.09rem;
4+
border-style: solid;
5+
border-radius: .2rem;
6+
padding-left: .625em !important;
7+
padding-bottom: .425em !important;
8+
margin-top: 1.875rem;
9+
}
10+
}

structor-menu.js.gotmpl

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
const versions = [
2+
{{- range $version := .Versions }}
3+
{{- $text := $version.Text }}
4+
{{- if eq $text "Experimental" }}
5+
{{- $text = "Master" }}
6+
{{- end}}
7+
{{- if eq $version.State "PRE_FINAL_RELEASE" }}
8+
{{- $text = printf "%s (RC)" .Name }}
9+
{{- end}}
10+
{path: "{{ $version.Path }}", text: "{{ $text }}", selected: {{ eq $version.Name $.Current }} },
11+
{{- end}}
12+
];
13+
14+
// Material theme
15+
16+
function addMaterialMenu(elt, versions) {
17+
const current = versions.find(function (value) {
18+
return value.selected
19+
})
20+
21+
const rootLi = document.createElement('li');
22+
rootLi.classList.add('md-nav__item');
23+
rootLi.classList.add('md-nav__item--nested');
24+
rootLi.classList.add('md-nav__item--version');
25+
26+
const input = document.createElement('input');
27+
input.classList.add('md-toggle');
28+
input.classList.add('md-nav__toggle');
29+
input.setAttribute('data-md-toggle', 'nav-10000000');
30+
input.id = "nav-10000000";
31+
input.type = 'checkbox';
32+
33+
rootLi.appendChild(input);
34+
35+
const lbl01 = document.createElement('label')
36+
lbl01.classList.add('md-nav__link');
37+
lbl01.setAttribute('for', 'nav-10000000');
38+
lbl01.textContent = current.text + " ";
39+
40+
rootLi.appendChild(lbl01);
41+
42+
const nav = document.createElement('nav')
43+
nav.classList.add('md-nav');
44+
nav.setAttribute('data-md-component','collapsible');
45+
nav.setAttribute('data-md-level','1');
46+
47+
rootLi.appendChild(nav);
48+
49+
const lbl02 = document.createElement('label')
50+
lbl02.classList.add('md-nav__title');
51+
lbl02.setAttribute('for', 'nav-10000000');
52+
lbl02.textContent = current.text + " ";
53+
54+
nav.appendChild(lbl02);
55+
56+
const ul = document.createElement('ul')
57+
ul.classList.add('md-nav__list');
58+
ul.setAttribute('data-md-scrollfix','');
59+
60+
nav.appendChild(ul);
61+
62+
for (let i = 0; i < versions.length; i++) {
63+
const li = document.createElement('li');
64+
li.classList.add('md-nav__item');
65+
66+
ul.appendChild(li);
67+
68+
const a = document.createElement('a');
69+
a.classList.add('md-nav__link');
70+
if (versions[i].selected) {
71+
a.classList.add('md-nav__link--active');
72+
}
73+
a.href = window.location.protocol + "//" + window.location.host + "/";
74+
if (versions[i].path) {
75+
a.href = a.href + versions[i].path + "/"
76+
}
77+
a.title = versions[i].text;
78+
a.text = versions[i].text;
79+
80+
li.appendChild(a);
81+
}
82+
83+
elt.appendChild(rootLi);
84+
}
85+
86+
const materialSelector = 'div.md-container main.md-main div.md-main__inner.md-grid div.md-sidebar.md-sidebar--primary div.md-sidebar__scrollwrap div.md-sidebar__inner nav.md-nav.md-nav--primary ul.md-nav__list';
87+
const elt = document.querySelector(materialSelector);
88+
addMaterialMenu(elt, versions);

0 commit comments

Comments
 (0)