mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
chore(docs) fix version selector
This commit is contained in:
parent
f95b72de3a
commit
0ba2e25626
1
docs/_static/css/custom.css
vendored
1
docs/_static/css/custom.css
vendored
@ -51,6 +51,7 @@ code.sig-name
|
||||
}
|
||||
.wy-side-nav-search>div.version {
|
||||
color: #333;
|
||||
display: none; /*replaced by dropdown*/
|
||||
}
|
||||
|
||||
|
||||
|
31
docs/_templates/layout.html
vendored
Normal file
31
docs/_templates/layout.html
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{% extends "!layout.html" %}
|
||||
|
||||
{%- block extrahead %}
|
||||
{{ super() }}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-78811084-3"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-78811084-3', { 'anonymize_ip': true });
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{{ super() }}
|
||||
<div class="footer">This page uses <a href="https://analytics.google.com/">
|
||||
Google Analytics</a> to collect statistics. You can disable it by blocking
|
||||
the JavaScript coming from www.google-analytics.com.
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var ga = document.createElement('script');
|
||||
ga.src = ('https:' == document.location.protocol ?
|
||||
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
ga.setAttribute('async', 'true');
|
||||
document.documentElement.firstChild.appendChild(ga);
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
{% endblock %}
|
45
docs/_templates/page.html
vendored
Normal file
45
docs/_templates/page.html
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
{% extends "!page.html" %}
|
||||
|
||||
{% block footer %}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(".toggle > *").hide();
|
||||
$(".toggle .header").show();
|
||||
$(".toggle .header").click(function() {
|
||||
$(this).parent().children().not(".header").toggle(400);
|
||||
$(this).parent().children(".header").toggleClass("open");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function add_version_selector()
|
||||
{
|
||||
return fetch("https://raw.githubusercontent.com/lvgl/docs_compiled/gh-pages/versionlist.txt")
|
||||
.then(res => res.text())
|
||||
.then(text => {
|
||||
const versions = text.split("\n").filter(version => version.trim().length > 0);
|
||||
p = document.getElementById("rtd-search-form").parentElement;
|
||||
p.innerHTML = `
|
||||
<select name="versions" id="versions" onchange="ver_sel()" style="border-radius:5px; margin-bottom:15px">
|
||||
${versions.map(version => `<option value="${version}">${version}</option>`)}
|
||||
</select>` + p.innerHTML;
|
||||
});
|
||||
}
|
||||
|
||||
function ver_sel()
|
||||
{
|
||||
var x = document.getElementById("versions").value;
|
||||
window.location.href = window.location.protocol + "//" + window.location.host + "/" + x + "/";
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
add_version_selector().then(() => {
|
||||
var value = window.location.pathname.split('/')[1];
|
||||
document.getElementById("versions").value = value;
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
@ -37,9 +37,11 @@ os.system("sed -i \"s|html_baseurl = .*|" + base_html +"|\" conf.py")
|
||||
|
||||
clean = 0
|
||||
trans = 0
|
||||
skip_latex = False
|
||||
args = sys.argv[1:]
|
||||
if len(args) >= 1:
|
||||
if "clean" in args: clean = 1
|
||||
if "skip_latex" in args: skip_latex = True
|
||||
|
||||
lang = "en"
|
||||
print("")
|
||||
@ -55,14 +57,17 @@ print("Running doxygen")
|
||||
cmd("cd ../scripts && doxygen Doxyfile")
|
||||
# BUILD PDF
|
||||
|
||||
# Silly workarond to include the more or less correct PDF download link in the PDF
|
||||
#cmd("cp -f " + lang +"/latex/LVGL.pdf LVGL.pdf | true")
|
||||
cmd("sphinx-build -b latex . out_latex")
|
||||
if not skip_latex:
|
||||
# Silly workarond to include the more or less correct PDF download link in the PDF
|
||||
#cmd("cp -f " + lang +"/latex/LVGL.pdf LVGL.pdf | true")
|
||||
cmd("sphinx-build -b latex . out_latex")
|
||||
|
||||
# Generate PDF
|
||||
cmd("cd out_latex && latexmk -pdf 'LVGL.tex'")
|
||||
# Copy the result PDF to the main directory to make it avaiable for the HTML build
|
||||
cmd("cd out_latex && cp -f LVGL.pdf ../LVGL.pdf")
|
||||
# Generate PDF
|
||||
cmd("cd out_latex && latexmk -pdf 'LVGL.tex'")
|
||||
# Copy the result PDF to the main directory to make it avaiable for the HTML build
|
||||
cmd("cd out_latex && cp -f LVGL.pdf ../LVGL.pdf")
|
||||
else:
|
||||
print("skipping latex build as requested")
|
||||
|
||||
# BULD HTML
|
||||
cmd("sphinx-build -b html . ../out_html")
|
||||
|
@ -232,5 +232,5 @@ def setup(app):
|
||||
'enable_auto_toc_tree': 'True',
|
||||
}, True)
|
||||
app.add_transform(AutoStructify)
|
||||
app.add_stylesheet('css/custom.css')
|
||||
app.add_stylesheet('css/fontawesome.min.css')
|
||||
app.add_css_file('css/custom.css')
|
||||
app.add_css_file('css/fontawesome.min.css')
|
||||
|
Loading…
x
Reference in New Issue
Block a user