docs collapse APIs by default

This commit is contained in:
embeddedt
2022-05-09 14:21:31 -04:00
parent 85e3e23878
commit ebd20af6e9
3 changed files with 46 additions and 2 deletions

View File

@@ -111,3 +111,23 @@ code.sig-name
.lv-example-link-button:visited {
color: white;
}
dl.cpp.unexpanded dd {
display: none;
}
.lv-api-expansion-button {
padding: 4px;
}
.lv-api-expansion-button::before {
font-family: FontAwesome, "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;
display: inline-block;
font-size: 1.1em;
cursor: pointer;
}
.unexpanded .lv-api-expansion-button::before {
content: "\f0da \00a0";
}
.expanded .lv-api-expansion-button::before {
content: "\f0d7 \00a0";
}

18
docs/_static/js/custom.js vendored Normal file
View File

@@ -0,0 +1,18 @@
/* API collapsing */
document.addEventListener('DOMContentLoaded', (event) => {
document.querySelectorAll("dl.cpp").forEach(cppListing => {
const dt = cppListing.querySelector("dt");
let shouldBeExpanded = false;
if(dt.id == document.location.hash.substring(1))
shouldBeExpanded = true;
cppListing.classList.add(shouldBeExpanded ? "expanded" : "unexpanded");
const button = document.createElement("span");
button.classList.add("lv-api-expansion-button");
button.addEventListener("click", () => {
cppListing.classList.toggle("unexpanded");
cppListing.classList.toggle("expanded");
});
dt.insertBefore(button, dt.firstChild);
});
})

View File

@@ -18,14 +18,16 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import subprocess
import sys
sys.path.insert(0, os.path.abspath('./_ext'))
from subprocess import PIPE, Popen
import recommonmark
from recommonmark.transform import AutoStructify
from sphinx.builders.html import StandaloneHTMLBuilder
from subprocess import Popen, PIPE
# -- General configuration ------------------------------------------------
@@ -148,6 +150,10 @@ html_sidebars = {
]
}
html_js_files = [
'js/custom.js'
]
html_favicon = 'favicon.png'
html_logo = 'logo_lvgl.png'